diff --git a/cmake/cmake.options b/cmake/cmake.options index 62816a80d5..86096c18fe 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -52,12 +52,22 @@ IF(${TD_WINDOWS}) ON ) ELSE () - - option( - BUILD_TEST - "If build unit tests using googletest" - ON - ) + include(CheckCXXCompilerFlag) + CHECK_CXX_COMPILER_FLAG("-std=c++13" COMPILER_SUPPORTS_CXX13) + IF(${COMPILER_SUPPORTS_CXX13}) + add_definitions(-DCOMPILER_SUPPORTS_CXX13) + option( + BUILD_TEST + "If build unit tests using googletest" + ON + ) + ELSE () + option( + BUILD_TEST + "If build unit tests using googletest" + OFF + ) + ENDIF () ENDIF () option( diff --git a/docs/en/14-reference/04-taosadapter.md b/docs/en/14-reference/04-taosadapter.md index 3264124655..cad229c32d 100644 --- a/docs/en/14-reference/04-taosadapter.md +++ b/docs/en/14-reference/04-taosadapter.md @@ -206,8 +206,8 @@ Note: InfluxDB token authorization is not supported at present. Only Basic autho You can use any client that supports the http protocol to access the RESTful interface address `http://:6041/` to write data in OpenTSDB compatible format to TDengine. ```text -/opentsdb/v1/put/json/:db -/opentsdb/v1/put/telnet/:db +/opentsdb/v1/put/json/ +/opentsdb/v1/put/telnet/ ``` ### collectd diff --git a/docs/zh/14-reference/04-taosadapter.md b/docs/zh/14-reference/04-taosadapter.md index 6e259391d4..42bc51a6d3 100644 --- a/docs/zh/14-reference/04-taosadapter.md +++ b/docs/zh/14-reference/04-taosadapter.md @@ -207,8 +207,8 @@ AllowWebSockets 您可以使用任何支持 http 协议的客户端访问 Restful 接口地址 `http://:6041/` 来写入 OpenTSDB 兼容格式的数据到 TDengine。EndPoint 如下: ```text -/opentsdb/v1/put/json/:db -/opentsdb/v1/put/telnet/:db +/opentsdb/v1/put/json/ +/opentsdb/v1/put/telnet/ ``` ### collectd diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 71867d9741..5326a959e6 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -1495,6 +1495,7 @@ typedef struct SSubQueryMsg { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; int8_t taskType; int8_t explain; uint32_t sqlLen; // the query sql, @@ -1514,6 +1515,7 @@ typedef struct { uint64_t sId; uint64_t queryId; uint64_t taskId; + int32_t execId; } SQueryContinueReq; typedef struct { @@ -1535,6 +1537,7 @@ typedef struct { uint64_t sId; uint64_t queryId; uint64_t taskId; + int32_t execId; } SResFetchReq; typedef struct { @@ -1546,6 +1549,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; int8_t status; } STaskStatus; @@ -1591,6 +1595,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; } STaskCancelReq; typedef struct { @@ -1603,6 +1608,7 @@ typedef struct { uint64_t queryId; uint64_t taskId; int64_t refId; + int32_t execId; } STaskDropReq; typedef struct { @@ -1623,6 +1629,7 @@ typedef struct { int8_t triggerType; int64_t maxDelay; int64_t watermark; + int8_t igExpired; } SCMCreateStreamReq; typedef struct { diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index acf08bd47e..008bdcc294 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -167,10 +167,6 @@ enum { TD_NEW_MSG_SEG(TDMT_VND_MSG) TD_DEF_MSG_TYPE(TDMT_VND_SUBMIT, "submit", SSubmitReq, SSubmitRsp) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY, "query", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY_CONTINUE, "query-continue", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_FETCH, "fetch", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TABLE, "create-table", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TABLE, "alter-table", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TABLE, "drop-table", NULL, NULL) @@ -184,12 +180,9 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_CHANGE, "vnode-mq-vg-change", SMqRebVgReq, SMqRebVgRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_VG_DELETE, "vnode-mq-vg-delete", SMqVDeleteReq, SMqVDeleteRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_COMMIT_OFFSET, "vnode-commit-offset", STqOffset, STqOffset) - TD_DEF_MSG_TYPE(TDMT_VND_CANCEL_TASK, "vnode-cancel-task", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_DROP_TASK, "vnode-drop-task", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_TOPIC, "vnode-create-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_TOPIC, "vnode-alter-topic", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TOPIC, "vnode-drop-topic", NULL, NULL) - TD_DEF_MSG_TYPE(TDMT_VND_EXPLAIN, "vnode-explain", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_SUBSCRIBE, "vnode-subscribe", SMVSubscribeReq, SMVSubscribeRsp) TD_DEF_MSG_TYPE(TDMT_VND_CONSUME, "vnode-consume", SMqPollReq, SMqDataBlkRsp) TD_DEF_MSG_TYPE(TDMT_VND_STREAM_TRIGGER, "vnode-stream-trigger", NULL, NULL) @@ -206,6 +199,17 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_COMPACT, "compact", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_TTL_TABLE, "drop-ttl-stb", NULL, NULL) + TD_NEW_MSG_SEG(TDMT_SCH_MSG) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY, "query", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_MERGE_QUERY, "merge-query", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_CONTINUE, "query-continue", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_QUERY_HEARTBEAT, "query-heartbeat", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_FETCH, "fetch", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_CANCEL_TASK, "cancel-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_DROP_TASK, "drop-task", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) + TD_NEW_MSG_SEG(TDMT_STREAM_MSG) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DEPLOY, "stream-task-deploy", SStreamTaskDeployReq, SStreamTaskDeployRsp) TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_DROP, "stream-task-drop", NULL, NULL) @@ -214,9 +218,6 @@ enum { TD_DEF_MSG_TYPE(TDMT_STREAM_TASK_RECOVER, "stream-task-recover", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_STREAM_RETRIEVE, "stream-retrieve", NULL, NULL) - TD_NEW_MSG_SEG(TDMT_SCH_MSG) - TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL) - TD_NEW_MSG_SEG(TDMT_MON_MSG) TD_DEF_MSG_TYPE(TDMT_MON_MM_INFO, "monitor-minfo", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MON_VM_INFO, "monitor-vinfo", NULL, NULL) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index f5e068693e..bd73e04746 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -192,79 +192,81 @@ #define TK_TRIGGER 174 #define TK_AT_ONCE 175 #define TK_WINDOW_CLOSE 176 -#define TK_KILL 177 -#define TK_CONNECTION 178 -#define TK_TRANSACTION 179 -#define TK_BALANCE 180 -#define TK_VGROUP 181 -#define TK_MERGE 182 -#define TK_REDISTRIBUTE 183 -#define TK_SPLIT 184 -#define TK_SYNCDB 185 -#define TK_DELETE 186 -#define TK_NULL 187 -#define TK_NK_QUESTION 188 -#define TK_NK_ARROW 189 -#define TK_ROWTS 190 -#define TK_TBNAME 191 -#define TK_QSTARTTS 192 -#define TK_QENDTS 193 -#define TK_WSTARTTS 194 -#define TK_WENDTS 195 -#define TK_WDURATION 196 -#define TK_CAST 197 -#define TK_NOW 198 -#define TK_TODAY 199 -#define TK_TIMEZONE 200 -#define TK_CLIENT_VERSION 201 -#define TK_SERVER_VERSION 202 -#define TK_SERVER_STATUS 203 -#define TK_CURRENT_USER 204 -#define TK_COUNT 205 -#define TK_LAST_ROW 206 -#define TK_BETWEEN 207 -#define TK_IS 208 -#define TK_NK_LT 209 -#define TK_NK_GT 210 -#define TK_NK_LE 211 -#define TK_NK_GE 212 -#define TK_NK_NE 213 -#define TK_MATCH 214 -#define TK_NMATCH 215 -#define TK_CONTAINS 216 -#define TK_JOIN 217 -#define TK_INNER 218 -#define TK_SELECT 219 -#define TK_DISTINCT 220 -#define TK_WHERE 221 -#define TK_PARTITION 222 -#define TK_BY 223 -#define TK_SESSION 224 -#define TK_STATE_WINDOW 225 -#define TK_SLIDING 226 -#define TK_FILL 227 -#define TK_VALUE 228 -#define TK_NONE 229 -#define TK_PREV 230 -#define TK_LINEAR 231 -#define TK_NEXT 232 -#define TK_HAVING 233 -#define TK_RANGE 234 -#define TK_EVERY 235 -#define TK_ORDER 236 -#define TK_SLIMIT 237 -#define TK_SOFFSET 238 -#define TK_LIMIT 239 -#define TK_OFFSET 240 -#define TK_ASC 241 -#define TK_NULLS 242 -#define TK_ID 243 -#define TK_NK_BITNOT 244 -#define TK_INSERT 245 -#define TK_VALUES 246 -#define TK_IMPORT 247 -#define TK_NK_SEMI 248 -#define TK_FILE 249 +#define TK_IGNORE 177 +#define TK_EXPIRED 178 +#define TK_KILL 179 +#define TK_CONNECTION 180 +#define TK_TRANSACTION 181 +#define TK_BALANCE 182 +#define TK_VGROUP 183 +#define TK_MERGE 184 +#define TK_REDISTRIBUTE 185 +#define TK_SPLIT 186 +#define TK_SYNCDB 187 +#define TK_DELETE 188 +#define TK_NULL 189 +#define TK_NK_QUESTION 190 +#define TK_NK_ARROW 191 +#define TK_ROWTS 192 +#define TK_TBNAME 193 +#define TK_QSTARTTS 194 +#define TK_QENDTS 195 +#define TK_WSTARTTS 196 +#define TK_WENDTS 197 +#define TK_WDURATION 198 +#define TK_CAST 199 +#define TK_NOW 200 +#define TK_TODAY 201 +#define TK_TIMEZONE 202 +#define TK_CLIENT_VERSION 203 +#define TK_SERVER_VERSION 204 +#define TK_SERVER_STATUS 205 +#define TK_CURRENT_USER 206 +#define TK_COUNT 207 +#define TK_LAST_ROW 208 +#define TK_BETWEEN 209 +#define TK_IS 210 +#define TK_NK_LT 211 +#define TK_NK_GT 212 +#define TK_NK_LE 213 +#define TK_NK_GE 214 +#define TK_NK_NE 215 +#define TK_MATCH 216 +#define TK_NMATCH 217 +#define TK_CONTAINS 218 +#define TK_JOIN 219 +#define TK_INNER 220 +#define TK_SELECT 221 +#define TK_DISTINCT 222 +#define TK_WHERE 223 +#define TK_PARTITION 224 +#define TK_BY 225 +#define TK_SESSION 226 +#define TK_STATE_WINDOW 227 +#define TK_SLIDING 228 +#define TK_FILL 229 +#define TK_VALUE 230 +#define TK_NONE 231 +#define TK_PREV 232 +#define TK_LINEAR 233 +#define TK_NEXT 234 +#define TK_HAVING 235 +#define TK_RANGE 236 +#define TK_EVERY 237 +#define TK_ORDER 238 +#define TK_SLIMIT 239 +#define TK_SOFFSET 240 +#define TK_LIMIT 241 +#define TK_OFFSET 242 +#define TK_ASC 243 +#define TK_NULLS 244 +#define TK_ID 245 +#define TK_NK_BITNOT 246 +#define TK_INSERT 247 +#define TK_VALUES 248 +#define TK_IMPORT 249 +#define TK_NK_SEMI 250 +#define TK_FILE 251 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 277fb78561..5474315434 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -34,6 +34,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_ELAPSED, FUNCTION_TYPE_IRATE, FUNCTION_TYPE_LAST_ROW, + FUNCTION_TYPE_LAST_ROWT, //TODO: removed FUNCTION_TYPE_MAX, FUNCTION_TYPE_MIN, FUNCTION_TYPE_MODE, @@ -125,6 +126,7 @@ typedef enum EFunctionType { FUNCTION_TYPE_BLOCK_DIST_INFO, // block distribution pseudo column function FUNCTION_TYPE_TO_COLUMN, FUNCTION_TYPE_GROUP_KEY, + FUNCTION_TYPE_CACHE_LAST_ROW, // distributed splitting functions FUNCTION_TYPE_APERCENTILE_PARTIAL = 4000, diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e473daad8d..134cd80487 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -338,6 +338,7 @@ typedef struct SStreamOptions { int8_t triggerType; SNode* pDelay; SNode* pWatermark; + bool ignoreExpired; } SStreamOptions; typedef struct SCreateStreamStmt { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 4671c8b81e..012ba114ce 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -73,8 +73,7 @@ typedef struct SScanLogicNode { SNode* pTagIndexCond; int8_t triggerType; int64_t watermark; - int16_t tsColId; - double filesFactor; + int8_t igExpired; SArray* pSmaIndexes; SNodeList* pGroupTags; bool groupSort; @@ -91,6 +90,7 @@ typedef struct SAggLogicNode { SLogicNode node; SNodeList* pGroupKeys; SNodeList* pAggFuncs; + bool hasLastRow; } SAggLogicNode; typedef struct SProjectLogicNode { @@ -174,7 +174,7 @@ typedef struct SWindowLogicNode { SNode* pStateExpr; int8_t triggerType; int64_t watermark; - double filesFactor; + int8_t igExpired; EWindowAlgorithm windowAlgo; } SWindowLogicNode; @@ -295,8 +295,7 @@ typedef struct STableScanPhysiNode { int8_t slidingUnit; int8_t triggerType; int64_t watermark; - int16_t tsColId; - double filesFactor; + int8_t igExpired; } STableScanPhysiNode; typedef STableScanPhysiNode STableSeqScanPhysiNode; @@ -346,6 +345,7 @@ typedef struct SDownstreamSourceNode { SQueryNodeAddr addr; uint64_t taskId; uint64_t schedId; + int32_t execId; } SDownstreamSourceNode; typedef struct SExchangePhysiNode { @@ -372,7 +372,7 @@ typedef struct SWinodwPhysiNode { SNode* pTsEnd; // window end timestamp int8_t triggerType; int64_t watermark; - double filesFactor; + int8_t igExpired; } SWinodwPhysiNode; typedef struct SIntervalPhysiNode { diff --git a/include/libs/planner/planner.h b/include/libs/planner/planner.h index b4c75da131..d1a5c5db10 100644 --- a/include/libs/planner/planner.h +++ b/include/libs/planner/planner.h @@ -34,6 +34,7 @@ typedef struct SPlanContext { bool showRewrite; int8_t triggerType; int64_t watermark; + int8_t igExpired; char* pMsg; int32_t msgLen; const char* pUser; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index 9e8ce3ffb6..9881c8cb44 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -135,9 +135,11 @@ typedef struct STableMetaOutput { } STableMetaOutput; typedef struct SDataBuf { + int32_t msgType; void* pData; uint32_t len; void* handle; + SEpSet* pEpSet; } SDataBuf; typedef struct STargetInfo { @@ -146,7 +148,7 @@ typedef struct STargetInfo { int32_t vgId; } STargetInfo; -typedef int32_t (*__async_send_cb_fn_t)(void* param, const SDataBuf* pMsg, int32_t code); +typedef int32_t (*__async_send_cb_fn_t)(void* param, SDataBuf* pMsg, int32_t code); typedef int32_t (*__async_exec_fn_t)(void* param); typedef struct SRequestConnInfo { @@ -234,13 +236,25 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t #define NEED_CLIENT_HANDLE_ERROR(_code) \ (NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \ NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code)) +#define NEED_REDIRECT_ERROR(_code) \ + ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ + (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || (_code) == TSDB_CODE_SYN_NOT_LEADER || \ + (_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK) + #define NEED_CLIENT_RM_TBLMETA_REQ(_type) \ ((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_VND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \ (_type) == TDMT_VND_DROP_STB) -#define NEED_SCHEDULER_RETRY_ERROR(_code) \ - ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ - (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR) +#define NEED_SCHEDULER_REDIRECT_ERROR(_code) \ + ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \ + (_code) == TSDB_CODE_SYN_NOT_LEADER || (_code) == TSDB_CODE_APP_NOT_READY) + +#define NEED_SCHEDULER_RETRY_ERROR(_code) \ + (NEED_SCHEDULER_REDIRECT_ERROR(_code) || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || \ + (_code) == TSDB_CODE_SCH_TIMEOUT_ERROR || (_code) == TSDB_CODE_RPC_BROKEN_LINK) + + + #define REQUEST_TOTAL_EXEC_TIMES 2 diff --git a/include/os/osMath.h b/include/os/osMath.h index e13c32422e..b0c75f4dd7 100644 --- a/include/os/osMath.h +++ b/include/os/osMath.h @@ -60,6 +60,13 @@ extern "C" { }) #endif +#ifndef __COMPAR_FN_T +#define __COMPAR_FN_T +typedef int32_t (*__compar_fn_t)(const void *, const void *); +#endif + +void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar); + #ifdef __cplusplus } #endif diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 08e09dca2f..db6f1c0e1e 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -86,6 +86,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_RPC_NETWORK_UNAVAIL TAOS_DEF_ERROR_CODE(0, 0x0102) #define TSDB_CODE_RPC_FQDN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0103) #define TSDB_CODE_RPC_PORT_EADDRINUSE TAOS_DEF_ERROR_CODE(0, 0x0104) +#define TSDB_CODE_RPC_BROKEN_LINK TAOS_DEF_ERROR_CODE(0, 0x0105) //client #define TSDB_CODE_TSC_INVALID_OPERATION TAOS_DEF_ERROR_CODE(0, 0x0200) diff --git a/packaging/cfg/tarbitratord.service b/packaging/cfg/tarbitratord.service deleted file mode 100644 index d60cb536b0..0000000000 --- a/packaging/cfg/tarbitratord.service +++ /dev/null @@ -1,20 +0,0 @@ -[Unit] -Description=TDengine arbitrator service -After=network-online.target -Wants=network-online.target - -[Service] -Type=simple -ExecStart=/usr/bin/tarbitrator -TimeoutStopSec=1000000s -LimitNOFILE=infinity -LimitNPROC=infinity -LimitCORE=infinity -TimeoutStartSec=0 -StandardOutput=null -Restart=always -StartLimitBurst=3 -StartLimitInterval=60s - -[Install] -WantedBy=multi-user.target diff --git a/packaging/deb/tarbitratord b/packaging/deb/tarbitratord deleted file mode 100644 index 3f97c3c0c2..0000000000 --- a/packaging/deb/tarbitratord +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# -# Modified from original source: Elastic Search -# https://github.com/elasticsearch/elasticsearch -# Thank you to the Elastic Search authors -# -# chkconfig: 2345 99 01 -# -### BEGIN INIT INFO -# Provides: taoscluster -# Required-Start: $local_fs $network $syslog -# Required-Stop: $local_fs $network $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Starts taoscluster tarbitrator -# Description: Starts taoscluster tarbitrator, a arbitrator -### END INIT INFO - -set -e - -PATH="/bin:/usr/bin:/sbin:/usr/sbin" -NAME="taoscluster" -USER="root" -GROUP="root" -DAEMON="/usr/local/taos/bin/tarbitrator" -DAEMON_OPTS="" -PID_FILE="/var/run/$NAME.pid" -APPARGS="" - -# Maximum number of open files -MAX_OPEN_FILES=65535 - -. /lib/lsb/init-functions - -case "$1" in - start) - - log_action_begin_msg "Starting tarbitrator..." - if start-stop-daemon --test --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS &> /dev/null; then - - touch "$PID_FILE" && chown "$USER":"$GROUP" "$PID_FILE" - - if [ -n "$MAX_OPEN_FILES" ]; then - ulimit -n $MAX_OPEN_FILES - fi - - start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile "$PID_FILE" --exec "$DAEMON" -- $APPARGS - - log_end_msg $? - fi - ;; - - stop) - log_action_begin_msg "Stopping tarbitrator..." - set +e - if [ -f "$PID_FILE" ]; then - start-stop-daemon --stop --pidfile "$PID_FILE" --user "$USER" --retry=TERM/120/KILL/5 > /dev/null - if [ $? -eq 1 ]; then - log_action_cont_msg "TSD is not running but pid file exists, cleaning up" - elif [ $? -eq 3 ]; then - PID="`cat $PID_FILE`" - log_failure_msg "Failed to stop tarbitrator (pid $PID)" - exit 1 - fi - rm -f "$PID_FILE" - else - log_action_cont_msg "tarbitrator was not running" - fi - log_action_end_msg 0 - set -e - ;; - - restart|force-reload) - if [ -f "$PID_FILE" ]; then - $0 stop - sleep 1 - fi - $0 start - ;; - status) - status_of_proc -p "$PID_FILE" "$DAEMON" "$NAME" - ;; - *) - exit 1 - ;; -esac - -exit 0 diff --git a/packaging/release.sh b/packaging/release.sh index 1d9f6dfc68..3426c2856d 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -111,9 +111,9 @@ else fi csudo="" -if command -v sudo > /dev/null; then - csudo="sudo " -fi +#if command -v sudo > /dev/null; then +# csudo="sudo " +#fi function is_valid_version() { [ -z $1 ] && return 1 || : @@ -181,7 +181,9 @@ cd "${curr_dir}" # 2. cmake executable file compile_dir="${top_dir}/debug" -${csudo}rm -rf ${compile_dir} +if [ -d ${compile_dir} ]; then + rm -rf ${compile_dir} +fi mkdir -p ${compile_dir} cd ${compile_dir} @@ -258,9 +260,9 @@ if [ "$osType" != "Darwin" ]; then if [[ "$pagMode" == "full" ]]; then if [ -d ${top_dir}/tools/taos-tools/packaging/deb ]; then cd ${top_dir}/tools/taos-tools/packaging/deb + taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}') [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" - taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}') ${csudo}./make-taos-tools-deb.sh ${top_dir} \ ${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType} fi @@ -283,9 +285,9 @@ if [ "$osType" != "Darwin" ]; then if [[ "$pagMode" == "full" ]]; then if [ -d ${top_dir}/tools/taos-tools/packaging/rpm ]; then cd ${top_dir}/tools/taos-tools/packaging/rpm + taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}' | sed -e 's/-/_/g') [ -z "$taos_tools_ver" ] && taos_tools_ver="0.1.0" - taos_tools_ver=$(git describe --tags | sed -e 's/ver-//g' | awk -F '-' '{print $1}' | sed -e 's/-/_/g') ${csudo}./make-taos-tools-rpm.sh ${top_dir} \ ${compile_dir} ${output_dir} ${taos_tools_ver} ${cpuType} ${osType} ${verMode} ${verType} fi @@ -300,7 +302,6 @@ if [ "$osType" != "Darwin" ]; then ${csudo}./makepkg.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${verNumberComp} ${dbName} ${csudo}./makeclient.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} ${dbName} - # ${csudo}./makearbi.sh ${compile_dir} ${verNumber} "${build_time}" ${cpuType} ${osType} ${verMode} ${verType} ${pagMode} else # only make client for Darwin diff --git a/packaging/rpm/tarbitratord b/packaging/rpm/tarbitratord deleted file mode 100644 index 68138f5c1d..0000000000 --- a/packaging/rpm/tarbitratord +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash -# -# tarbitratord This shell script takes care of starting and stopping tarbitrator. -# -# chkconfig: 2345 99 01 -# description: tarbitrator is a arbitrator used in TDengine cluster. -# -# -### BEGIN INIT INFO -# Provides: taoscluster -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Short-Description: start and stop tarbitrator -# Description: tarbitrator is a arbitrator used in TDengine cluster. -### END INIT INFO - -# Source init functions -. /etc/init.d/functions - -# Maximum number of open files -MAX_OPEN_FILES=65535 - -# Default program options -NAME=tarbitrator -PROG=/usr/local/taos/bin/tarbitrator -USER=root -GROUP=root - -# Default directories -LOCK_DIR=/var/lock/subsys -PID_DIR=/var/run/$NAME - -# Set file names -LOCK_FILE=$LOCK_DIR/$NAME -PID_FILE=$PID_DIR/$NAME.pid - -[ -e $PID_DIR ] || mkdir -p $PID_DIR - -PROG_OPTS="" - -start() { - echo -n "Starting ${NAME}: " - # check identity - curid="`id -u -n`" - if [ "$curid" != root ] && [ "$curid" != "$USER" ] ; then - echo "Must be run as root or $USER, but was run as $curid" - return 1 - fi - # Sets the maximum number of open file descriptors allowed. - ulimit -n $MAX_OPEN_FILES - curulimit="`ulimit -n`" - if [ "$curulimit" -lt $MAX_OPEN_FILES ] ; then - echo "'ulimit -n' must be greater than or equal to $MAX_OPEN_FILES, is $curulimit" - return 1 - fi - - if [ "`id -u -n`" == root ] ; then - # Changes the owner of the lock, and the pid files to allow - # non-root OpenTSDB daemons to run /usr/share/opentsdb/bin/opentsdb_restart.py. - touch $LOCK_FILE && chown $USER:$GROUP $LOCK_FILE - touch $PID_FILE && chown $USER:$GROUP $PID_FILE - daemon --user $USER --pidfile $PID_FILE "$PROG $PROG_OPTS &> /dev/null &" - else - # Don't have to change user. - daemon --pidfile $PID_FILE "$PROG $PROG_OPTS &> /dev/null &" - fi - retval=$? - sleep 2 - echo - [ $retval -eq 0 ] && (findproc > $PID_FILE && touch $LOCK_FILE) - return $retval -} - -stop() { - echo -n "Stopping ${NAME}: " - killproc -p $PID_FILE $NAME - retval=$? - echo - # Non-root users don't have enough permission to remove pid and lock files. - # So, the opentsdb_restart.py cannot get rid of the files, and the command - # "service opentsdb status" will complain about the existing pid file. - # Makes the pid file empty. - echo > $PID_FILE - [ $retval -eq 0 ] && (rm -f $PID_FILE && rm -f $LOCK_FILE) - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - # run checks to determine if the service is running or use generic status - status -p $PID_FILE -l $LOCK_FILE $NAME -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac - -exit $? diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 7c7d5477cf..2d17ef4812 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -194,7 +194,6 @@ function install_bin() { ${csudo}rm -f ${bin_link_dir}/${serverName} || : ${csudo}rm -f ${bin_link_dir}/${adapterName} || : ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : - ${csudo}rm -f ${bin_link_dir}/tarbitrator || : ${csudo}rm -f ${bin_link_dir}/set_core || : ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : @@ -210,7 +209,6 @@ function install_bin() { [ -x ${install_main_dir}/bin/TDinsight.sh ] && ${csudo}ln -s ${install_main_dir}/bin/TDinsight.sh ${bin_link_dir}/TDinsight.sh || : [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/${uninstallScript} || : [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo}ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : - [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || : if [ "$verMode" == "cluster" ]; then ${csudo}cp -r ${script_dir}/nginxd/* ${nginx_dir} && ${csudo}chmod 0555 ${nginx_dir}/* @@ -606,28 +604,19 @@ function install_service_on_sysvinit() { if ((${os_type} == 1)); then # ${csudo}cp -f ${script_dir}/init.d/${serverName}.deb ${install_main_dir}/init.d/${serverName} ${csudo}cp ${script_dir}/init.d/${serverName}.deb ${service_config_dir}/${serverName} && ${csudo}chmod a+x ${service_config_dir}/${serverName} - # ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord - ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord elif ((${os_type} == 2)); then # ${csudo}cp -f ${script_dir}/init.d/${serverName}.rpm ${install_main_dir}/init.d/${serverName} ${csudo}cp ${script_dir}/init.d/${serverName}.rpm ${service_config_dir}/${serverName} && ${csudo}chmod a+x ${service_config_dir}/${serverName} - # ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord - ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord fi if ((${initd_mod} == 1)); then ${csudo}chkconfig --add ${serverName} || : ${csudo}chkconfig --level 2345 ${serverName} on || : - ${csudo}chkconfig --add tarbitratord || : - ${csudo}chkconfig --level 2345 tarbitratord on || : elif ((${initd_mod} == 2)); then ${csudo}insserv ${serverName} || : ${csudo}insserv -d ${serverName} || : - ${csudo}insserv tarbitratord || : - ${csudo}insserv -d tarbitratord || : elif ((${initd_mod} == 3)); then ${csudo}update-rc.d ${serverName} defaults || : - ${csudo}update-rc.d tarbitratord defaults || : fi } @@ -669,9 +658,6 @@ function install_service_on_systemd() { ${csudo}systemctl enable ${serverName} - [ -f ${script_dir}/cfg/tarbitratord.service ] && - ${csudo}cp ${script_dir}/cfg/tarbitratord.service \ - ${service_config_dir}/ || : ${csudo}systemctl daemon-reload if [ "$verMode" == "cluster" ]; then diff --git a/packaging/tools/install_arbi.sh b/packaging/tools/install_arbi.sh deleted file mode 100755 index 2863640153..0000000000 --- a/packaging/tools/install_arbi.sh +++ /dev/null @@ -1,340 +0,0 @@ -#!/bin/bash -# -# This file is used to install database on linux systems. The operating system -# is required to use systemd to manage services at boot - -set -e -#set -x - -# -----------------------Variables definition--------------------- -script_dir=$(dirname $(readlink -f "$0")) - -bin_link_dir="/usr/bin" -#inc_link_dir="/usr/include" - -#install main path -install_main_dir="/usr/local/tarbitrator" - -# old bin dir -bin_dir="/usr/local/tarbitrator/bin" - -service_config_dir="/etc/systemd/system" - -# Color setting -RED='\033[0;31m' -GREEN='\033[1;32m' -GREEN_DARK='\033[0;32m' -GREEN_UNDERLINE='\033[4;32m' -NC='\033[0m' - -csudo="" -if command -v sudo >/dev/null; then - csudo="sudo " -fi - -update_flag=0 - -initd_mod=0 -service_mod=2 -if pidof systemd &>/dev/null; then - service_mod=0 -elif $(which service &>/dev/null); then - service_mod=1 - service_config_dir="/etc/init.d" - if $(which chkconfig &>/dev/null); then - initd_mod=1 - elif $(which insserv &>/dev/null); then - initd_mod=2 - elif $(which update-rc.d &>/dev/null); then - initd_mod=3 - else - service_mod=2 - fi -else - service_mod=2 -fi - -# get the operating system type for using the corresponding init file -# ubuntu/debian(deb), centos/fedora(rpm), others: opensuse, redhat, ..., no verification -#osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) -if [[ -e /etc/os-release ]]; then - osinfo=$(cat /etc/os-release | grep "NAME" | cut -d '"' -f2) || : -else - osinfo="" -fi -#echo "osinfo: ${osinfo}" -os_type=0 -if echo $osinfo | grep -qwi "ubuntu"; then - # echo "This is ubuntu system" - os_type=1 -elif echo $osinfo | grep -qwi "debian"; then - # echo "This is debian system" - os_type=1 -elif echo $osinfo | grep -qwi "Kylin"; then - # echo "This is Kylin system" - os_type=1 -elif echo $osinfo | grep -qwi "centos"; then - # echo "This is centos system" - os_type=2 -elif echo $osinfo | grep -qwi "fedora"; then - # echo "This is fedora system" - os_type=2 -else - echo " osinfo: ${osinfo}" - echo " This is an officially unverified linux system," - echo " if there are any problems with the installation and operation, " - echo " please feel free to contact taosdata.com for support." - os_type=1 -fi - -function kill_tarbitrator() { - pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} - -function install_main_path() { - #create install main dir and all sub dir - ${csudo}rm -rf ${install_main_dir} || : - ${csudo}mkdir -p ${install_main_dir} - ${csudo}mkdir -p ${install_main_dir}/bin - #${csudo}mkdir -p ${install_main_dir}/include - ${csudo}mkdir -p ${install_main_dir}/init.d -} - -function install_bin() { - # Remove links - ${csudo}rm -f ${bin_link_dir}/rmtarbitrator || : - ${csudo}rm -f ${bin_link_dir}/tarbitrator || : - ${csudo}cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo}chmod 0555 ${install_main_dir}/bin/* - - #Make link - [ -x ${install_main_dir}/bin/remove_arbi.sh ] && ${csudo}ln -s ${install_main_dir}/bin/remove_arbi.sh ${bin_link_dir}/rmtarbitrator || : - [ -x ${install_main_dir}/bin/tarbitrator ] && ${csudo}ln -s ${install_main_dir}/bin/tarbitrator ${bin_link_dir}/tarbitrator || : -} - -function install_header() { - ${csudo}rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.h ${inc_link_dir}/taosudf.h || : - ${csudo}cp -f ${script_dir}/inc/* ${install_main_dir}/include && ${csudo}chmod 644 ${install_main_dir}/include/* - ${csudo}ln -s ${install_main_dir}/include/taos.h ${inc_link_dir}/taos.h - ${csudo}ln -s ${install_main_dir}/include/taosdef.h ${inc_link_dir}/taosdef.h - ${csudo}ln -s ${install_main_dir}/include/taoserror.h ${inc_link_dir}/taoserror.h - ${csudo}ln -s ${install_main_dir}/include/taosudf.h ${inc_link_dir}/taosudf.h -} - -function install_jemalloc() { - jemalloc_dir=${script_dir}/jemalloc - - if [ -d ${jemalloc_dir} ]; then - ${csudo}/usr/bin/install -c -d /usr/local/bin - - if [ -f ${jemalloc_dir}/bin/jemalloc-config ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc-config /usr/local/bin - fi - if [ -f ${jemalloc_dir}/bin/jemalloc.sh ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jemalloc.sh /usr/local/bin - fi - if [ -f ${jemalloc_dir}/bin/jeprof ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/bin/jeprof /usr/local/bin - fi - if [ -f ${jemalloc_dir}/include/jemalloc/jemalloc.h ]; then - ${csudo}/usr/bin/install -c -d /usr/local/include/jemalloc - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/include/jemalloc/jemalloc.h /usr/local/include/jemalloc - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc.so.2 ]; then - ${csudo}/usr/bin/install -c -d /usr/local/lib - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.so.2 /usr/local/lib - ${csudo}ln -sf libjemalloc.so.2 /usr/local/lib/libjemalloc.so - ${csudo}/usr/bin/install -c -d /usr/local/lib - if [ -f ${jemalloc_dir}/lib/libjemalloc.a ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc.a /usr/local/lib - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then - ${csudo}/usr/bin/install -c -m 755 ${jemalloc_dir}/lib/libjemalloc_pic.a /usr/local/lib - fi - if [ -f ${jemalloc_dir}/lib/libjemalloc_pic.a ]; then - ${csudo}/usr/bin/install -c -d /usr/local/lib/pkgconfig - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/lib/pkgconfig/jemalloc.pc /usr/local/lib/pkgconfig - fi - fi - if [ -f ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html ]; then - ${csudo}/usr/bin/install -c -d /usr/local/share/doc/jemalloc - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/doc/jemalloc/jemalloc.html /usr/local/share/doc/jemalloc - fi - if [ -f ${jemalloc_dir}/share/man/man3/jemalloc.3 ]; then - ${csudo}/usr/bin/install -c -d /usr/local/share/man/man3 - ${csudo}/usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 - fi - - if [ -d /etc/ld.so.conf.d ]; then - echo "/usr/local/lib" | ${csudo}tee /etc/ld.so.conf.d/jemalloc.conf >/dev/null || echo -e "failed to write /etc/ld.so.conf.d/jemalloc.conf" - ${csudo}ldconfig - else - echo "/etc/ld.so.conf.d not found!" - fi - fi -} - -function clean_service_on_sysvinit() { - if pidof tarbitrator &>/dev/null; then - ${csudo}service tarbitratord stop || : - fi - - if ((${initd_mod} == 1)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}chkconfig --del tarbitratord || : - fi - elif ((${initd_mod} == 2)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}insserv -r tarbitratord || : - fi - elif ((${initd_mod} == 3)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}update-rc.d -f tarbitratord remove || : - fi - fi - - ${csudo}rm -f ${service_config_dir}/tarbitratord || : - - if $(which init &>/dev/null); then - ${csudo}init q || : - fi -} - -function install_service_on_sysvinit() { - clean_service_on_sysvinit - sleep 1 - - if ((${os_type} == 1)); then - ${csudo}cp -f ${script_dir}/init.d/tarbitratord.deb ${install_main_dir}/init.d/tarbitratord - ${csudo}cp ${script_dir}/init.d/tarbitratord.deb ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord - elif ((${os_type} == 2)); then - ${csudo}cp -f ${script_dir}/init.d/tarbitratord.rpm ${install_main_dir}/init.d/tarbitratord - ${csudo}cp ${script_dir}/init.d/tarbitratord.rpm ${service_config_dir}/tarbitratord && ${csudo}chmod a+x ${service_config_dir}/tarbitratord - fi - - if ((${initd_mod} == 1)); then - ${csudo}chkconfig --add tarbitratord || : - ${csudo}chkconfig --level 2345 tarbitratord on || : - elif ((${initd_mod} == 2)); then - ${csudo}insserv tarbitratord || : - ${csudo}insserv -d tarbitratord || : - elif ((${initd_mod} == 3)); then - ${csudo}update-rc.d tarbitratord defaults || : - fi -} - -function clean_service_on_systemd() { - tarbitratord_service_config="${service_config_dir}/tarbitratord.service" - if systemctl is-active --quiet tarbitratord; then - echo "tarbitrator is running, stopping it..." - ${csudo}systemctl stop tarbitratord &>/dev/null || echo &>/dev/null - fi - ${csudo}systemctl disable tarbitratord &>/dev/null || echo &>/dev/null - - ${csudo}rm -f ${tarbitratord_service_config} -} - -function install_service_on_systemd() { - clean_service_on_systemd - - tarbitratord_service_config="${service_config_dir}/tarbitratord.service" - - ${csudo}bash -c "echo '[Unit]' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'Description=TDengine arbitrator service' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'After=network-online.target' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'Wants=network-online.target' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo '[Service]' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'Type=simple' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'ExecStart=/usr/bin/tarbitrator' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'TimeoutStopSec=1000000s' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'LimitNOFILE=infinity' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'LimitNPROC=infinity' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'LimitCORE=infinity' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'TimeoutStartSec=0' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'StandardOutput=null' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'Restart=always' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'StartLimitBurst=3' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'StartLimitInterval=60s' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo '[Install]' >> ${tarbitratord_service_config}" - ${csudo}bash -c "echo 'WantedBy=multi-user.target' >> ${tarbitratord_service_config}" - ${csudo}systemctl enable tarbitratord -} - -function install_service() { - if ((${service_mod} == 0)); then - install_service_on_systemd - elif ((${service_mod} == 1)); then - install_service_on_sysvinit - else - kill_tarbitrator - fi -} - -function update_TDengine() { - # Start to update - echo -e "${GREEN}Start to update TDengine's arbitrator ...${NC}" - # Stop the service if running - if pidof tarbitrator &>/dev/null; then - if ((${service_mod} == 0)); then - ${csudo}systemctl stop tarbitratord || : - elif ((${service_mod} == 1)); then - ${csudo}service tarbitratord stop || : - else - kill_tarbitrator - fi - sleep 1 - fi - - install_main_path - #install_header - install_bin - install_service - install_jemalloc - - echo - if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}" - elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}" - else - echo -e "${GREEN_DARK}To start arbitrator ${NC}: ./tarbitrator${NC}" - fi - echo - echo -e "\033[44;32;1mTDengine's arbitrator is updated successfully!${NC}" -} - -function install_TDengine() { - # Start to install - echo -e "${GREEN}Start to install TDengine's arbitrator ...${NC}" - - install_main_path - #install_header - install_bin - install_service - install_jemalloc - - echo - if ((${service_mod} == 0)); then - echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}systemctl start tarbitratord${NC}" - elif ((${service_mod} == 1)); then - echo -e "${GREEN_DARK}To start arbitrator ${NC}: ${csudo}service tarbitratord start${NC}" - else - echo -e "${GREEN_DARK}To start arbitrator ${NC}: tarbitrator${NC}" - fi - - echo -e "\033[44;32;1mTDengine's arbitrator is installed successfully!${NC}" - echo -} - -## ==============================Main program starts from here============================ -# Install server and client -if [ -x ${bin_dir}/tarbitrator ]; then - update_flag=1 - update_TDengine -else - install_TDengine -fi diff --git a/packaging/tools/make_install.sh b/packaging/tools/make_install.sh index 59be60f8fc..4e4ebb72c0 100755 --- a/packaging/tools/make_install.sh +++ b/packaging/tools/make_install.sh @@ -185,7 +185,6 @@ function install_bin() { [ -f ${binary_dir}/build/bin/taosadapter ] && ${csudo}cp -r ${binary_dir}/build/bin/taosadapter ${install_main_dir}/bin || : [ -f ${binary_dir}/build/bin/udfd ] && ${csudo}cp -r ${binary_dir}/build/bin/udfd ${install_main_dir}/bin || : ${csudo}cp -r ${binary_dir}/build/bin/${serverName} ${install_main_dir}/bin || : - # ${csudo}cp -r ${binary_dir}/build/bin/tarbitrator ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/taosd-dump-cfg.gdb ${install_main_dir}/bin || : ${csudo}cp -r ${script_dir}/remove.sh ${install_main_dir}/bin || : diff --git a/packaging/tools/makearbi.sh b/packaging/tools/makearbi.sh deleted file mode 100755 index cfae2b4a46..0000000000 --- a/packaging/tools/makearbi.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash -# -# Generate arbitrator's tar.gz setup package for all os system - -set -e -#set -x - -curr_dir=$(pwd) -compile_dir=$1 -version=$2 -build_time=$3 -cpuType=$4 -osType=$5 -verMode=$6 -verType=$7 -pagMode=$8 - -script_dir="$(dirname $(readlink -f $0))" -top_dir="$(readlink -f ${script_dir}/../..)" - -productName="TDengine" - -# create compressed install file. -build_dir="${compile_dir}/build" -code_dir="${top_dir}" -release_dir="${top_dir}/release" - -#package_name='linux' -if [ "$verMode" == "cluster" ]; then - install_dir="${release_dir}/${productName}-enterprise-arbitrator-${version}" -else - install_dir="${release_dir}/${productName}-arbitrator-${version}" -fi - -# Directories and files. -bin_files="${build_dir}/bin/tarbitrator ${script_dir}/remove_arbi.sh" -install_files="${script_dir}/install_arbi.sh" - -#header_files="${code_dir}/include/client/taos.h ${code_dir}/include/common/taosdef.h ${code_dir}/include/util/taoserror.h ${code_dir}/include/libs/function/taosudf.h" -init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord -init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord - -# make directories. -mkdir -p ${install_dir} && cp ${install_files} ${install_dir} && chmod a+x ${install_dir}/install_arbi.sh || : -#mkdir -p ${install_dir}/inc && cp ${header_files} ${install_dir}/inc || : -mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : -mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || : -mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || : - -cd ${release_dir} - -# install_dir has been distinguishes cluster from edege, so comments this code -pkg_name=${install_dir}-${osType}-${cpuType} - -if [[ "$verType" == "beta" ]] || [[ "$verType" == "preRelease" ]]; then - pkg_name=${install_dir}-${verType}-${osType}-${cpuType} -elif [ "$verType" == "stable" ]; then - pkg_name=${pkg_name} -else - echo "unknow verType, nor stabel or beta" - exit 1 -fi - -tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || : -exitcode=$? -if [ "$exitcode" != "0" ]; then - echo "tar ${pkg_name}.tar.gz error !!!" - exit $exitcode -fi - -cd ${curr_dir} diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 0bc11b99b3..cd656fe6f2 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -85,7 +85,6 @@ else ${build_dir}/bin/${clientName} \ ${taostools_bin_files} \ ${build_dir}/bin/taosadapter \ - ${build_dir}/bin/tarbitrator\ ${script_dir}/remove.sh \ ${script_dir}/set_core.sh \ ${script_dir}/startPre.sh \ @@ -106,8 +105,6 @@ nginx_dir="${top_dir}/../enterprise/src/plugins/web" init_file_deb=${script_dir}/../deb/taosd init_file_rpm=${script_dir}/../rpm/taosd -init_file_tarbitrator_deb=${script_dir}/../deb/tarbitratord -init_file_tarbitrator_rpm=${script_dir}/../rpm/tarbitratord # make directories. mkdir -p ${install_dir} @@ -126,10 +123,6 @@ if [ -f "${cfg_dir}/${serverName}.service" ]; then cp ${cfg_dir}/${serverName}.service ${install_dir}/cfg || : fi -if [ -f "${top_dir}/packaging/cfg/tarbitratord.service" ]; then - cp ${top_dir}/packaging/cfg/tarbitratord.service ${install_dir}/cfg || : -fi - if [ -f "${top_dir}/packaging/cfg/nginxd.service" ]; then cp ${top_dir}/packaging/cfg/nginxd.service ${install_dir}/cfg || : fi @@ -137,8 +130,6 @@ fi mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm -mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_deb} ${install_dir}/init.d/tarbitratord.deb || : -mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}/init.d/tarbitratord.rpm || : if [ $adapterName != "taosadapter" ]; then mv ${install_dir}/cfg/taosadapter.toml ${install_dir}/cfg/$adapterName.toml diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 413de17ee6..d34c81a4f5 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Script to stop the service and uninstall TDengine, but retain the config, data and log files. +# Script to stop and uninstall the service, but retain the config, data and log files. set -e #set -x @@ -11,121 +11,216 @@ RED='\033[0;31m' GREEN='\033[1;32m' NC='\033[0m' +installDir="/usr/local/taos" +serverName="taosd" +clientName="taos" +uninstallScript="rmtaos" +productName="TDengine" + #install main path -install_main_dir="/usr/local/taos" -data_link_dir="/usr/local/taos/data" -log_link_dir="/usr/local/taos/log" -cfg_link_dir="/usr/local/taos/cfg" +install_main_dir=${installDir} +data_link_dir=${installDir}/data +log_link_dir=${installDir}/log +cfg_link_dir=${installDir}/cfg bin_link_dir="/usr/bin" +local_bin_link_dir="/usr/local/bin" lib_link_dir="/usr/lib" lib64_link_dir="/usr/lib64" inc_link_dir="/usr/include" +install_nginxd_dir="/usr/local/nginxd" service_config_dir="/etc/systemd/system" -taos_service_name="taosd" - +taos_service_name=${serverName} +taosadapter_service_name="taosadapter" +tarbitrator_service_name="tarbitratord" +nginx_service_name="nginxd" csudo="" -if command -v sudo > /dev/null; then - csudo="sudo" +if command -v sudo >/dev/null; then + csudo="sudo " fi initd_mod=0 service_mod=2 -if pidof systemd &> /dev/null; then - service_mod=0 -elif $(which service &> /dev/null); then - service_mod=1 - service_config_dir="/etc/init.d" - if $(which chkconfig &> /dev/null); then - initd_mod=1 - elif $(which insserv &> /dev/null); then - initd_mod=2 - elif $(which update-rc.d &> /dev/null); then - initd_mod=3 - else - service_mod=2 - fi -else +if pidof systemd &>/dev/null; then + service_mod=0 +elif $(which service &>/dev/null); then + service_mod=1 + service_config_dir="/etc/init.d" + if $(which chkconfig &>/dev/null); then + initd_mod=1 + elif $(which insserv &>/dev/null); then + initd_mod=2 + elif $(which update-rc.d &>/dev/null); then + initd_mod=3 + else service_mod=2 + fi +else + service_mod=2 fi - -function kill_taosd() { - pid=$(ps -ef | grep "taosd" | grep -v "grep" | awk '{print $2}') +function kill_taosadapter() { + pid=$(ps -ef | grep "taosadapter" | grep -v "grep" | awk '{print $2}') if [ -n "$pid" ]; then - ${csudo} kill -9 $pid || : + ${csudo}kill -9 $pid || : fi } +function kill_taosd() { + pid=$(ps -ef | grep ${serverName} | grep -v "grep" | awk '{print $2}') + if [ -n "$pid" ]; then + ${csudo}kill -9 $pid || : + fi +} + +function kill_tarbitrator() { + pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}') + if [ -n "$pid" ]; then + ${csudo}kill -9 $pid || : + fi +} function clean_bin() { - # Remove link - ${csudo} rm -f ${bin_link_dir}/taos || : - ${csudo} rm -f ${bin_link_dir}/taosd || : - ${csudo} rm -f ${bin_link_dir}/create_table || : - ${csudo} rm -f ${bin_link_dir}/tmq_sim || : - ${csudo} rm -f ${bin_link_dir}/taosdemo || : - ${csudo} rm -f ${bin_link_dir}/taosdump || : - ${csudo} rm -f ${bin_link_dir}/rmtaos || : - #${csudo} rm -f ${bin_link_dir}/set_core || : + # Remove link + ${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}/taosBenchmark || : + ${csudo}rm -f ${bin_link_dir}/taosdemo || : + ${csudo}rm -f ${bin_link_dir}/taosdump || : + ${csudo}rm -f ${bin_link_dir}/${uninstallScript} || : + ${csudo}rm -f ${bin_link_dir}/tarbitrator || : + ${csudo}rm -f ${bin_link_dir}/set_core || : + ${csudo}rm -f ${bin_link_dir}/TDinsight.sh || : +} + +function clean_local_bin() { + ${csudo}rm -f ${local_bin_link_dir}/taosBenchmark || : + ${csudo}rm -f ${local_bin_link_dir}/taosdemo || : } function clean_lib() { - # Remove link - ${csudo} rm -f ${lib_link_dir}/libtaos.* || : - ${csudo} rm -f ${lib64_link_dir}/libtaos.* || : - - ${csudo} rm -f ${lib_link_dir}/libtdb.* || : - ${csudo} rm -f ${lib64_link_dir}/libtdb.* || : + # Remove link + ${csudo}rm -f ${lib_link_dir}/libtaos.* || : + ${csudo}rm -f ${lib64_link_dir}/libtaos.* || : + #${csudo}rm -rf ${v15_java_app_dir} || : } function clean_header() { - # Remove link - ${csudo} rm -f ${inc_link_dir}/taos.h || : - ${csudo} rm -f ${inc_link_dir}/taosdef.h || : - ${csudo} rm -f ${inc_link_dir}/taoserror.h || : - ${csudo} rm -f ${inc_link_dir}/taosudf.h || : + # Remove link + ${csudo}rm -f ${inc_link_dir}/taos.h || : + ${csudo}rm -f ${inc_link_dir}/taosdef.h || : + ${csudo}rm -f ${inc_link_dir}/taoserror.h || : } function clean_config() { - # Remove link - ${csudo} rm -f ${cfg_link_dir}/* || : + # Remove link + ${csudo}rm -f ${cfg_link_dir}/* || : } function clean_log() { - # Remove link - ${csudo} rm -rf ${log_link_dir} || : + # Remove link + ${csudo}rm -rf ${log_link_dir} || : } function clean_service_on_systemd() { - taosd_service_config="${service_config_dir}/${taos_service_name}.service" - if systemctl is-active --quiet ${taos_service_name}; then - echo "TDengine taosd is running, stopping it..." - ${csudo} systemctl stop ${taos_service_name} &> /dev/null || echo &> /dev/null + taosd_service_config="${service_config_dir}/${taos_service_name}.service" + if systemctl is-active --quiet ${taos_service_name}; then + echo "${productName} ${serverName} is running, stopping it..." + ${csudo}systemctl stop ${taos_service_name} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${taos_service_name} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${taosd_service_config} + + taosadapter_service_config="${service_config_dir}/taosadapter.service" + if systemctl is-active --quiet ${taosadapter_service_name}; then + echo "${productName} taosAdapter is running, stopping it..." + ${csudo}systemctl stop ${taosadapter_service_name} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${taosadapter_service_name} &>/dev/null || echo &>/dev/null + [ -f ${taosadapter_service_config} ] && ${csudo}rm -f ${taosadapter_service_config} + + tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" + if systemctl is-active --quiet ${tarbitrator_service_name}; then + echo "${productName} tarbitrator is running, stopping it..." + ${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${tarbitratord_service_config} + + if [ "$verMode" == "cluster" ]; then + nginx_service_config="${service_config_dir}/${nginx_service_name}.service" + if [ -d ${install_nginxd_dir} ]; then + if systemctl is-active --quiet ${nginx_service_name}; then + echo "Nginx for ${productName} is running, stopping it..." + ${csudo}systemctl stop ${nginx_service_name} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${nginx_service_name} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${nginx_service_config} fi - ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null - ${csudo} rm -f ${taosd_service_config} + fi } function clean_service_on_sysvinit() { - echo " " + if pidof ${serverName} &>/dev/null; then + echo "${productName} ${serverName} is running, stopping it..." + ${csudo}service ${serverName} stop || : + fi + + if pidof tarbitrator &>/dev/null; then + echo "${productName} tarbitrator is running, stopping it..." + ${csudo}service tarbitratord stop || : + fi + + if ((${initd_mod} == 1)); then + if [ -e ${service_config_dir}/${serverName} ]; then + ${csudo}chkconfig --del ${serverName} || : + fi + if [ -e ${service_config_dir}/tarbitratord ]; then + ${csudo}chkconfig --del tarbitratord || : + fi + elif ((${initd_mod} == 2)); then + if [ -e ${service_config_dir}/${serverName} ]; then + ${csudo}insserv -r ${serverName} || : + fi + if [ -e ${service_config_dir}/tarbitratord ]; then + ${csudo}insserv -r tarbitratord || : + fi + elif ((${initd_mod} == 3)); then + if [ -e ${service_config_dir}/${serverName} ]; then + ${csudo}update-rc.d -f ${serverName} remove || : + fi + if [ -e ${service_config_dir}/tarbitratord ]; then + ${csudo}update-rc.d -f tarbitratord remove || : + fi + fi + + ${csudo}rm -f ${service_config_dir}/${serverName} || : + ${csudo}rm -f ${service_config_dir}/tarbitratord || : + + if $(which init &>/dev/null); then + ${csudo}init q || : + fi } function clean_service() { - if ((${service_mod}==0)); then - clean_service_on_systemd - elif ((${service_mod}==1)); then - clean_service_on_sysvinit - else - # must manual stop taosd - kill_taosd - fi + if ((${service_mod} == 0)); then + clean_service_on_systemd + elif ((${service_mod} == 1)); then + clean_service_on_sysvinit + else + kill_taosadapter + kill_taosd + kill_tarbitrator + fi } # Stop service and disable booting start. clean_service # Remove binary file and links clean_bin +# Remove links of local bin +clean_local_bin # Remove header file. clean_header # Remove lib file @@ -135,15 +230,26 @@ clean_log # Remove link configuration file clean_config # Remove data link directory -${csudo} rm -rf ${data_link_dir} || : - -${csudo} rm -rf ${install_main_dir} +${csudo}rm -rf ${data_link_dir} || : +${csudo}rm -rf ${install_main_dir} +${csudo}rm -rf ${install_nginxd_dir} if [[ -e /etc/os-release ]]; then osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release) else osinfo="" fi -echo -e "${GREEN}TDengine is removed successfully!${NC}" +if echo $osinfo | grep -qwi "ubuntu"; then + # echo "this is ubuntu system" + ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : +elif echo $osinfo | grep -qwi "debian"; then + # echo "this is debian system" + ${csudo}dpkg --force-all -P tdengine >/dev/null 2>&1 || : +elif echo $osinfo | grep -qwi "centos"; then + # echo "this is centos system" + ${csudo}rpm -e --noscripts tdengine >/dev/null 2>&1 || : +fi + +echo -e "${GREEN}${productName} is removed successfully!${NC}" echo diff --git a/packaging/tools/remove_arbi.sh b/packaging/tools/remove_arbi.sh deleted file mode 100755 index c95c579d30..0000000000 --- a/packaging/tools/remove_arbi.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -# -# Script to stop the service and uninstall TDengine's arbitrator - -set -e -#set -x - -verMode=edge - -RED='\033[0;31m' -GREEN='\033[1;32m' -NC='\033[0m' - -#install main path -install_main_dir="/usr/local/tarbitrator" -bin_link_dir="/usr/bin" -#inc_link_dir="/usr/include" - -service_config_dir="/etc/systemd/system" -tarbitrator_service_name="tarbitratord" -csudo="" -if command -v sudo > /dev/null; then - csudo="sudo " -fi - -initd_mod=0 -service_mod=2 -if pidof systemd &> /dev/null; then - service_mod=0 -elif $(which service &> /dev/null); then - service_mod=1 - service_config_dir="/etc/init.d" - if $(which chkconfig &> /dev/null); then - initd_mod=1 - elif $(which insserv &> /dev/null); then - initd_mod=2 - elif $(which update-rc.d &> /dev/null); then - initd_mod=3 - else - service_mod=2 - fi -else - service_mod=2 -fi - -function kill_tarbitrator() { - pid=$(ps -ef | grep "tarbitrator" | grep -v "grep" | awk '{print $2}') - if [ -n "$pid" ]; then - ${csudo}kill -9 $pid || : - fi -} -function clean_bin() { - # Remove link - ${csudo}rm -f ${bin_link_dir}/tarbitrator || : -} - -function clean_header() { - # Remove link - ${csudo}rm -f ${inc_link_dir}/taos.h || : - ${csudo}rm -f ${inc_link_dir}/taosdef.h || : - ${csudo}rm -f ${inc_link_dir}/taoserror.h || : - ${csudo}rm -f ${inc_link_dir}/taosudf.h || : - -} - -function clean_log() { - # Remove link - ${csudo}rm -rf /arbitrator.log || : -} - -function clean_service_on_systemd() { - tarbitratord_service_config="${service_config_dir}/${tarbitrator_service_name}.service" - - if systemctl is-active --quiet ${tarbitrator_service_name}; then - echo "TDengine tarbitrator is running, stopping it..." - ${csudo}systemctl stop ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null - fi - ${csudo}systemctl disable ${tarbitrator_service_name} &> /dev/null || echo &> /dev/null - - ${csudo}rm -f ${tarbitratord_service_config} -} - -function clean_service_on_sysvinit() { - if pidof tarbitrator &> /dev/null; then - echo "TDengine's tarbitrator is running, stopping it..." - ${csudo}service tarbitratord stop || : - fi - - if ((${initd_mod}==1)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}chkconfig --del tarbitratord || : - fi - elif ((${initd_mod}==2)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}insserv -r tarbitratord || : - fi - elif ((${initd_mod}==3)); then - if [ -e ${service_config_dir}/tarbitratord ]; then - ${csudo}update-rc.d -f tarbitratord remove || : - fi - fi - - ${csudo}rm -f ${service_config_dir}/tarbitratord || : - - if $(which init &> /dev/null); then - ${csudo}init q || : - fi -} - -function clean_service() { - if ((${service_mod}==0)); then - clean_service_on_systemd - elif ((${service_mod}==1)); then - clean_service_on_sysvinit - else - # must manual stop - kill_tarbitrator - fi -} - -# Stop service and disable booting start. -clean_service -# Remove binary file and links -clean_bin -# Remove header file. -##clean_header -# Remove log file -clean_log - -${csudo}rm -rf ${install_main_dir} - -echo -e "${GREEN}TDengine's arbitrator is removed successfully!${NC}" diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index d150d68c8d..a234311569 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -89,8 +89,10 @@ void closeTransporter(SAppInstInfo *pAppInfo) { } static bool clientRpcRfp(int32_t code, tmsg_t msgType) { - if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { + if (NEED_REDIRECT_ERROR(code)) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { + return false; + } return true; } else { return false; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 2de630e181..48fa2d7938 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -262,7 +262,7 @@ static int32_t hbQueryHbRspHandle(SAppHbMgr *pAppHbMgr, SClientHbRsp *pRsp) { return TSDB_CODE_SUCCESS; } -static int32_t hbAsyncCallBack(void *param, const SDataBuf *pMsg, int32_t code) { +static int32_t hbAsyncCallBack(void *param, SDataBuf *pMsg, int32_t code) { static int32_t emptyRspNum = 0; if (code != 0) { taosMemoryFreeClear(param); diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 09fb73cfba..b6009ebbda 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -769,7 +769,8 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) { code = handleSubmitExecRes(pRequest, pRes->res, pCatalog, &epset); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { code = handleQueryExecRes(pRequest, pRes->res, pCatalog, &epset); break; } @@ -1255,10 +1256,10 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { */ int32_t elapsed = pRequest->metric.rsp - pRequest->metric.start; if (pMsg->code == TSDB_CODE_SUCCESS) { - tscDebug("0x%" PRIx64 " message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self, + tscDebug("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self, TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId); } else { - tscError("0x%" PRIx64 " SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self, + tscError("0x%" PRIx64 " rsp msg:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self, TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed / 1000, pRequest->requestId); } @@ -1268,7 +1269,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { updateTargetEpSet(pSendInfo, pTscObj, pMsg, pEpSet); - SDataBuf buf = {.len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle}; + SDataBuf buf = {.msgType = pMsg->msgType, .len = pMsg->contLen, .pData = NULL, .handle = pMsg->info.handle, .pEpSet = pEpSet}; if (pMsg->contLen > 0) { buf.pData = taosMemoryCalloc(1, pMsg->contLen); @@ -1407,7 +1408,11 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU } SSyncQueryParam* pParam = pRequest->body.param; - + if (NULL == pParam) { + pParam = taosMemoryCalloc(1, sizeof(SSyncQueryParam)); + tsem_init(&pParam->sem, 0, 0); + } + // convert ucs4 to native multi-bytes string pResultInfo->convertUcs4 = convertUcs4; diff --git a/source/client/src/clientMsgHandler.c b/source/client/src/clientMsgHandler.c index e2b558e61f..761eebee42 100644 --- a/source/client/src/clientMsgHandler.c +++ b/source/client/src/clientMsgHandler.c @@ -26,7 +26,7 @@ static void setErrno(SRequestObj* pRequest, int32_t code) { terrno = code; } -int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t genericRspCallback(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; setErrno(pRequest, code); @@ -39,7 +39,7 @@ int32_t genericRspCallback(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processConnectRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processConnectRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { taosMemoryFree(pMsg->pData); @@ -116,7 +116,7 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj* pRequest) { return pMsgSendInfo; } -int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processCreateDbRsp(void* param, SDataBuf* pMsg, int32_t code) { // todo rsp with the vnode id list SRequestObj* pRequest = param; taosMemoryFree(pMsg->pData); @@ -132,7 +132,7 @@ int32_t processCreateDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processUseDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (TSDB_CODE_MND_DB_NOT_EXIST == code) { @@ -211,7 +211,7 @@ int32_t processUseDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return 0; } -int32_t processCreateSTableRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processCreateSTableRsp(void* param, SDataBuf* pMsg, int32_t code) { assert(pMsg != NULL && param != NULL); SRequestObj* pRequest = param; @@ -229,7 +229,7 @@ int32_t processCreateSTableRsp(void* param, const SDataBuf* pMsg, int32_t code) return code; } -int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processDropDbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); @@ -250,7 +250,7 @@ int32_t processDropDbRsp(void* param, const SDataBuf* pMsg, int32_t code) { return code; } -int32_t processAlterStbRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processAlterStbRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); @@ -356,7 +356,7 @@ static int32_t buildShowVariablesRsp(SArray* pVars, SRetrieveTableRsp** pRsp) { return TSDB_CODE_SUCCESS; } -int32_t processShowVariablesRsp(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t processShowVariablesRsp(void* param, SDataBuf* pMsg, int32_t code) { SRequestObj* pRequest = param; if (code != TSDB_CODE_SUCCESS) { setErrno(pRequest, code); diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 1cb0e2d54b..5039f8bbaf 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -2456,10 +2456,10 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr return NULL; } + int batchs = 0; pTscObj->schemalessType = 1; SSmlMsgBuf msg = {ERROR_MSG_BUF_DEFAULT_SIZE, request->msgBuf}; - int cnt = ceil(((double)numLines) / LINE_BATCH); Params params; params.request = request; tsem_init(¶ms.sem, 0, 0); @@ -2496,7 +2496,16 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr goto end; } - for (int i = 0; i < cnt; ++i) { + if(protocol == TSDB_SML_JSON_PROTOCOL){ + numLines = 1; + }else if(numLines <= 0){ + request->code = TSDB_CODE_SML_INVALID_DATA; + smlBuildInvalidDataMsg(&msg, "line num is invalid", NULL); + goto end; + } + + batchs = ceil(((double)numLines) / LINE_BATCH); + for (int i = 0; i < batchs; ++i) { SRequestObj* req = (SRequestObj*)createRequest(pTscObj, TSDB_SQL_INSERT); if(!req){ request->code = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index efc1e3a082..667f5b1dbc 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -384,7 +384,7 @@ int32_t tmqCommitCb(void* param, const SDataBuf* pMsg, int32_t code) { } #endif -int32_t tmqCommitCb2(void* param, const SDataBuf* pBuf, int32_t code) { +int32_t tmqCommitCb2(void* param, SDataBuf* pBuf, int32_t code) { SMqCommitCbParam2* pParam = (SMqCommitCbParam2*)param; SMqCommitCbParamSet* pParamSet = (SMqCommitCbParamSet*)pParam->params; // push into array @@ -819,7 +819,7 @@ void tmqClearUnhandleMsg(tmq_t* tmq) { } } -int32_t tmqSubscribeCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqSubscribeCb(void* param, SDataBuf* pMsg, int32_t code) { SMqSubscribeCbParam* pParam = (SMqSubscribeCbParam*)param; pParam->rspErr = code; /*tmq_t* tmq = pParam->tmq;*/ @@ -1073,7 +1073,7 @@ int32_t tmqGetSkipLogNum(tmq_message_t* tmq_message) { } #endif -int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { SMqPollCbParam* pParam = (SMqPollCbParam*)param; SMqClientVg* pVg = pParam->pVg; SMqClientTopic* pTopic = pParam->pTopic; @@ -1330,7 +1330,7 @@ bool tmqUpdateEp(tmq_t* tmq, int32_t epoch, SMqAskEpRsp* pRsp) { } #endif -int32_t tmqAskEpCb(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t tmqAskEpCb(void* param, SDataBuf* pMsg, int32_t code) { SMqAskEpCbParam* pParam = (SMqAskEpCbParam*)param; tmq_t* tmq = pParam->tmq; int8_t async = pParam->async; diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 7b142e3053..18c7942491 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -892,7 +892,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) { int64_t p0 = taosGetTimestampUs(); __compar_fn_t fn = getKeyComparFunc(pColInfoData->info.type, pOrder->order); - qsort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); + taosSort(pColInfoData->pData, pDataBlock->info.rows, pColInfoData->info.bytes, fn); int64_t p1 = taosGetTimestampUs(); uDebug("blockDataSort easy cost:%" PRId64 ", rows:%d\n", p1 - p0, pDataBlock->info.rows); @@ -1218,7 +1218,7 @@ int32_t assignOneDataBlock(SSDataBlock* dst, const SSDataBlock* src) { for (int32_t i = 0; i < numOfCols; ++i) { SColumnInfoData* pDst = taosArrayGet(dst->pDataBlock, i); SColumnInfoData* pSrc = taosArrayGet(src->pDataBlock, i); - if (pSrc->pData == NULL) { + if (pSrc->pData == NULL && (!IS_VAR_DATA_TYPE(pSrc->info.type))) { continue; } diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 7c1b31b6e4..83ae442ae7 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -931,9 +931,9 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { // sort if (isJson) { - qsort(pArray->pData, nTag, sizeof(STagVal), tTagValJsonCmprFn); + taosSort(pArray->pData, nTag, sizeof(STagVal), tTagValJsonCmprFn); } else { - qsort(pArray->pData, nTag, sizeof(STagVal), tTagValCmprFn); + taosSort(pArray->pData, nTag, sizeof(STagVal), tTagValCmprFn); } // get size diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 80402439fc..3f6091ff7b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4309,6 +4309,7 @@ int32_t tSerializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp *pR if (tEncodeU64(&encoder, status->queryId) < 0) return -1; if (tEncodeU64(&encoder, status->taskId) < 0) return -1; if (tEncodeI64(&encoder, status->refId) < 0) return -1; + if (tEncodeI32(&encoder, status->execId) < 0) return -1; if (tEncodeI8(&encoder, status->status) < 0) return -1; } } else { @@ -4339,6 +4340,7 @@ int32_t tDeserializeSSchedulerHbRsp(void *buf, int32_t bufLen, SSchedulerHbRsp * if (tDecodeU64(&decoder, &status.queryId) < 0) return -1; if (tDecodeU64(&decoder, &status.taskId) < 0) return -1; if (tDecodeI64(&decoder, &status.refId) < 0) return -1; + if (tDecodeI32(&decoder, &status.execId) < 0) return -1; if (tDecodeI8(&decoder, &status.status) < 0) return -1; taosArrayPush(pRsp->taskStatus, &status); } @@ -4641,6 +4643,7 @@ int32_t tSerializeSCMCreateStreamReq(void *buf, int32_t bufLen, const SCMCreateS if (tEncodeI8(&encoder, pReq->triggerType) < 0) return -1; if (tEncodeI64(&encoder, pReq->maxDelay) < 0) return -1; if (tEncodeI64(&encoder, pReq->watermark) < 0) return -1; + if (tEncodeI8(&encoder, pReq->igExpired) < 0) return -1; if (sqlLen > 0 && tEncodeCStr(&encoder, pReq->sql) < 0) return -1; if (astLen > 0 && tEncodeCStr(&encoder, pReq->ast) < 0) return -1; @@ -4668,6 +4671,7 @@ int32_t tDeserializeSCMCreateStreamReq(void *buf, int32_t bufLen, SCMCreateStrea if (tDecodeI8(&decoder, &pReq->triggerType) < 0) return -1; if (tDecodeI64(&decoder, &pReq->maxDelay) < 0) return -1; if (tDecodeI64(&decoder, &pReq->watermark) < 0) return -1; + if (tDecodeI8(&decoder, &pReq->igExpired) < 0) return -1; if (sqlLen > 0) { pReq->sql = taosMemoryCalloc(1, sqlLen + 1); @@ -5502,4 +5506,3 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } return 0; } - diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 3bf6d9b04f..59d68b2110 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -209,10 +209,11 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_SHOW_VARIABLES, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_SERVER_VERSION, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, mmPutMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_STB_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -220,7 +221,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_SMA_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_CHANGE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_VG_DELETE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, mmPutMsgToFetchQueue, 1) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DEPLOY_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_CONFIG_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c index 864f5b485a..1f22eefddf 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmHandle.c @@ -107,14 +107,15 @@ SArray *qmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MON_QM_INFO, qmPutNodeMsgToMonitorQueue, 0) == NULL) goto _OVER; // Requests handled by VNODE - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, qmPutNodeMsgToQueryQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH_RSP, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, qmPutNodeMsgToFetchQueue, 1) == NULL) goto _OVER; code = 0; _OVER: diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 00d83f0ad4..5bc9582527 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -324,16 +324,17 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MON_VM_LOAD, vmPutMsgToMonitorQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_SUBMIT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_MERGE_QUERY, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_CONTINUE, vmPutMsgToQueryQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_FETCH, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_UPDATE_TAG_VAL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_CFG, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CREATE_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TTL_TABLE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_ALTER_STB, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; @@ -349,7 +350,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_MQ_COMMIT_OFFSET, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_CONSUME, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_DELETE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; - if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_SCH_QUERY_HEARTBEAT, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_STREAM_TRIGGER, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_STREAM_TASK_DROP, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c index 1c5d74bb94..35d478177a 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c +++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c @@ -41,6 +41,7 @@ static inline void dmBuildMnodeRedirectRsp(SDnode *pDnode, SRpcMsg *pMsg) { } static inline void dmSendRedirectRsp(SRpcMsg *pMsg, const SEpSet *pNewEpSet) { + pMsg->info.hasEpSet = 1; SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info}; int32_t contLen = tSerializeSEpSet(NULL, 0, pNewEpSet); @@ -86,7 +87,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) { return; case TDMT_MND_SYSTABLE_RETRIEVE_RSP: case TDMT_DND_SYSTABLE_RETRIEVE_RSP: - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: qWorkerProcessFetchRsp(NULL, NULL, pRpc, 0); return; case TDMT_MND_STATUS_RSP: @@ -250,7 +251,10 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) { static bool rpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { + code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_BROKEN_LINK) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { + return false; + } return true; } else { return false; diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index fa9c8606bb..c39c9847a9 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -58,7 +58,7 @@ static void *mndBuildTimerMsg(int32_t *pContLen) { static void mndPullupTrans(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_TRANS_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); @@ -67,14 +67,14 @@ static void mndPullupTrans(SMnode *pMnode) { static void mndTtlTimer(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); SRpcMsg rpcMsg = {.msgType = TDMT_MND_TTL_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg); } static void mndCalMqRebalance(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_MQ_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg); @@ -83,7 +83,7 @@ static void mndCalMqRebalance(SMnode *pMnode) { static void mndPullupTelem(SMnode *pMnode) { int32_t contLen = 0; - void *pReq = mndBuildTimerMsg(&contLen); + void * pReq = mndBuildTimerMsg(&contLen); if (pReq != NULL) { SRpcMsg rpcMsg = {.msgType = TDMT_MND_TELEM_TIMER, .pCont = pReq, .contLen = contLen}; tmsgPutToQueue(&pMnode->msgCb, READ_QUEUE, &rpcMsg); @@ -395,7 +395,7 @@ void mndStop(SMnode *pMnode) { } int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { - SMnode *pMnode = pMsg->info.node; + SMnode * pMnode = pMsg->info.node; SSyncMgmt *pMgmt = &pMnode->syncMgmt; int32_t code = 0; @@ -413,7 +413,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { } do { - char *syncNodeStr = sync2SimpleStr(pMgmt->sync); + char * syncNodeStr = sync2SimpleStr(pMgmt->sync); static int64_t mndTick = 0; if (++mndTick % 10 == 1) { mTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); @@ -527,9 +527,9 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { if (!IsReq(pMsg)) return 0; - if (pMsg->msgType == TDMT_VND_QUERY || pMsg->msgType == TDMT_VND_QUERY_CONTINUE || - pMsg->msgType == TDMT_VND_QUERY_HEARTBEAT || pMsg->msgType == TDMT_VND_FETCH || - pMsg->msgType == TDMT_VND_DROP_TASK) { + if (pMsg->msgType == TDMT_SCH_QUERY || pMsg->msgType == TDMT_SCH_MERGE_QUERY || + pMsg->msgType == TDMT_SCH_QUERY_CONTINUE || pMsg->msgType == TDMT_SCH_QUERY_HEARTBEAT || + pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_SCH_DROP_TASK) { return 0; } if (mndAcquireRpcRef(pMsg->info.node) == 0) return 0; @@ -552,6 +552,7 @@ static int32_t mndCheckMnodeState(SRpcMsg *pMsg) { int32_t contLen = tSerializeSEpSet(NULL, 0, &epSet); pMsg->info.rsp = rpcMallocCont(contLen); + pMsg->info.hasEpSet = 1; if (pMsg->info.rsp != NULL) { tSerializeSEpSet(pMsg->info.rsp, contLen, &epSet); pMsg->info.rspLen = contLen; @@ -578,7 +579,7 @@ static int32_t mndCheckMsgContent(SRpcMsg *pMsg) { } int32_t mndProcessRpcMsg(SRpcMsg *pMsg) { - SMnode *pMnode = pMsg->info.node; + SMnode * pMnode = pMsg->info.node; const STraceId *trace = &pMsg->info.traceId; MndMsgFp fp = pMnode->msgFp[TMSG_INDEX(pMsg->msgType)]; @@ -631,7 +632,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr SMonStbInfo *pStbInfo, SMonGrantInfo *pGrantInfo) { if (mndAcquireRpcRef(pMnode) != 0) return -1; - SSdb *pSdb = pMnode->pSdb; + SSdb * pSdb = pMnode->pSdb; int64_t ms = taosGetTimestampMs(); pClusterInfo->dnodes = taosArrayInit(sdbGetSize(pSdb, SDB_DNODE), sizeof(SMonDnodeDesc)); @@ -712,7 +713,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr pGrantInfo->timeseries_used += pVgroup->numOfTimeSeries; tstrncpy(desc.status, "unsynced", sizeof(desc.status)); for (int32_t i = 0; i < pVgroup->replica; ++i) { - SVnodeGid *pVgid = &pVgroup->vnodeGid[i]; + SVnodeGid * pVgid = &pVgroup->vnodeGid[i]; SMonVnodeDesc *pVnDesc = &desc.vnodes[i]; pVnDesc->dnode_id = pVgid->dnodeId; tstrncpy(pVnDesc->vnode_role, syncStr(pVgid->role), sizeof(pVnDesc->vnode_role)); diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index 671152f9c6..aec99fa3b7 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -19,13 +19,13 @@ #include "qworker.h" int32_t mndPreProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) return 0; + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) return 0; SMnode *pMnode = pMsg->info.node; return qWorkerPreprocessQueryMsg(pMnode->pQuery, pMsg); } void mndPostProcessQueryMsg(SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) return; + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) return; SMnode *pMnode = pMsg->info.node; qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg); } @@ -37,19 +37,20 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { mTrace("msg:%p, in query queue is processing", pMsg); switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: code = qWorkerProcessQueryMsg(&handle, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: code = qWorkerProcessCQueryMsg(&handle, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: code = qWorkerProcessFetchMsg(pMnode, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: code = qWorkerProcessDropMsg(pMnode, pMnode->pQuery, pMsg, 0); break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pMnode, pMnode->pQuery, pMsg, 0); break; default: @@ -67,11 +68,12 @@ int32_t mndInitQuery(SMnode *pMnode) { return -1; } - mndSetMsgHandle(pMnode, TDMT_VND_QUERY, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_QUERY_CONTINUE, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_FETCH, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_DROP_TASK, mndProcessQueryMsg); - mndSetMsgHandle(pMnode, TDMT_VND_QUERY_HEARTBEAT, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_MERGE_QUERY, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_CONTINUE, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_FETCH, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_HEARTBEAT, mndProcessQueryMsg); return 0; } diff --git a/source/dnode/qnode/src/qnode.c b/source/dnode/qnode/src/qnode.c index ebaf73a952..cfc63b083d 100644 --- a/source/dnode/qnode/src/qnode.c +++ b/source/dnode/qnode/src/qnode.c @@ -65,7 +65,7 @@ int32_t qndGetLoad(SQnode *pQnode, SQnodeLoad *pLoad) { } int32_t qndPreprocessQueryMsg(SQnode *pQnode, SRpcMsg * pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) { return 0; } @@ -78,28 +78,29 @@ int32_t qndProcessQueryMsg(SQnode *pQnode, int64_t ts, SRpcMsg *pMsg) { qTrace("message in qnode queue is processing"); switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: code = qWorkerProcessQueryMsg(&handle, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: code = qWorkerProcessCQueryMsg(&handle, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: code = qWorkerProcessFetchMsg(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: code = qWorkerProcessFetchRsp(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: code = qWorkerProcessCancelMsg(pQnode, pQnode->pQuery, pMsg, ts); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: code = qWorkerProcessDropMsg(pQnode, pQnode->pQuery, pMsg, ts); break; case TDMT_VND_CONSUME: // code = tqProcessConsumeReq(pQnode->pTq, pMsg); // break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: code = qWorkerProcessHbMsg(pQnode, pQnode->pQuery, pMsg, ts); break; default: diff --git a/source/dnode/vnode/src/inc/sma.h b/source/dnode/vnode/src/inc/sma.h index 3e15fd9c57..b455d779c1 100644 --- a/source/dnode/vnode/src/inc/sma.h +++ b/source/dnode/vnode/src/inc/sma.h @@ -48,7 +48,6 @@ struct SSmaEnv { typedef struct { int32_t smaRef; - int32_t refId; } SSmaMgmt; #define SMA_ENV_LOCK(env) ((env)->lock) @@ -63,12 +62,12 @@ struct STSmaStat { struct SRSmaStat { SSma *pSma; - int64_t refId; - void *tmrHandle; - tmr_h tmrId; - int32_t tmrSeconds; - int8_t triggerStat; - int8_t runningStat; + int64_t refId; // shared by persistence/fetch tasks + void *tmrHandle; // for persistence task + tmr_h tmrId; // for persistence task + int32_t tmrSeconds; // for persistence task + int8_t triggerStat; // for persistence task + int8_t runningStat; // for persistence task SHashObj *rsmaInfoHash; // key: stbUid, value: SRSmaInfo; }; diff --git a/source/dnode/vnode/src/sma/smaEnv.c b/source/dnode/vnode/src/sma/smaEnv.c index e70e79fb6f..120d6612a2 100644 --- a/source/dnode/vnode/src/sma/smaEnv.c +++ b/source/dnode/vnode/src/sma/smaEnv.c @@ -135,7 +135,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS // init smaMgmt smaMgmt.smaRef = taosOpenRef(SMA_MGMT_REF_NUM, tdDestroyRSmaStat); - if (smaMgmt.refId < 0) { + if (smaMgmt.smaRef < 0) { smaError("init smaRef failed, num:%d", SMA_MGMT_REF_NUM); terrno = TSDB_CODE_OUT_OF_MEMORY; return TSDB_CODE_FAILED; diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index 4105c0164f..41af641e9e 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -50,6 +50,7 @@ static int32_t tdRSmaRestoreTSDataReload(SSma *pSma); struct SRSmaInfoItem { SRSmaInfo *pRsmaInfo; + int64_t refId; void *taskInfo; // qTaskInfo_t tmr_h tmrId; int8_t level; @@ -60,11 +61,14 @@ struct SRSmaInfoItem { struct SRSmaInfo { STSchema *pTSchema; - SSma *pSma; + SRSmaStat *pStat; int64_t suid; SRSmaInfoItem items[TSDB_RETENTION_L2]; }; +#define RSMA_INFO_SMA(r) ((r)->pStat->pSma) +#define RSMA_INFO_STAT(r) ((r)->pStat) + struct SRSmaQTaskInfoItem { int32_t len; int8_t type; @@ -107,22 +111,21 @@ static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle, int32_t vgId, void *tdFreeRSmaInfo(SRSmaInfo *pInfo) { if (pInfo) { + SSma *pSma = RSMA_INFO_SMA(pInfo); for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { SRSmaInfoItem *pItem = &pInfo->items[i]; if (pItem->taskInfo) { - smaDebug("vgId:%d, stb %" PRIi64 " stop fetch-timer %p level %d", SMA_VID(pInfo->pSma), pInfo->suid, - pItem->tmrId, i + 1); + smaDebug("vgId:%d, stb %" PRIi64 " stop fetch-timer %p level %d", SMA_VID(pSma), pInfo->suid, pItem->tmrId, + i + 1); taosTmrStopA(&pItem->tmrId); - tdFreeTaskHandle(&pItem->taskInfo, SMA_VID(pInfo->pSma), i + 1); + tdFreeTaskHandle(&pItem->taskInfo, SMA_VID(pSma), i + 1); } else { - smaDebug("vgId:%d, stb %" PRIi64 " no need to destroy rsma info level %d since empty taskInfo", - SMA_VID(pInfo->pSma), pInfo->suid, i + 1); + smaDebug("vgId:%d, stb %" PRIi64 " no need to destroy rsma info level %d since empty taskInfo", SMA_VID(pSma), + pInfo->suid, i + 1); } } taosMemoryFree(pInfo->pTSchema); taosMemoryFree(pInfo); - } else { - smaDebug("vgId:%d, stb %" PRIi64 " no need to destroy rsma info since empty", SMA_VID(pInfo->pSma), pInfo->suid); } return NULL; @@ -255,6 +258,7 @@ static int32_t tdSetRSmaInfoItemParams(SSma *pSma, SRSmaParam *param, SRSmaInfo if (param->qmsg[idx]) { SRSmaInfoItem *pItem = &(pRSmaInfo->items[idx]); + pItem->refId = RSMA_REF_ID(pRSmaInfo->pStat); pItem->pRsmaInfo = pRSmaInfo; pItem->taskInfo = qCreateStreamExecTaskInfo(param->qmsg[idx], pReadHandle); if (!pItem->taskInfo) { @@ -340,7 +344,7 @@ int32_t tdProcessRSmaCreateImpl(SSma *pSma, SRSmaParam *param, int64_t suid, con goto _err; } pRSmaInfo->pTSchema = pTSchema; - pRSmaInfo->pSma = pSma; + pRSmaInfo->pStat = pStat; pRSmaInfo->suid = suid; if (tdSetRSmaInfoItemParams(pSma, param, pRSmaInfo, &handle, 0) < 0) { @@ -522,7 +526,7 @@ static void tdDestroySDataBlockArray(SArray *pArray) { static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType) { SArray *pResult = NULL; SRSmaInfo *pRSmaInfo = pItem->pRsmaInfo; - SSma *pSma = pRSmaInfo->pSma; + SSma *pSma = RSMA_INFO_SMA(pRSmaInfo); while (1) { SSDataBlock *output = NULL; @@ -585,21 +589,29 @@ _err: */ static void tdRSmaFetchTrigger(void *param, void *tmrId) { SRSmaInfoItem *pItem = param; - SSma *pSma = pItem->pRsmaInfo->pSma; - SRSmaStat *pStat = (SRSmaStat *)SMA_ENV_STAT((SSmaEnv *)pSma->pRSmaEnv); + SSma *pSma = NULL; + SRSmaStat *pStat = (SRSmaStat *)taosAcquireRef(smaMgmt.smaRef, pItem->refId); + if (!pStat) { + smaDebug("rsma fetch task not start since already destroyed"); + return; + } + pSma = RSMA_INFO_SMA(pItem->pRsmaInfo); + + // if rsma trigger stat in cancelled or finished, not start fetch task anymore int8_t rsmaTriggerStat = atomic_load_8(RSMA_TRIGGER_STAT(pStat)); if (rsmaTriggerStat == TASK_TRIGGER_STAT_CANCELLED || rsmaTriggerStat == TASK_TRIGGER_STAT_FINISHED) { - smaDebug("vgId:%d, level %" PRIi8 " not fetch since stat is cancelled for table suid:%" PRIi64, SMA_VID(pSma), - pItem->level, pItem->pRsmaInfo->suid); + taosReleaseRef(smaMgmt.smaRef, pItem->refId); + smaDebug("vgId:%d, not fetch rsma level %" PRIi8 " data for table:%" PRIi64 " since stat is cancelled", + SMA_VID(pSma), pItem->level, pItem->pRsmaInfo->suid); return; } int8_t fetchTriggerStat = atomic_val_compare_exchange_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE, TASK_TRIGGER_STAT_INACTIVE); if (fetchTriggerStat == TASK_TRIGGER_STAT_ACTIVE) { - smaDebug("vgId:%d, level %" PRIi8 " stat is active for table suid:%" PRIi64, SMA_VID(pSma), pItem->level, - pItem->pRsmaInfo->suid); + smaDebug("vgId:%d, fetch rsma level %" PRIi8 " data for table:%" PRIi64 " since stat is active", SMA_VID(pSma), + pItem->level, pItem->pRsmaInfo->suid); tdRefSmaStat(pSma, (SSmaStat *)pStat); @@ -610,9 +622,11 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { tdUnRefSmaStat(pSma, (SSmaStat *)pStat); } else { - smaDebug("vgId:%d, level %" PRIi8 " stat is inactive for table suid:%" PRIi64, SMA_VID(pSma), pItem->level, - pItem->pRsmaInfo->suid); + smaDebug("vgId:%d, not fetch rsma level %" PRIi8 " data for table:%" PRIi64 " since stat is inactive", + SMA_VID(pSma), pItem->level, pItem->pRsmaInfo->suid); } +_end: + taosReleaseRef(smaMgmt.smaRef, pItem->refId); } static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType, SRSmaInfoItem *pItem, tb_uid_t suid, @@ -632,7 +646,6 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType tdFetchAndSubmitRSmaResult(pItem, STREAM_INPUT__DATA_SUBMIT); atomic_store_8(&pItem->triggerStat, TASK_TRIGGER_STAT_ACTIVE); - smaDebug("vgId:%d, process rsma insert", SMA_VID(pSma)); SSmaEnv *pEnv = SMA_RSMA_ENV(pSma); SRSmaStat *pStat = SMA_RSMA_STAT(pEnv->pStat); @@ -1036,7 +1049,7 @@ static void *tdRSmaPersistExec(void *param) { for (int32_t i = 0; i < TSDB_RETENTION_L2; ++i) { qTaskInfo_t taskInfo = pRSmaInfo->items[i].taskInfo; if (!taskInfo) { - smaDebug("vgId:%d, table %" PRIi64 " level %d qTaskInfo is NULL", vid, pRSmaInfo->suid, i + 1); + smaDebug("vgId:%d, rsma, table %" PRIi64 " level %d qTaskInfo is NULL", vid, pRSmaInfo->suid, i + 1); continue; } @@ -1044,27 +1057,20 @@ static void *tdRSmaPersistExec(void *param) { int32_t len = 0; int8_t type = (int8_t)(i + 1); if (qSerializeTaskStatus(taskInfo, &pOutput, &len) < 0) { - smaError("vgId:%d, table %" PRIi64 " level %d serialize rsma task failed since %s", vid, pRSmaInfo->suid, i + 1, - terrstr(terrno)); + smaError("vgId:%d, rsma, table %" PRIi64 " level %d serialize qTaskInfo failed since %s", vid, pRSmaInfo->suid, + i + 1, terrstr(terrno)); goto _err; } if (!pOutput || len <= 0) { - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success but no output(len %d), not persist", + smaDebug("vgId:%d, rsma, table %" PRIi64 + " level %d serialize qTaskInfo success but no output(len %d), not persist", vid, pRSmaInfo->suid, i + 1, len); taosMemoryFreeClear(pOutput); continue; } - smaDebug("vgId:%d, table %" PRIi64 " level %d serialize rsma task success with len %d, need persist", vid, + smaDebug("vgId:%d, rsma, table %" PRIi64 " level %d serialize qTaskInfo success with len %d, need persist", vid, pRSmaInfo->suid, i + 1, len); -#if 0 - if (qDeserializeTaskStatus(taskInfo, pOutput, len) < 0) { - smaError("vgId:%d, table %" PRIi64 "level %d deserialize rsma task failed since %s", vid, pRSmaInfo->suid, - i + 1, terrstr(terrno)); - } else { - smaDebug("vgId:%d, table %" PRIi64 " level %d deserialize rsma task success", vid, pRSmaInfo->suid, i + 1); - } -#endif if (!isFileCreated) { char qTaskInfoFName[TSDB_FILENAME_LEN]; @@ -1084,11 +1090,11 @@ static void *tdRSmaPersistExec(void *param) { ASSERT(headLen <= RSMA_QTASKINFO_HEAD_LEN); tdAppendTFile(&tFile, (void *)&tmpBuf, headLen, &toffset); - smaDebug("vgId:%d, table %" PRIi64 " level %d head part(len:%d) appended to offset:%" PRIi64, vid, + smaDebug("vgId:%d, rsma, table %" PRIi64 " level %d head part(len:%d) appended to offset:%" PRIi64, vid, pRSmaInfo->suid, i + 1, headLen, toffset); tdAppendTFile(&tFile, pOutput, len, &toffset); - smaDebug("vgId:%d, table %" PRIi64 " level %d body part len:%d appended to offset:%" PRIi64, vid, pRSmaInfo->suid, - i + 1, len, toffset); + smaDebug("vgId:%d, rsma, table %" PRIi64 " level %d body part len:%d appended to offset:%" PRIi64, vid, + pRSmaInfo->suid, i + 1, len, toffset); taosMemoryFree(pOutput); } @@ -1098,13 +1104,13 @@ static void *tdRSmaPersistExec(void *param) { _normal: if (isFileCreated) { if (tdUpdateTFileHeader(&tFile) < 0) { - smaError("vgId:%d, failed to update tfile %s header since %s", vid, TD_TFILE_FULL_NAME(&tFile), + smaError("vgId:%d, rsma, failed to update tfile %s header since %s", vid, TD_TFILE_FULL_NAME(&tFile), tstrerror(terrno)); tdCloseTFile(&tFile); tdRemoveTFile(&tFile); goto _err; } else { - smaDebug("vgId:%d, succeed to update tfile %s header", vid, TD_TFILE_FULL_NAME(&tFile)); + smaDebug("vgId:%d, rsma, succeed to update tfile %s header", vid, TD_TFILE_FULL_NAME(&tFile)); } tdCloseTFile(&tFile); @@ -1114,10 +1120,10 @@ _normal: char *pos = strstr(newFName, tdQTaskInfoFname[TD_QTASK_TMP_F]); strncpy(pos, tdQTaskInfoFname[TD_QTASK_TMP_F], TSDB_FILENAME_LEN - POINTER_DISTANCE(pos, newFName)); if (taosRenameFile(TD_TFILE_FULL_NAME(&tFile), newFName) != 0) { - smaError("vgId:%d, failed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); + smaError("vgId:%d, rsma, failed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); goto _err; } else { - smaDebug("vgId:%d, succeed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); + smaDebug("vgId:%d, rsma, succeed to rename %s to %s", vid, TD_TFILE_FULL_NAME(&tFile), newFName); } } goto _end; @@ -1129,13 +1135,13 @@ _end: if (TASK_TRIGGER_STAT_INACTIVE == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_INACTIVE, TASK_TRIGGER_STAT_ACTIVE)) { - smaDebug("vgId:%d, persist task is active again", vid); + smaDebug("vgId:%d, rsma persist task is active again", vid); } else if (TASK_TRIGGER_STAT_CANCELLED == atomic_val_compare_exchange_8(RSMA_TRIGGER_STAT(pRSmaStat), TASK_TRIGGER_STAT_CANCELLED, TASK_TRIGGER_STAT_FINISHED)) { - smaDebug("vgId:%d, persist task is cancelled", vid); + smaDebug("vgId:%d, rsma persist task is cancelled", vid); } else { - smaWarn("vgId:%d, persist task in abnormal stat %" PRIi8, vid, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); + smaWarn("vgId:%d, rsma persist task in abnormal stat %" PRIi8, vid, atomic_load_8(RSMA_TRIGGER_STAT(pRSmaStat))); ASSERT(0); } atomic_store_8(RSMA_RUNNING_STAT(pRSmaStat), 0); @@ -1179,9 +1185,8 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) { */ static void tdRSmaPersistTrigger(void *param, void *tmrId) { SRSmaStat *rsmaStat = param; - int64_t refId = rsmaStat->refId; + SRSmaStat *pRSmaStat = (SRSmaStat *)taosAcquireRef(smaMgmt.smaRef, rsmaStat->refId); - SRSmaStat *pRSmaStat = (SRSmaStat *)taosAcquireRef(smaMgmt.smaRef, refId); if (!pRSmaStat) { smaDebug("rsma persistence task not start since already destroyed"); return; @@ -1221,5 +1226,5 @@ static void tdRSmaPersistTrigger(void *param, void *tmrId) { smaWarn("rsma persistence not start since unknown stat %" PRIi8, tmrStat); } break; } - taosReleaseRef(smaMgmt.smaRef, refId); + taosReleaseRef(smaMgmt.smaRef, rsmaStat->refId); } diff --git a/source/dnode/vnode/src/sma/smaTimeRange.c b/source/dnode/vnode/src/sma/smaTimeRange.c index 2244b91c28..ecd8db8ea9 100644 --- a/source/dnode/vnode/src/sma/smaTimeRange.c +++ b/source/dnode/vnode/src/sma/smaTimeRange.c @@ -113,7 +113,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { if (!pDataBlocks) { terrno = TSDB_CODE_TSMA_INVALID_PTR; smaWarn("vgId:%d, insert tsma data failed since pDataBlocks is NULL", SMA_VID(pSma)); - return terrno; + return TSDB_CODE_FAILED; } if (taosArrayGetSize(pDataBlocks) <= 0) { @@ -127,9 +127,9 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { return TSDB_CODE_FAILED; } - SSmaEnv *pEnv = SMA_TSMA_ENV(pSma); - SSmaStat *pStat = NULL; - STSmaStat *pItem = NULL; + SSmaEnv *pEnv = SMA_TSMA_ENV(pSma); + SSmaStat *pStat = NULL; + STSmaStat *pTsmaStat = NULL; if (!pEnv || !(pStat = SMA_ENV_STAT(pEnv))) { terrno = TSDB_CODE_TSMA_INVALID_STAT; @@ -137,32 +137,43 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { } tdRefSmaStat(pSma, pStat); - pItem = &pStat->tsmaStat; + pTsmaStat = SMA_TSMA_STAT(pStat); - ASSERT(pItem); - - if (!pItem->pTSma) { + if (!pTsmaStat->pTSma) { STSma *pTSma = metaGetSmaInfoByIndex(SMA_META(pSma), indexUid); if (!pTSma) { - terrno = TSDB_CODE_TSMA_NO_INDEX_IN_META; - smaWarn("vgId:%d, tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), indexUid, tstrerror(terrno)); - return TSDB_CODE_FAILED; + smaError("vgId:%d, failed to get STSma while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } + pTsmaStat->pTSma = pTSma; + pTsmaStat->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1); + if (!pTsmaStat->pTSchema) { + smaError("vgId:%d, failed to get STSchema while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; } - pItem->pTSma = pTSma; - pItem->pTSchema = metaGetTbTSchema(SMA_META(pSma), pTSma->dstTbUid, -1); - ASSERT(pItem->pTSchema); // TODO } - ASSERT(pItem->pTSma->indexUid == indexUid); + if (pTsmaStat->pTSma->indexUid != indexUid) { + terrno = TSDB_CODE_VND_APP_ERROR; + smaError("vgId:%d, tsma insert for smaIndex %" PRIi64 "(!=%" PRIi64 ") failed since %s", SMA_VID(pSma), indexUid, + pTsmaStat->pTSma->indexUid, tstrerror(terrno)); + goto _err; + } - SSubmitReq *pSubmitReq = NULL; + SSubmitReq *pSubmitReq = tdBlockToSubmit((const SArray *)msg, pTsmaStat->pTSchema, true, pTsmaStat->pTSma->dstTbUid, + pTsmaStat->pTSma->dstTbName, pTsmaStat->pTSma->dstVgId); - pSubmitReq = tdBlockToSubmit((const SArray *)msg, pItem->pTSchema, true, pItem->pTSma->dstTbUid, - pItem->pTSma->dstTbName, pItem->pTSma->dstVgId); + if (!pSubmitReq) { + smaError("vgId:%d, failed to gen submit blk while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } - ASSERT(pSubmitReq); // TODO - - ASSERT(!strncasecmp("td.tsma.rst.tb", pItem->pTSma->dstTbName, 14)); +#if 0 + ASSERT(!strncasecmp("td.tsma.rst.tb", pTsmaStat->pTSma->dstTbName, 14)); +#endif SRpcMsg submitReqMsg = { .msgType = TDMT_VND_SUBMIT, @@ -170,9 +181,15 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) { .contLen = ntohl(pSubmitReq->length), }; - ASSERT(tmsgPutToQueue(&pSma->pVnode->msgCb, WRITE_QUEUE, &submitReqMsg) == 0); + if (tmsgPutToQueue(&pSma->pVnode->msgCb, WRITE_QUEUE, &submitReqMsg) < 0) { + smaError("vgId:%d, failed to put SubmitReq msg while tsma insert for smaIndex %" PRIi64 " since %s", SMA_VID(pSma), + indexUid, tstrerror(terrno)); + goto _err; + } tdUnRefSmaStat(pSma, pStat); - return TSDB_CODE_SUCCESS; +_err: + tdUnRefSmaStat(pSma, pStat); + return TSDB_CODE_FAILED; } \ No newline at end of file diff --git a/source/dnode/vnode/src/vnd/vnodeCommit.c b/source/dnode/vnode/src/vnd/vnodeCommit.c index dbbe3d3750..02a0783927 100644 --- a/source/dnode/vnode/src/vnd/vnodeCommit.c +++ b/source/dnode/vnode/src/vnd/vnodeCommit.c @@ -266,6 +266,8 @@ int vnodeCommit(SVnode *pVnode) { ASSERT(0); return -1; } + + pVnode->state.committed = info.state.committed; // apply the commit (TODO) vnodeBufPoolReset(pVnode->onCommit); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 2ddeb8ba2b..b73eaa4288 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -216,7 +216,7 @@ _err: } int32_t vnodePreprocessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { - if (TDMT_VND_QUERY != pMsg->msgType) { + if (TDMT_SCH_QUERY != pMsg->msgType && TDMT_SCH_MERGE_QUERY != pMsg->msgType) { return 0; } @@ -227,9 +227,10 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { vTrace("message in vnode query queue is processing"); SReadHandle handle = {.meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode, .pMsgCb = &pVnode->msgCb}; switch (pMsg->msgType) { - case TDMT_VND_QUERY: + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: return qWorkerProcessQueryMsg(&handle, pVnode->pQuery, pMsg, 0); - case TDMT_VND_QUERY_CONTINUE: + case TDMT_SCH_QUERY_CONTINUE: return qWorkerProcessCQueryMsg(&handle, pVnode->pQuery, pMsg, 0); default: vError("unknown msg type:%d in query queue", pMsg->msgType); @@ -243,15 +244,15 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { int32_t msgLen = pMsg->contLen - sizeof(SMsgHead); switch (pMsg->msgType) { - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: return qWorkerProcessFetchMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: return qWorkerProcessFetchRsp(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: return qWorkerProcessCancelMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: return qWorkerProcessDropMsg(pVnode, pVnode->pQuery, pMsg, 0); - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_TABLE_META: return vnodeGetTableMeta(pVnode, pMsg); diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index e9b64389aa..f9e811fc32 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -119,7 +119,7 @@ static int32_t vnodeProcessAlterReplicaReq(SVnode *pVnode, SRpcMsg *pMsg) { } void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode *pVnode = pInfo->ahandle; + SVnode * pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -178,7 +178,7 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { for (int32_t i = 0; i < newEpSet.numOfEps; ++i) { vGTrace("vgId:%d, msg:%p redirect:%d ep:%s:%u", vgId, pMsg, i, newEpSet.eps[i].fqdn, newEpSet.eps[i].port); } - + pMsg->info.hasEpSet = 1; SRpcMsg rsp = {.code = TSDB_CODE_RPC_REDIRECT, .info = pMsg->info}; tmsgSendRedirectRsp(&rsp, &newEpSet); } else { @@ -199,7 +199,7 @@ void vnodeProposeMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { } void vnodeApplyMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { - SVnode *pVnode = pInfo->ahandle; + SVnode * pVnode = pInfo->ahandle; int32_t vgId = pVnode->config.vgId; int32_t code = 0; SRpcMsg *pMsg = NULL; @@ -240,7 +240,7 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { STraceId *trace = &pMsg->info.traceId; do { - char *syncNodeStr = sync2SimpleStr(pVnode->sync); + char * syncNodeStr = sync2SimpleStr(pVnode->sync); static int64_t vndTick = 0; if (++vndTick % 10 == 1) { vGTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pVnode->sync), TMSG_INFO(pMsg->msgType), syncNodeStr); @@ -375,7 +375,7 @@ static void vnodeSyncReconfig(struct SSyncFSM *pFsm, const SRpcMsg *pMsg, SReCon } static void vnodeSyncCommitMsg(SSyncFSM *pFsm, const SRpcMsg *pMsg, SFsmCbMeta cbMeta) { - SVnode *pVnode = pFsm->data; + SVnode * pVnode = pFsm->data; SSnapshot snapshot = {0}; SyncIndex beginIndex = SYNC_INDEX_INVALID; char logBuf[256] = {0}; diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index 304da88888..59ad009527 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -241,7 +241,7 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, } -int32_t ctgHandleMsgCallback(void *param, const SDataBuf *pMsg, int32_t rspCode) { +int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { SCtgTaskCallbackParam* cbParam = (SCtgTaskCallbackParam*)param; int32_t code = 0; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index 2561516f6a..415df595e9 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -118,7 +118,7 @@ void initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SHashObj* pHashmap, int if (order == TSDB_ORDER_ASC || order == TSDB_ORDER_DESC) { __compar_fn_t fn = (order == TSDB_ORDER_ASC) ? resultrowComparAsc : resultrowComparDesc; - qsort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn); + taosSort(pGroupResInfo->pRows->pData, taosArrayGetSize(pGroupResInfo->pRows), POINTER_BYTES, fn); } pGroupResInfo->index = 0; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 919f30803d..c7dd288617 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -1348,7 +1348,7 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR SColumnInfoData* pSrc = taosArrayGet(px->pDataBlock, i); SColumnInfoData* pDst = taosArrayGet(pBlock->pDataBlock, i); // it is a reserved column for scalar function, and no data in this column yet. - if (pDst->pData == NULL) { + if (pDst->pData == NULL || pSrc->pData == NULL) { continue; } @@ -1933,7 +1933,7 @@ typedef struct SFetchRspHandleWrapper { int32_t sourceIndex; } SFetchRspHandleWrapper; -int32_t loadRemoteDataCallback(void* param, const SDataBuf* pMsg, int32_t code) { +int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) { SFetchRspHandleWrapper* pWrapper = (SFetchRspHandleWrapper*)param; SExchangeInfo* pExchangeInfo = taosAcquireRef(exchangeObjRefPool, pWrapper->exchangeId); @@ -2010,13 +2010,14 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf ASSERT(pDataInfo->status == EX_SOURCE_DATA_NOT_READY); - qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", %d/%" PRIzu, GET_TASKID(pTaskInfo), - pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, sourceIndex, totalSources); + qDebug("%s build fetch msg and send to vgId:%d, ep:%s, taskId:0x%" PRIx64 ", execId:%d, %d/%" PRIzu, GET_TASKID(pTaskInfo), + pSource->addr.nodeId, pSource->addr.epSet.eps[0].fqdn, pSource->taskId, pSource->execId, sourceIndex, totalSources); pMsg->header.vgId = htonl(pSource->addr.nodeId); pMsg->sId = htobe64(pSource->schedId); pMsg->taskId = htobe64(pSource->taskId); pMsg->queryId = htobe64(pTaskInfo->id.queryId); + pMsg->execId = htonl(pSource->execId); // send the fetch remote task result reques SMsgSendInfo* pMsgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); @@ -2034,7 +2035,7 @@ static int32_t doSendFetchDataRequest(SExchangeInfo* pExchangeInfo, SExecTaskInf pMsgSendInfo->param = pWrapper; pMsgSendInfo->msgInfo.pData = pMsg; pMsgSendInfo->msgInfo.len = sizeof(SResFetchReq); - pMsgSendInfo->msgType = TDMT_VND_FETCH; + pMsgSendInfo->msgType = TDMT_SCH_FETCH; pMsgSendInfo->fp = loadRemoteDataCallback; int64_t transporterId = 0; @@ -2145,9 +2146,9 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx SSDataBlock* pRes = pExchangeInfo->pResult; SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; if (pRsp->numOfRows == 0) { - qDebug("%s vgId:%d, taskId:0x%" PRIx64 " index:%d completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 + qDebug("%s vgId:%d, taskId:0x%" PRIx64 " execId:%d index:%d completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", completed:%d try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, i, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pDataInfo->totalRows, pExchangeInfo->loadInfo.totalRows, completed + 1, i + 1, totalSources); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; completed += 1; @@ -2165,17 +2166,17 @@ static SSDataBlock* concurrentlyLoadRemoteDataImpl(SOperatorInfo* pOperator, SEx } if (pRsp->completed == 1) { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d" " index:%d completed, numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 ", completed:%d try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, i, pRes->info.rows, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, i, pRes->info.rows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, completed + 1, i + 1, totalSources); completed += 1; pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, totalRows:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 ", totalBytes:%" PRIu64, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pLoadInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pLoadInfo->totalRows, pLoadInfo->totalSize); } @@ -2249,8 +2250,8 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { SDownstreamSourceNode* pSource = taosArrayGet(pExchangeInfo->pSources, pExchangeInfo->current); if (pDataInfo->code != TSDB_CODE_SUCCESS) { - qError("%s vgId:%d, taskID:0x%" PRIx64 " error happens, code:%s", GET_TASKID(pTaskInfo), pSource->addr.nodeId, - pSource->taskId, tstrerror(pDataInfo->code)); + qError("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d error happens, code:%s", GET_TASKID(pTaskInfo), pSource->addr.nodeId, + pSource->taskId, pSource->execId, tstrerror(pDataInfo->code)); pOperator->pTaskInfo->code = pDataInfo->code; return NULL; } @@ -2258,9 +2259,9 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { SRetrieveTableRsp* pRsp = pDataInfo->pRsp; SLoadRemoteDataInfo* pLoadInfo = &pExchangeInfo->loadInfo; if (pRsp->numOfRows == 0) { - qDebug("%s vgId:%d, taskID:0x%" PRIx64 " %d of total completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 + qDebug("%s vgId:%d, taskID:0x%" PRIx64 " execId:%d %d of total completed, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 " try next", - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pExchangeInfo->current + 1, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pExchangeInfo->current + 1, pDataInfo->totalRows, pLoadInfo->totalRows); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; @@ -2276,17 +2277,17 @@ static SSDataBlock* seqLoadRemoteData(SOperatorInfo* pOperator) { pTableRsp->compLen, pTableRsp->numOfCols, startTs, &pDataInfo->totalRows, NULL); if (pRsp->completed == 1) { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, rowsOfSource:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, rowsOfSource:%" PRIu64 ", totalRows:%" PRIu64 ", totalBytes:%" PRIu64 " try next %d/%" PRIzu, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pDataInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pDataInfo->totalRows, pLoadInfo->totalRows, pLoadInfo->totalSize, pExchangeInfo->current + 1, totalSources); pDataInfo->status = EX_SOURCE_DATA_EXHAUSTED; pExchangeInfo->current += 1; } else { - qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " numOfRows:%d, totalRows:%" PRIu64 + qDebug("%s fetch msg rsp from vgId:%d, taskId:0x%" PRIx64 " execId:%d numOfRows:%d, totalRows:%" PRIu64 ", totalBytes:%" PRIu64, - GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pRes->info.rows, pLoadInfo->totalRows, + GET_TASKID(pTaskInfo), pSource->addr.nodeId, pSource->taskId, pSource->execId, pRes->info.rows, pLoadInfo->totalRows, pLoadInfo->totalSize); } @@ -2378,7 +2379,7 @@ static int32_t initExchangeOperator(SExchangePhysiNode* pExNode, SExchangeInfo* } for (int32_t i = 0; i < numOfSources; ++i) { - SNodeListNode* pNode = (SNodeListNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); + SDownstreamSourceNode* pNode = (SDownstreamSourceNode*)nodesListGetNode((SNodeList*)pExNode->pSrcEndPoints, i); taosArrayPush(pInfo->pSources, pNode); } diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index f23749dc8c..89a47f4e2c 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1212,7 +1212,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys int16_t colId = id->colId; taosArrayPush(pColIds, &colId); - if (id->colId == pTableScanNode->tsColId) { + if (id->colId == PRIMARYKEY_TIMESTAMP_COL_ID) { pInfo->primaryTsIndex = id->targetSlotId; } } @@ -1361,7 +1361,7 @@ static void getDBNameFromCondition(SNode* pCondition, const char* dbName) { nodesWalkExpr(pCondition, getDBNameFromConditionWalker, (char*)dbName); } -static int32_t loadSysTableCallback(void* param, const SDataBuf* pMsg, int32_t code) { +static int32_t loadSysTableCallback(void* param, SDataBuf* pMsg, int32_t code) { SOperatorInfo* operator=(SOperatorInfo*) param; SSysTableScanInfo* pScanResInfo = (SSysTableScanInfo*)operator->info; if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 95b16589ee..66900fb7aa 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1246,6 +1246,9 @@ void doClearWindowImpl(SResultRowPosition* p1, SDiskbasedBuf* pResultBuf, SExprS pCtx[i].fpSet.init(&pCtx[i], pResInfo); } } + SFilePage* bufPage = getBufPage(pResultBuf, p1->pageId); + setBufPageDirty(bufPage, true); + releaseBufPage(pResultBuf, bufPage); } bool doClearWindow(SAggSupporter* pAggSup, SExprSupp* pSup, char* pData, int16_t bytes, uint64_t groupId, @@ -3171,6 +3174,10 @@ static void doClearSessionWindows(SStreamAggSupporter* pAggSup, SExprSupp* pSup, getSessionTimeWindow(pAggSup, tsCols[i], INT64_MIN, pBlock->info.groupId, gap, &winIndex); step = updateSessionWindowInfo(pCurWin, tsCols, NULL, pBlock->info.rows, i, gap, NULL); ASSERT(isInWindow(pCurWin, tsCols[i], gap)); + if (pCurWin->pos.pageId == -1) { + // window has been closed. + continue; + } doClearWindowImpl(&pCurWin->pos, pAggSup->pResultBuf, pSup, numOfOutput); if (result) { taosArrayPush(result, pCurWin); @@ -3246,12 +3253,12 @@ static void rebuildTimeWindow(SStreamSessionAggOperatorInfo* pInfo, SArray* pWin setWindowOutputBuf(pChWin, &pChResult, pChild->exprSupp.pCtx, groupId, numOfOutput, pChild->exprSupp.rowEntryInfoOffset, &pChInfo->streamAggSup, pTaskInfo); compactFunctions(pSup->pCtx, pChild->exprSupp.pCtx, numOfOutput, pTaskInfo); - SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pChWin->pos.pageId); - setBufPageDirty(bufPage, true); - releaseBufPage(pInfo->streamAggSup.pResultBuf, bufPage); + SFilePage* bufPage = getBufPage(pChInfo->streamAggSup.pResultBuf, pChWin->pos.pageId); + releaseBufPage(pChInfo->streamAggSup.pResultBuf, bufPage); continue; + } else if (!pChWin->isClosed) { + break; } - break; } } SFilePage* bufPage = getBufPage(pInfo->streamAggSup.pResultBuf, pParentWin->pos.pageId); @@ -3265,7 +3272,8 @@ typedef SResultWindowInfo* (*__get_win_info_)(void*); SResultWindowInfo* getResWinForSession(void* pData) { return (SResultWindowInfo*)pData; } SResultWindowInfo* getResWinForState(void* pData) { return &((SStateWindowInfo*)pData)->winInfo; } -int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArray* pClosed, __get_win_info_ fn) { +int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, + SArray* pClosed, __get_win_info_ fn, bool delete) { // Todo(liuyao) save window to tdb void** pIte = NULL; size_t keyLen = 0; @@ -3279,10 +3287,18 @@ int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArra if (isCloseWindow(&pSeWin->win, pTwSup)) { if (!pSeWin->isClosed) { pSeWin->isClosed = true; - if (pTwSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE) { + if (pTwSup->calTrigger == STREAM_TRIGGER_WINDOW_CLOSE && pClosed) { int32_t code = saveResult(pSeWin->win.skey, pSeWin->pos.pageId, pSeWin->pos.offset, *pGroupId, pClosed); + if (code != TSDB_CODE_SUCCESS) { + return code; + } pSeWin->isOutput = true; } + if (delete) { + taosArrayRemove(pWins, i); + i--; + size = taosArrayGetSize(pWins); + } } continue; } @@ -3292,6 +3308,16 @@ int32_t closeSessionWindow(SHashObj* pHashMap, STimeWindowAggSupp* pTwSup, SArra return TSDB_CODE_SUCCESS; } +static void closeChildSessionWindow(SArray* pChildren, TSKEY maxTs, bool delete) { + int32_t size = taosArrayGetSize(pChildren); + for (int32_t i = 0; i < size; i++) { + SOperatorInfo* pChildOp = taosArrayGetP(pChildren, i); + SStreamSessionAggOperatorInfo* pChInfo = pChildOp->info; + pChInfo->twAggSup.maxTs = TMAX(pChInfo->twAggSup.maxTs, maxTs); + closeSessionWindow(pChInfo->streamAggSup.pResultRows, &pChInfo->twAggSup, NULL, getResWinForSession, delete); + } +} + int32_t getAllSessionWindow(SHashObj* pHashMap, SArray* pClosed, __get_win_info_ fn) { void** pIte = NULL; while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) { @@ -3339,6 +3365,7 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { if (pBlock == NULL) { break; } + printDataBlock(pBlock, IS_FINAL_OP(pInfo) ? "Final Session Recv" : "Single Session Recv"); if (pBlock->info.type == STREAM_CLEAR) { SArray* pWins = taosArrayInit(16, sizeof(SResultWindowInfo)); @@ -3385,7 +3412,9 @@ static SSDataBlock* doStreamSessionAgg(SOperatorInfo* pOperator) { // restore the value pOperator->status = OP_RES_TO_RETURN; - closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, getResWinForSession); + closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, + getResWinForSession, pInfo->ignoreCloseWindow); + closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs, pInfo->ignoreCloseWindow); copyUpdateResult(pStUpdated, pUpdated); taosHashCleanup(pStUpdated); @@ -3437,10 +3466,11 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } else if (pOperator->status == OP_RES_TO_RETURN) { doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { + printDataBlock(pInfo->pDelRes, "Semi Session"); return pInfo->pDelRes; } doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0) { + if (pBInfo->pRes->info.rows == 0) { pOperator->status = OP_EXEC_DONE; if (pInfo->pUpdateRes->info.rows == 0) { // semi interval operator clear disk buffer @@ -3449,9 +3479,11 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { } // process the rest of the data pOperator->status = OP_OPENED; + printDataBlock(pInfo->pUpdateRes, "Semi Session"); return pInfo->pUpdateRes; } - return pInfo->binfo.pRes; + printDataBlock(pBInfo->pRes, "Semi Session"); + return pBInfo->pRes; } _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); @@ -3495,21 +3527,24 @@ static SSDataBlock* doStreamSessionSemiAgg(SOperatorInfo* pOperator) { finalizeUpdatedResult(pOperator->exprSupp.numOfExprs, pInfo->streamAggSup.pResultBuf, pUpdated, pSup->rowEntryInfoOffset); initMultiResInfoFromArrayList(&pInfo->groupResInfo, pUpdated); - blockDataEnsureCapacity(pInfo->binfo.pRes, pOperator->resultInfo.capacity); + blockDataEnsureCapacity(pBInfo->pRes, pOperator->resultInfo.capacity); doBuildDeleteDataBlock(pInfo->pStDeleted, pInfo->pDelRes, &pInfo->pDelIterator); if (pInfo->pDelRes->info.rows > 0) { + printDataBlock(pInfo->pDelRes, "Semi Session"); return pInfo->pDelRes; } - doBuildResultDatablock(pOperator, &pInfo->binfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); - if (pInfo->binfo.pRes->info.rows == 0) { + doBuildResultDatablock(pOperator, pBInfo, &pInfo->groupResInfo, pInfo->streamAggSup.pResultBuf); + if (pBInfo->pRes->info.rows == 0) { pOperator->status = OP_EXEC_DONE; if (pInfo->pUpdateRes->info.rows == 0) { return NULL; } // process the rest of the data pOperator->status = OP_OPENED; + printDataBlock(pInfo->pUpdateRes, "Semi Session"); return pInfo->pUpdateRes; } + printDataBlock(pBInfo->pRes, "Semi Session"); return pBInfo->pRes->info.rows == 0 ? NULL : pBInfo->pRes; } @@ -3867,7 +3902,9 @@ static SSDataBlock* doStreamStateAgg(SOperatorInfo* pOperator) { // restore the value pOperator->status = OP_RES_TO_RETURN; - closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, getResWinForState); + closeSessionWindow(pInfo->streamAggSup.pResultRows, &pInfo->twAggSup, pUpdated, + getResWinForState, pInfo->ignoreCloseWindow); + closeChildSessionWindow(pInfo->pChildren, pInfo->twAggSup.maxTs, pInfo->ignoreCloseWindow); copyUpdateResult(pSeUpdated, pUpdated); taosHashCleanup(pSeUpdated); diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h index f7e22cb151..8eafb0703e 100644 --- a/source/libs/function/inc/builtinsimpl.h +++ b/source/libs/function/inc/builtinsimpl.h @@ -117,6 +117,9 @@ int32_t firstCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx); int32_t getFirstLastInfoSize(int32_t resBytes); +int32_t lastRowFunction(SqlFunctionCtx *pCtx); +int32_t lastRowFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock); + bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv); bool getTopBotMergeFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv); bool topBotFunctionSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResultInfo); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index b624e42d4c..68d89e9ec8 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -39,6 +39,21 @@ static int32_t invaildFuncParaValueErrMsg(char* pErrBuf, int32_t len, const char return buildFuncErrMsg(pErrBuf, len, TSDB_CODE_FUNC_FUNTION_PARA_VALUE, "Invalid parameter value : %s", pFuncName); } +void static addDbPrecisonParam(SNodeList** pList, uint8_t precision) { + SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + pVal->literal = NULL; + pVal->isDuration = false; + pVal->translate = true; + pVal->notReserved = true; + pVal->node.resType.type = TSDB_DATA_TYPE_TINYINT; + pVal->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TINYINT].bytes; + pVal->node.resType.precision = precision; + pVal->datum.i = (int64_t)precision; + pVal->typeData = (int64_t)precision; + + nodesListMakeAppend(pList, (SNode*)pVal); +} + // 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)) { @@ -220,8 +235,20 @@ static int32_t translateWduration(SFunctionNode* pFunc, char* pErrBuf, int32_t l return TSDB_CODE_SUCCESS; } +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; + addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + + pFunc->node.resType = (SDataType){.bytes = sizeof(int64_t), .type = TSDB_DATA_TYPE_TIMESTAMP}; + 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 = sizeof(int64_t), .type = TSDB_DATA_TYPE_TIMESTAMP}; return TSDB_CODE_SUCCESS; } @@ -990,6 +1017,10 @@ static int32_t translateIrate(SFunctionNode* pFunc, char* pErrBuf, int32_t len) return invaildFuncParaTypeErrMsg(pErrBuf, len, pFunc->functionName); } + //add database precision as param + uint8_t dbPrec = pFunc->node.resType.precision; + addDbPrecisonParam(&pFunc->pParameterList, dbPrec); + pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes, .type = TSDB_DATA_TYPE_DOUBLE}; return TSDB_CODE_SUCCESS; } @@ -1379,20 +1410,6 @@ static bool validateTimezoneFormat(const SValueNode* pVal) { return true; } -void static addDbPrecisonParam(SNodeList* pList, uint8_t precision) { - SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); - pVal->literal = NULL; - pVal->isDuration = false; - pVal->translate = true; - pVal->node.resType.type = TSDB_DATA_TYPE_TINYINT; - pVal->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_TINYINT].bytes; - pVal->node.resType.precision = precision; - pVal->datum.i = (int64_t)precision; - pVal->typeData = (int64_t)precision; - - nodesListAppend(pList, (SNode*)pVal); -} - void static addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); @@ -1462,7 +1479,7 @@ static int32_t translateToUnixtimestamp(SFunctionNode* pFunc, char* pErrBuf, int //add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(pFunc->pParameterList, dbPrec); + addDbPrecisonParam(&pFunc->pParameterList, dbPrec); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; @@ -1482,7 +1499,7 @@ static int32_t translateTimeTruncate(SFunctionNode* pFunc, char* pErrBuf, int32_ //add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(pFunc->pParameterList, dbPrec); + addDbPrecisonParam(&pFunc->pParameterList, dbPrec); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_TIMESTAMP].bytes, .type = TSDB_DATA_TYPE_TIMESTAMP}; @@ -1510,7 +1527,7 @@ static int32_t translateTimeDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t le //add database precision as param uint8_t dbPrec = pFunc->node.resType.precision; - addDbPrecisonParam(pFunc->pParameterList, dbPrec); + addDbPrecisonParam(&pFunc->pParameterList, dbPrec); pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes, .type = TSDB_DATA_TYPE_BIGINT}; return TSDB_CODE_SUCCESS; @@ -1936,7 +1953,17 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { }, { .name = "last_row", - .type = FUNCTION_TYPE_LAST_ROW, + .type = FUNCTION_TYPE_LAST_ROWT, + .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, + .translateFunc = translateFirstLast, + .getEnvFunc = getFirstLastFuncEnv, + .initFunc = functionSetup, + .processFunc = lastRowFunction, + .finalizeFunc = lastRowFinalize, + }, + { + .name = "_cache_last_row", + .type = FUNCTION_TYPE_CACHE_LAST_ROW, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC, .translateFunc = translateLastRow, .getEnvFunc = getMinmaxFuncEnv, @@ -2466,7 +2493,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "now", .type = FUNCTION_TYPE_NOW, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, - .translateFunc = translateTimePseudoColumn, + .translateFunc = translateNowToday, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = nowFunction, @@ -2476,7 +2503,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { .name = "today", .type = FUNCTION_TYPE_TODAY, .classification = FUNC_MGT_SCALAR_FUNC | FUNC_MGT_DATETIME_FUNC, - .translateFunc = translateTimePseudoColumn, + .translateFunc = translateNowToday, .getEnvFunc = NULL, .initFunc = NULL, .sprocessFunc = todayFunction, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index e40ab3784d..eb21ee1fb5 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -80,6 +80,7 @@ typedef struct STopBotRes { typedef struct SFirstLastRes { bool hasResult; + bool isNull; //used for last_row function only int32_t bytes; char buf[]; } SFirstLastRes; @@ -2763,6 +2764,113 @@ int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx) { return TSDB_CODE_SUCCESS; } +int32_t lastRowFunction(SqlFunctionCtx* pCtx) { + int32_t numOfElems = 0; + + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + SFirstLastRes* pInfo = GET_ROWCELL_INTERBUF(pResInfo); + + SInputColumnInfoData* pInput = &pCtx->input; + SColumnInfoData* pInputCol = pInput->pData[0]; + + int32_t type = pInputCol->info.type; + int32_t bytes = pInputCol->info.bytes; + pInfo->bytes = bytes; + + SColumnDataAgg* pColAgg = (pInput->colDataAggIsSet) ? pInput->pColumnDataAgg[0] : NULL; + + TSKEY startKey = getRowPTs(pInput->pPTS, 0); + TSKEY endKey = getRowPTs(pInput->pPTS, pInput->totalRows - 1); + + int32_t blockDataOrder = (startKey <= endKey) ? TSDB_ORDER_ASC : TSDB_ORDER_DESC; + + if (blockDataOrder == TSDB_ORDER_ASC) { + for (int32_t i = pInput->numOfRows + pInput->startRowIndex - 1; i >= pInput->startRowIndex; --i) { + char* data = colDataGetData(pInputCol, i); + TSKEY cts = getRowPTs(pInput->pPTS, i); + if (pResInfo->numOfRes == 0 || *(TSKEY*)(pInfo->buf) < cts) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + pInfo->isNull = true; + } else { + pInfo->isNull = false; + if (IS_VAR_DATA_TYPE(type)) { + bytes = varDataTLen(data); + pInfo->bytes = bytes; + } + memcpy(pInfo->buf + sizeof(TSKEY), data, bytes); + } + *(TSKEY*)(pInfo->buf) = cts; + numOfElems++; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } + pInfo->hasResult = true; + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); + pResInfo->numOfRes = 1; + } + break; + } + } else { // descending order + for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; ++i) { + char* data = colDataGetData(pInputCol, i); + TSKEY cts = getRowPTs(pInput->pPTS, i); + if (pResInfo->numOfRes == 0 || *(TSKEY*)(pInfo->buf) < cts) { + if (pInputCol->hasNull && colDataIsNull(pInputCol, pInput->totalRows, i, pColAgg)) { + pInfo->isNull = true; + } else { + pInfo->isNull = false; + if (IS_VAR_DATA_TYPE(type)) { + bytes = varDataTLen(data); + pInfo->bytes = bytes; + } + memcpy(pInfo->buf + sizeof(TSKEY), data, bytes); + } + *(TSKEY*)(pInfo->buf) = cts; + numOfElems++; + //handle selectivity + if (pCtx->subsidiaries.num > 0) { + STuplePos* pTuplePos = (STuplePos*)(pInfo->buf + bytes + sizeof(TSKEY)); + if (!pInfo->hasResult) { + saveTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } else { + copyTupleData(pCtx, i, pCtx->pSrcBlock, pTuplePos); + } + } + pInfo->hasResult = true; + pResInfo->numOfRes = 1; + //DO_UPDATE_TAG_COLUMNS(pCtx, ts); + } + break; + } + } + + SET_VAL(pResInfo, numOfElems, 1); + return TSDB_CODE_SUCCESS; +} + + +int32_t lastRowFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { + int32_t slotId = pCtx->pExpr->base.resSchema.slotId; + SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); + + SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); + + SFirstLastRes* pRes = GET_ROWCELL_INTERBUF(pResInfo); + colDataAppend(pCol, pBlock->info.rows, pRes->buf + sizeof(TSKEY), pRes->isNull); + //handle selectivity + STuplePos* pTuplePos = (STuplePos*)(pRes->buf + pRes->bytes + sizeof(TSKEY)); + setSelectivityValue(pCtx, pBlock, pTuplePos, pBlock->info.rows); + + return pResInfo->numOfRes; +} + + bool getDiffFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) { pEnv->calcMemSize = sizeof(SDiffInfo); return true; @@ -4283,7 +4391,7 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput; // TODO: process timeUnit for different db precisions - int32_t timeUnit = 1000; + int32_t timeUnit = 1; if (pCtx->numOfParams == 5) { // TODO: param number incorrect timeUnit = pCtx->param[3].param.i; } @@ -5508,7 +5616,7 @@ int32_t irateFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0; SRateInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo); - double result = doCalcRate(pInfo, 1000); + double result = doCalcRate(pInfo, (double)TSDB_TICK_PER_SECOND(pCtx->param[1].param.i)); colDataAppend(pCol, pBlock->info.rows, (const char*)&result, pResInfo->isNullRes); return pResInfo->numOfRes; diff --git a/source/libs/function/src/taggfunction.c b/source/libs/function/src/taggfunction.c index 47ae07f823..c8998b9d94 100644 --- a/source/libs/function/src/taggfunction.c +++ b/source/libs/function/src/taggfunction.c @@ -1887,10 +1887,10 @@ static void top_bottom_func_finalizer(SqlFunctionCtx *pCtx) { // user specify the order of output by sort the result according to timestamp if (pCtx->param[1].param.i == PRIMARYKEY_TIMESTAMP_COL_ID) { __compar_fn_t comparator = (pCtx->param[2].param.i == TSDB_ORDER_ASC) ? resAscComparFn : resDescComparFn; - qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); + taosSort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } else /*if (pCtx->param[1].param.i > PRIMARYKEY_TIMESTAMP_COL_ID)*/ { __compar_fn_t comparator = (pCtx->param[2].param.i == TSDB_ORDER_ASC) ? resDataAscComparFn : resDataDescComparFn; - qsort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); + taosSort(tvp, (size_t)pResInfo->numOfRes, POINTER_BYTES, comparator); } GET_TRUE_DATA_TYPE(); diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index b40dd8b78d..057d2bc7dc 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -44,7 +44,7 @@ static SFilePage *loadDataFromFilePage(tMemBucket *pMemBucket, int32_t slotIdx) offset += (int32_t)(pg->num * pMemBucket->bytes); } - qsort(buffer->data, pMemBucket->pSlots[slotIdx].info.size, pMemBucket->bytes, pMemBucket->comparFn); + taosSort(buffer->data, pMemBucket->pSlots[slotIdx].info.size, pMemBucket->bytes, pMemBucket->comparFn); return buffer; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 364ee0692f..708ea4bd38 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -548,8 +548,8 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { } static bool udfdRpcRfp(int32_t code, tmsg_t msgType) { if (code == TSDB_CODE_RPC_REDIRECT || code == TSDB_CODE_RPC_NETWORK_UNAVAIL || code == TSDB_CODE_NODE_NOT_DEPLOYED || - code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY) { - if (msgType == TDMT_VND_QUERY || msgType == TDMT_VND_FETCH) { + code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_APP_NOT_READY || code == TSDB_CODE_RPC_BROKEN_LINK) { + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY || msgType == TDMT_SCH_FETCH) { return false; } return true; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index b372bf75fc..68654b21a6 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -350,9 +350,9 @@ static int32_t logicScanCopy(const SScanLogicNode* pSrc, SScanLogicNode* pDst) { CLONE_NODE_FIELD(pTagIndexCond); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(tsColId); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); CLONE_NODE_LIST_FIELD(pGroupTags); + COPY_SCALAR_FIELD(groupSort); return TSDB_CODE_SUCCESS; } @@ -421,7 +421,7 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p CLONE_NODE_FIELD(pStateExpr); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); COPY_SCALAR_FIELD(windowAlgo); return TSDB_CODE_SUCCESS; } @@ -511,8 +511,7 @@ static int32_t physiTableScanCopy(const STableScanPhysiNode* pSrc, STableScanPhy COPY_SCALAR_FIELD(slidingUnit); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(tsColId); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); return TSDB_CODE_SUCCESS; } @@ -532,7 +531,7 @@ static int32_t physiWindowCopy(const SWinodwPhysiNode* pSrc, SWinodwPhysiNode* p CLONE_NODE_FIELD(pTsEnd); COPY_SCALAR_FIELD(triggerType); COPY_SCALAR_FIELD(watermark); - COPY_SCALAR_FIELD(filesFactor); + COPY_SCALAR_FIELD(igExpired); return TSDB_CODE_SUCCESS; } @@ -582,6 +581,7 @@ static int32_t downstreamSourceCopy(const SDownstreamSourceNode* pSrc, SDownstre COPY_OBJECT_FIELD(addr, sizeof(SQueryNodeAddr)); COPY_SCALAR_FIELD(taskId); COPY_SCALAR_FIELD(schedId); + COPY_SCALAR_FIELD(execId); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index df7429bd88..df5a401eb1 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1426,12 +1426,11 @@ static const char* jkTableScanPhysiPlanDynamicScanFuncs = "DynamicScanFuncs"; static const char* jkTableScanPhysiPlanInterval = "Interval"; static const char* jkTableScanPhysiPlanOffset = "Offset"; static const char* jkTableScanPhysiPlanSliding = "Sliding"; -static const char* jkTableScanPhysiPlanIntervalUnit = "intervalUnit"; -static const char* jkTableScanPhysiPlanSlidingUnit = "slidingUnit"; -static const char* jkTableScanPhysiPlanTriggerType = "triggerType"; -static const char* jkTableScanPhysiPlanWatermark = "watermark"; -static const char* jkTableScanPhysiPlanTsColId = "tsColId"; -static const char* jkTableScanPhysiPlanFilesFactor = "FilesFactor"; +static const char* jkTableScanPhysiPlanIntervalUnit = "IntervalUnit"; +static const char* jkTableScanPhysiPlanSlidingUnit = "SlidingUnit"; +static const char* jkTableScanPhysiPlanTriggerType = "TriggerType"; +static const char* jkTableScanPhysiPlanWatermark = "Watermark"; +static const char* jkTableScanPhysiPlanIgnoreExpired = "IgnoreExpired"; static const char* jkTableScanPhysiPlanGroupTags = "GroupTags"; static const char* jkTableScanPhysiPlanGroupSort = "GroupSort"; @@ -1482,10 +1481,7 @@ static int32_t physiTableScanNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanWatermark, pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId); - } - if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddDoubleToObject(pJson, jkTableScanPhysiPlanFilesFactor, pNode->filesFactor); + code = tjsonAddIntegerToObject(pJson, jkTableScanPhysiPlanIgnoreExpired, pNode->igExpired); } if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkTableScanPhysiPlanGroupTags, pNode->pGroupTags); @@ -1517,37 +1513,34 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) { code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanRatio, &pNode->ratio); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanDataRequired, pNode->dataRequired, code); + code = tjsonGetIntValue(pJson, jkTableScanPhysiPlanDataRequired, &pNode->dataRequired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanDynamicScanFuncs, &pNode->pDynamicScanFuncs); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanInterval, pNode->interval, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanInterval, &pNode->interval); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanOffset, pNode->offset, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanOffset, &pNode->offset); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanSliding, pNode->sliding, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanSliding, &pNode->sliding); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanIntervalUnit, pNode->intervalUnit, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIntervalUnit, &pNode->intervalUnit); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanSlidingUnit, pNode->slidingUnit, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanSlidingUnit, &pNode->slidingUnit); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanTriggerType, pNode->triggerType, code); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanTriggerType, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanWatermark, pNode->watermark, code); + code = tjsonGetBigIntValue(pJson, jkTableScanPhysiPlanWatermark, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkTableScanPhysiPlanTsColId, pNode->tsColId, code); - } - if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetDoubleValue(pJson, jkTableScanPhysiPlanFilesFactor, &pNode->filesFactor); + code = tjsonGetTinyIntValue(pJson, jkTableScanPhysiPlanIgnoreExpired, &pNode->igExpired); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkTableScanPhysiPlanGroupTags, &pNode->pGroupTags); @@ -1826,7 +1819,7 @@ static const char* jkWindowPhysiPlanTsPk = "TsPk"; static const char* jkWindowPhysiPlanTsEnd = "TsEnd"; static const char* jkWindowPhysiPlanTriggerType = "TriggerType"; static const char* jkWindowPhysiPlanWatermark = "Watermark"; -static const char* jkWindowPhysiPlanFilesFactor = "FilesFactor"; +static const char* jkWindowPhysiPlanIgnoreExpired = "IgnoreExpired"; static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { const SWinodwPhysiNode* pNode = (const SWinodwPhysiNode*)pObj; @@ -1851,7 +1844,7 @@ static int32_t physiWindowNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanWatermark, pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddDoubleToObject(pJson, jkWindowPhysiPlanFilesFactor, pNode->filesFactor); + code = tjsonAddIntegerToObject(pJson, jkWindowPhysiPlanIgnoreExpired, pNode->igExpired); } return code; @@ -1874,15 +1867,13 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) { code = jsonToNodeObject(pJson, jkWindowPhysiPlanTsEnd, (SNode**)&pNode->pTsEnd); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkWindowPhysiPlanTriggerType, pNode->triggerType, code); - ; + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanTriggerType, &pNode->triggerType); } if (TSDB_CODE_SUCCESS == code) { - tjsonGetNumberValue(pJson, jkWindowPhysiPlanWatermark, pNode->watermark, code); - ; + code = tjsonGetBigIntValue(pJson, jkWindowPhysiPlanWatermark, &pNode->watermark); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetDoubleValue(pJson, jkWindowPhysiPlanFilesFactor, &pNode->filesFactor); + code = tjsonGetTinyIntValue(pJson, jkWindowPhysiPlanIgnoreExpired, &pNode->igExpired); } return code; @@ -3430,6 +3421,7 @@ static int32_t jsonToSlotDescNode(const SJson* pJson, void* pObj) { static const char* jkDownstreamSourceAddr = "Addr"; static const char* jkDownstreamSourceTaskId = "TaskId"; static const char* jkDownstreamSourceSchedId = "SchedId"; +static const char* jkDownstreamSourceExecId = "ExecId"; static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) { const SDownstreamSourceNode* pNode = (const SDownstreamSourceNode*)pObj; @@ -3441,6 +3433,9 @@ static int32_t downstreamSourceNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceSchedId, pNode->schedId); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkDownstreamSourceExecId, pNode->execId); + } return code; } @@ -3455,6 +3450,9 @@ static int32_t jsonToDownstreamSourceNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetUBigIntValue(pJson, jkDownstreamSourceSchedId, &pNode->schedId); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetIntValue(pJson, jkDownstreamSourceExecId, &pNode->execId); + } return code; } diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index dc9d9b92ee..1972010e25 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -1728,7 +1728,6 @@ static EDealRes classifyConditionImpl(SNode* pNode, void* pContext) { } else { pCxt->hasOtherCol = true; } - return *((bool*)pContext) ? DEAL_RES_CONTINUE : DEAL_RES_END; } return DEAL_RES_CONTINUE; } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index cb43bfef0e..2e58cc56b8 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -488,6 +488,7 @@ stream_options(A) ::= stream_options(B) TRIGGER AT_ONCE. stream_options(A) ::= stream_options(B) TRIGGER WINDOW_CLOSE. { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; A = B; } stream_options(A) ::= stream_options(B) TRIGGER MAX_DELAY duration_literal(C). { ((SStreamOptions*)B)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)B)->pDelay = releaseRawExprNode(pCxt, C); A = B; } stream_options(A) ::= stream_options(B) WATERMARK duration_literal(C). { ((SStreamOptions*)B)->pWatermark = releaseRawExprNode(pCxt, C); A = B; } +stream_options(A) ::= stream_options(B) IGNORE EXPIRED. { ((SStreamOptions*)B)->ignoreExpired = true; A = B; } /************************************************ kill connection/query ***********************************************/ cmd ::= KILL CONNECTION NK_INTEGER(A). { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &A); } @@ -848,14 +849,10 @@ set_quantifier_opt(A) ::= ALL. %type select_list { SNodeList* } %destructor select_list { nodesDestroyList($$); } -select_list(A) ::= NK_STAR. { A = NULL; } -select_list(A) ::= select_sublist(B). { A = B; } - -%type select_sublist { SNodeList* } -%destructor select_sublist { nodesDestroyList($$); } -select_sublist(A) ::= select_item(B). { A = createNodeList(pCxt, B); } -select_sublist(A) ::= select_sublist(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); } +select_list(A) ::= select_item(B). { A = createNodeList(pCxt, B); } +select_list(A) ::= select_list(B) NK_COMMA select_item(C). { A = addNodeToList(pCxt, B, C); } +select_item(A) ::= NK_STAR(B). { A = createColumnNode(pCxt, NULL, &B); } select_item(A) ::= common_expression(B). { A = releaseRawExprNode(pCxt, B); } select_item(A) ::= common_expression(B) column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } select_item(A) ::= common_expression(B) AS column_alias(C). { A = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, B), &C); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 044ec90a7f..a76640d0b5 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -790,11 +790,11 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* pColIdx[i].schemaColIdx = pColList->boundColumns[i]; pColIdx[i].boundIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); for (col_id_t i = 0; i < pColList->numOfBound; ++i) { pColIdx[i].finalIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); } if (pColList->numOfCols > pColList->numOfBound) { @@ -1302,6 +1302,74 @@ static int32_t parseValuesClause(SInsertParseContext* pCxt, STableDataBlocks* da return TSDB_CODE_SUCCESS; } +static int32_t parseCsvFile(SInsertParseContext* pCxt, TdFilePtr fp, STableDataBlocks* pDataBlock, int maxRows, + int32_t* numOfRows) { + STableComInfo tinfo = getTableInfo(pDataBlock->pTableMeta); + int32_t extendedRowSize = getExtendedRowSize(pDataBlock); + CHECK_CODE(initRowBuilder(&pDataBlock->rowBuilder, pDataBlock->pTableMeta->sversion, &pDataBlock->boundColumnInfo)); + + (*numOfRows) = 0; + char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \" + char* pLine = NULL; + int64_t readLen = 0; + while ((readLen = taosGetLineFile(fp, &pLine)) != -1) { + if (('\r' == pLine[readLen - 1]) || ('\n' == pLine[readLen - 1])) { + pLine[--readLen] = '\0'; + } + + if (readLen == 0) { + continue; + } + + if ((*numOfRows) >= maxRows || pDataBlock->size + extendedRowSize >= pDataBlock->nAllocSize) { + int32_t tSize; + CHECK_CODE(allocateMemIfNeed(pDataBlock, extendedRowSize, &tSize)); + ASSERT(tSize >= maxRows); + maxRows = tSize; + } + + strtolower(pLine, pLine); + char* pRawSql = pCxt->pSql; + pCxt->pSql = pLine; + bool gotRow = false; + CHECK_CODE(parseOneRow(pCxt, pDataBlock, tinfo.precision, &gotRow, tmpTokenBuf)); + if (gotRow) { + pDataBlock->size += extendedRowSize; // len; + (*numOfRows)++; + } + pCxt->pSql = pRawSql; + } + + if (0 == (*numOfRows) && (!TSDB_QUERY_HAS_TYPE(pCxt->pOutput->insertType, TSDB_QUERY_TYPE_STMT_INSERT))) { + return buildSyntaxErrMsg(&pCxt->msg, "no any data points", NULL); + } + return TSDB_CODE_SUCCESS; +} + +static int32_t parseDataFromFile(SInsertParseContext* pCxt, SToken filePath, STableDataBlocks* dataBuf) { + char filePathStr[TSDB_FILENAME_LEN] = {0}; + strncpy(filePathStr, filePath.z, filePath.n); + TdFilePtr fp = taosOpenFile(filePathStr, TD_FILE_READ | TD_FILE_STREAM); + if (NULL == fp) { + return TAOS_SYSTEM_ERROR(errno); + } + + int32_t maxNumOfRows; + CHECK_CODE(allocateMemIfNeed(dataBuf, getExtendedRowSize(dataBuf), &maxNumOfRows)); + + int32_t numOfRows = 0; + CHECK_CODE(parseCsvFile(pCxt, fp, dataBuf, maxNumOfRows, &numOfRows)); + + SSubmitBlk* pBlocks = (SSubmitBlk*)(dataBuf->pData); + if (TSDB_CODE_SUCCESS != setBlockInfo(pBlocks, dataBuf, numOfRows)) { + return buildInvalidOperationMsg(&pCxt->msg, "too many rows in sql, total number of rows should be less than 32767"); + } + + dataBuf->numOfTables = 1; + pCxt->totalNum += numOfRows; + return TSDB_CODE_SUCCESS; +} + void destroyCreateSubTbReq(SVCreateTbReq* pReq) { taosMemoryFreeClear(pReq->name); taosMemoryFreeClear(pReq->ctb.pTag); @@ -1421,7 +1489,7 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) { if (0 == sToken.n || (TK_NK_STRING != sToken.type && TK_NK_ID != sToken.type)) { return buildSyntaxErrMsg(&pCxt->msg, "file path is required following keyword FILE", sToken.z); } - // todo + CHECK_CODE(parseDataFromFile(pCxt, sToken, dataBuf)); pCxt->pOutput->insertType = TSDB_QUERY_TYPE_FILE_INSERT; tbNum++; @@ -2164,11 +2232,11 @@ static int32_t smlBoundColumnData(SArray* cols, SParsedDataColInfo* pColList, SS pColIdx[i].schemaColIdx = pColList->boundColumns[i]; pColIdx[i].boundIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), schemaIdxCompar); for (col_id_t i = 0; i < pColList->numOfBound; ++i) { pColIdx[i].finalIdx = i; } - qsort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); + taosSort(pColIdx, pColList->numOfBound, sizeof(SBoundIdxInfo), boundIdxCompar); } if (pColList->numOfCols > pColList->numOfBound) { diff --git a/source/libs/parser/src/parInsertData.c b/source/libs/parser/src/parInsertData.c index 56301c072c..84bcef7185 100644 --- a/source/libs/parser/src/parInsertData.c +++ b/source/libs/parser/src/parInsertData.c @@ -295,7 +295,7 @@ void sortRemoveDataBlockDupRowsRaw(STableDataBlocks* dataBuf) { char* pBlockData = pBlocks->data; // todo. qsort is unstable, if timestamp is same, should get the last one - qsort(pBlockData, pBlocks->numOfRows, dataBuf->rowSize, rowDataCompar); + taosSort(pBlockData, pBlocks->numOfRows, dataBuf->rowSize, rowDataCompar); int32_t i = 0; int32_t j = 1; @@ -365,7 +365,7 @@ int sortRemoveDataBlockDupRows(STableDataBlocks* dataBuf, SBlockKeyInfo* pBlkKey pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; // todo. qsort is unstable, if timestamp is same, should get the last one - qsort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); + taosSort(pBlkKeyTuple, nRows, sizeof(SBlockKeyTuple), rowDataComparStable); pBlkKeyTuple = pBlkKeyInfo->pKeyTuple; int32_t i = 0; diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 7f5d742dc7..6736fea635 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -84,8 +84,10 @@ static SKeyword keywordTable[] = { {"DURATION", TK_DURATION}, {"ENABLE", TK_ENABLE}, {"EXISTS", TK_EXISTS}, + {"EXPIRED", TK_EXPIRED}, {"EXPLAIN", TK_EXPLAIN}, {"EVERY", TK_EVERY}, + {"FILE", TK_FILE}, {"FILL", TK_FILL}, {"FIRST", TK_FIRST}, {"FLOAT", TK_FLOAT}, @@ -98,6 +100,7 @@ static SKeyword keywordTable[] = { {"GROUP", TK_GROUP}, {"HAVING", TK_HAVING}, {"IF", TK_IF}, + {"IGNORE", TK_IGNORE}, {"IMPORT", TK_IMPORT}, {"IN", TK_IN}, {"INDEX", TK_INDEX}, @@ -289,7 +292,6 @@ static SKeyword keywordTable[] = { // {"END", TK_END}, // {"FAIL", TK_FAIL}, // {"FOR", TK_FOR}, - // {"IGNORE", TK_IGNORE}, // {"IMMEDIATE", TK_IMMEDIATE}, // {"INITIALLY", TK_INITIALLY}, // {"INSTEAD", TK_INSTEAD}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 521c733ceb..be47278103 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -783,6 +783,13 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD if (pVal->placeholderNo > 0 || pVal->isNull) { return DEAL_RES_CONTINUE; } + if (TSDB_DATA_TYPE_NULL == pVal->node.resType.type) { + // TODO + //pVal->node.resType = targetDt; + pVal->translate = true; + pVal->isNull = true; + return DEAL_RES_CONTINUE; + } if (pVal->isDuration) { if (parseNatualDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &pVal->unit, precision) != TSDB_CODE_SUCCESS) { @@ -1984,34 +1991,38 @@ static int32_t createMultiResFuncsFromStar(STranslateContext* pCxt, SFunctionNod } static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect) { - if (NULL == pSelect->pProjectionList) { // select * ... - return createAllColumns(pCxt, &pSelect->pProjectionList); - } else { - SNode* pNode = NULL; - WHERE_EACH(pNode, pSelect->pProjectionList) { - int32_t code = TSDB_CODE_SUCCESS; - if (isMultiResFunc(pNode)) { - SNodeList* pFuncs = NULL; - code = createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs); - if (TSDB_CODE_SUCCESS == code) { - INSERT_LIST(pSelect->pProjectionList, pFuncs); - ERASE_NODE(pSelect->pProjectionList); - continue; - } - } else if (isTableStar(pNode)) { - SNodeList* pCols = NULL; - code = createTableAllCols(pCxt, (SColumnNode*)pNode, &pCols); - if (TSDB_CODE_SUCCESS == code) { - INSERT_LIST(pSelect->pProjectionList, pCols); - ERASE_NODE(pSelect->pProjectionList); - continue; - } + SNode* pNode = NULL; + WHERE_EACH(pNode, pSelect->pProjectionList) { + int32_t code = TSDB_CODE_SUCCESS; + if (isStar(pNode)) { + SNodeList* pCols = NULL; + code = createAllColumns(pCxt, &pCols); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pCols); + ERASE_NODE(pSelect->pProjectionList); + continue; } - if (TSDB_CODE_SUCCESS != code) { - return code; + } else if (isMultiResFunc(pNode)) { + SNodeList* pFuncs = NULL; + code = createMultiResFuncsFromStar(pCxt, (SFunctionNode*)pNode, &pFuncs); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pFuncs); + ERASE_NODE(pSelect->pProjectionList); + continue; + } + } else if (isTableStar(pNode)) { + SNodeList* pCols = NULL; + code = createTableAllCols(pCxt, (SColumnNode*)pNode, &pCols); + if (TSDB_CODE_SUCCESS == code) { + INSERT_LIST(pSelect->pProjectionList, pCols); + ERASE_NODE(pSelect->pProjectionList); + continue; } - WHERE_NEXT; } + if (TSDB_CODE_SUCCESS != code) { + return code; + } + WHERE_NEXT; } return TSDB_CODE_SUCCESS; } @@ -4204,6 +4215,7 @@ static int32_t buildCreateStreamReq(STranslateContext* pCxt, SCreateStreamStmt* pReq->triggerType = pStmt->pOptions->triggerType; pReq->maxDelay = (NULL != pStmt->pOptions->pDelay ? ((SValueNode*)pStmt->pOptions->pDelay)->datum.i : 0); pReq->watermark = (NULL != pStmt->pOptions->pWatermark ? ((SValueNode*)pStmt->pOptions->pWatermark)->datum.i : 0); + pReq->igExpired = pStmt->pOptions->ignoreExpired; } return code; @@ -4794,6 +4806,15 @@ static const char* getSysTableName(ENodeType type) { return NULL; } +static SNode* createStarCol() { + SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); + if (NULL == pCol) { + return NULL; + } + strcpy(pCol->colName, "*"); + return (SNode*)pCol; +} + static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, SSelectStmt** pStmt) { SSelectStmt* pSelect = (SSelectStmt*)nodesMakeNode(QUERY_NODE_SELECT_STMT); if (NULL == pSelect) { @@ -4811,6 +4832,11 @@ static int32_t createSimpleSelectStmt(const char* pDb, const char* pTable, SSele strcpy(pRealTable->table.tableAlias, pTable); pSelect->pFromTable = (SNode*)pRealTable; + if (TSDB_CODE_SUCCESS != nodesListMakeStrictAppend(&pSelect->pProjectionList, createStarCol())) { + nodesDestroyNode((SNode*)pSelect); + return TSDB_CODE_OUT_OF_MEMORY; + } + *pStmt = pSelect; return TSDB_CODE_SUCCESS; @@ -4959,6 +4985,7 @@ static int32_t rewriteShowTableDist(STranslateContext* pCxt, SQuery* pQuery) { SSelectStmt* pStmt = NULL; int32_t code = createSelectStmtForShowTableDist((SShowTableDistributedStmt*)pQuery->pRoot, &pStmt); if (TSDB_CODE_SUCCESS == code) { + NODES_DESTORY_LIST(pStmt->pProjectionList); code = nodesListMakeStrictAppend(&pStmt->pProjectionList, createBlockDistFunc()); } if (TSDB_CODE_SUCCESS == code) { @@ -5335,7 +5362,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau if (code != TSDB_CODE_SUCCESS) { goto end; } - } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL) { + } else if (pVal->node.resType.type != TSDB_DATA_TYPE_NULL && !pVal->isNull) { char* tmpVal = nodesGetValueFromNode(pVal); STagVal val = {.cid = pTagSchema->colId, .type = pTagSchema->type}; if (IS_VAR_DATA_TYPE(pTagSchema->type)) { @@ -5602,8 +5629,8 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS return TSDB_CODE_OUT_OF_MEMORY; } - if (DEAL_RES_ERROR == - translateValueImpl(pCxt, pStmt->pVal, schemaToDataType(pTableMeta->tableInfo.precision, pSchema))) { + SDataType targetDt = schemaToDataType(pTableMeta->tableInfo.precision, pSchema); + if (DEAL_RES_ERROR == translateValueImpl(pCxt, pStmt->pVal, targetDt)) { return pCxt->errCode; } @@ -5612,7 +5639,8 @@ static int32_t buildUpdateTagValReq(STranslateContext* pCxt, SAlterTableStmt* pS } pReq->isNull = (TSDB_DATA_TYPE_NULL == pStmt->pVal->node.resType.type); - if (pStmt->pVal->node.resType.type == TSDB_DATA_TYPE_JSON) { + if (targetDt.type == TSDB_DATA_TYPE_JSON) { + pReq->isNull = 0; if (pStmt->pVal->literal && strlen(pStmt->pVal->literal) > (TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE) { return buildSyntaxErrMsg(&pCxt->msgBuf, "json string too long than 4095", pStmt->pVal->literal); @@ -6011,7 +6039,7 @@ static int32_t setQuery(STranslateContext* pCxt, SQuery* pQuery) { case QUERY_NODE_EXPLAIN_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; pQuery->haveResultSet = true; - pQuery->msgType = TDMT_VND_QUERY; + pQuery->msgType = TDMT_SCH_QUERY; break; case QUERY_NODE_DELETE_STMT: pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 5eb9c72267..e4317d97b0 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 374 +#define YYNOCODE 375 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNodeList* yy24; - SDataType yy48; - bool yy97; - SAlterOption yy189; - int32_t yy244; - EFillMode yy250; - EJoinType yy596; - EOrder yy598; - int8_t yy619; - SNode* yy652; - ENullOrder yy653; - SToken yy657; - EOperatorType yy700; - int64_t yy701; + SDataType yy34; + EJoinType yy162; + EOrder yy188; + SNode* yy212; + SAlterOption yy245; + EOperatorType yy290; + EFillMode yy294; + SToken yy329; + SNodeList* yy424; + ENullOrder yy607; + int64_t yy609; + int32_t yy610; + int8_t yy653; + bool yy737; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -141,15 +141,15 @@ typedef union { #define YYFALLBACK 1 #define YYNSTATE 653 #define YYNRULE 483 -#define YYNTOKEN 250 +#define YYNTOKEN 252 #define YY_MAX_SHIFT 652 -#define YY_MIN_SHIFTREDUCE 953 -#define YY_MAX_SHIFTREDUCE 1435 -#define YY_ERROR_ACTION 1436 -#define YY_ACCEPT_ACTION 1437 -#define YY_NO_ACTION 1438 -#define YY_MIN_REDUCE 1439 -#define YY_MAX_REDUCE 1921 +#define YY_MIN_SHIFTREDUCE 954 +#define YY_MAX_SHIFTREDUCE 1436 +#define YY_ERROR_ACTION 1437 +#define YY_ACCEPT_ACTION 1438 +#define YY_NO_ACTION 1439 +#define YY_MIN_REDUCE 1440 +#define YY_MAX_REDUCE 1922 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,679 +216,677 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2489) +#define YY_ACTTAB_COUNT (2471) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 567, 422, 1437, 423, 1474, 1742, 1673, 430, 317, 423, - /* 10 */ 1474, 111, 39, 37, 1504, 140, 1739, 1451, 460, 69, - /* 20 */ 326, 1440, 1236, 1742, 488, 151, 334, 526, 1573, 1564, - /* 30 */ 1261, 566, 115, 1311, 1739, 1234, 1847, 486, 1612, 484, - /* 40 */ 1739, 1568, 101, 1735, 1741, 100, 99, 98, 97, 96, - /* 50 */ 95, 94, 93, 92, 570, 119, 1306, 1625, 1755, 14, - /* 60 */ 1844, 1735, 1741, 343, 331, 1242, 373, 1735, 1741, 39, - /* 70 */ 37, 1372, 570, 1623, 566, 474, 473, 326, 570, 1236, - /* 80 */ 472, 1847, 1, 116, 469, 553, 1773, 468, 467, 466, - /* 90 */ 1311, 1625, 1234, 329, 529, 117, 1670, 567, 337, 1725, - /* 100 */ 1462, 549, 504, 1899, 649, 1843, 1899, 1623, 111, 528, - /* 110 */ 153, 1840, 1841, 1306, 1845, 465, 14, 156, 1313, 1314, - /* 120 */ 156, 1896, 1242, 1439, 1896, 1573, 1480, 1786, 1135, 1136, - /* 130 */ 88, 1756, 552, 1758, 1759, 548, 42, 570, 78, 2, - /* 140 */ 1832, 1725, 1899, 209, 319, 1828, 152, 110, 109, 108, - /* 150 */ 107, 106, 105, 104, 103, 102, 156, 439, 232, 1566, - /* 160 */ 1896, 649, 1501, 1237, 141, 1235, 505, 1860, 1530, 60, - /* 170 */ 520, 73, 474, 473, 644, 1313, 1314, 472, 1743, 338, - /* 180 */ 116, 469, 1618, 1620, 468, 467, 466, 1240, 1241, 1739, - /* 190 */ 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, - /* 200 */ 1305, 1307, 1308, 1309, 1310, 1312, 1315, 33, 32, 245, - /* 210 */ 246, 40, 38, 36, 35, 34, 1735, 1741, 421, 159, - /* 220 */ 1237, 425, 1235, 626, 625, 624, 341, 570, 623, 622, - /* 230 */ 621, 121, 616, 615, 614, 613, 612, 611, 610, 609, - /* 240 */ 131, 605, 1262, 986, 1240, 1241, 61, 1289, 1290, 1292, - /* 250 */ 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, - /* 260 */ 1309, 1310, 1312, 1315, 39, 37, 566, 1236, 60, 490, - /* 270 */ 304, 1396, 326, 159, 1236, 40, 38, 36, 35, 34, - /* 280 */ 1234, 1261, 1406, 990, 991, 1311, 84, 1234, 1093, 593, - /* 290 */ 592, 591, 1097, 590, 1099, 1100, 589, 1102, 586, 120, - /* 300 */ 1108, 583, 1110, 1111, 580, 577, 159, 1565, 1306, 1899, - /* 310 */ 1242, 14, 512, 1394, 1395, 1397, 1398, 1242, 602, 1551, - /* 320 */ 379, 39, 37, 156, 60, 1755, 604, 1896, 43, 326, - /* 330 */ 1003, 1236, 1002, 1260, 2, 330, 60, 129, 128, 599, - /* 340 */ 598, 597, 1311, 138, 1234, 458, 336, 1259, 372, 649, - /* 350 */ 371, 526, 1575, 1773, 138, 1899, 649, 296, 1549, 339, - /* 360 */ 1004, 550, 244, 1575, 1899, 1306, 1725, 138, 549, 1898, - /* 370 */ 1313, 1314, 231, 1896, 1242, 1899, 1575, 439, 157, 119, - /* 380 */ 33, 32, 1896, 530, 40, 38, 36, 35, 34, 1897, - /* 390 */ 1379, 8, 567, 1896, 1786, 1663, 1260, 87, 1756, 552, - /* 400 */ 1758, 1759, 548, 161, 570, 159, 168, 1832, 1237, 364, - /* 410 */ 1235, 298, 1828, 649, 1773, 1237, 604, 1235, 515, 117, - /* 420 */ 1573, 83, 519, 1899, 1218, 1219, 1242, 1313, 1314, 366, - /* 430 */ 362, 80, 1240, 1241, 154, 1840, 1841, 158, 1845, 1240, - /* 440 */ 1241, 1896, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, - /* 450 */ 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 101, - /* 460 */ 518, 159, 100, 99, 98, 97, 96, 95, 94, 93, - /* 470 */ 92, 427, 1237, 159, 1235, 33, 32, 1258, 26, 40, - /* 480 */ 38, 36, 35, 34, 33, 32, 412, 1321, 40, 38, - /* 490 */ 36, 35, 34, 1260, 521, 516, 1240, 1241, 596, 1289, - /* 500 */ 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, 1304, 1305, - /* 510 */ 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, 1316, 567, - /* 520 */ 202, 30, 240, 567, 326, 607, 1236, 1432, 159, 1461, - /* 530 */ 377, 1460, 170, 169, 378, 1745, 1003, 1311, 1002, 1234, - /* 540 */ 497, 1459, 28, 36, 35, 34, 7, 1573, 33, 32, - /* 550 */ 1386, 1573, 40, 38, 36, 35, 34, 33, 32, 1755, - /* 560 */ 1306, 40, 38, 36, 35, 34, 1004, 1291, 1458, 1242, - /* 570 */ 1725, 1747, 1725, 39, 37, 1755, 1619, 1620, 479, 71, - /* 580 */ 304, 326, 1725, 1236, 33, 32, 9, 1773, 40, 38, - /* 590 */ 36, 35, 34, 489, 1311, 550, 1234, 138, 69, 567, - /* 600 */ 1725, 567, 549, 1773, 11, 10, 1576, 201, 649, 1725, - /* 610 */ 382, 529, 397, 1431, 166, 1457, 1725, 1306, 549, 22, - /* 620 */ 1569, 482, 1313, 1314, 1550, 476, 1242, 1573, 1786, 1573, - /* 630 */ 200, 89, 1756, 552, 1758, 1759, 548, 429, 570, 67, - /* 640 */ 425, 1832, 66, 9, 1786, 1831, 1828, 88, 1756, 552, - /* 650 */ 1758, 1759, 548, 1055, 570, 55, 1725, 1832, 54, 526, - /* 660 */ 1562, 319, 1828, 152, 1291, 649, 1335, 1237, 1558, 1235, - /* 670 */ 33, 32, 1456, 1455, 40, 38, 36, 35, 34, 1313, - /* 680 */ 1314, 1548, 600, 1057, 1861, 1616, 1347, 119, 1454, 1340, - /* 690 */ 1453, 1240, 1241, 1450, 1289, 1290, 1292, 1293, 1294, 1295, - /* 700 */ 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, 1310, 1312, - /* 710 */ 1315, 471, 470, 1725, 1725, 33, 32, 1371, 602, 40, - /* 720 */ 38, 36, 35, 34, 1237, 1367, 1235, 117, 27, 1725, - /* 730 */ 1449, 1725, 1448, 1447, 1725, 310, 1446, 129, 128, 599, - /* 740 */ 598, 597, 155, 1840, 1841, 1274, 1845, 1669, 1240, 1241, - /* 750 */ 305, 1289, 1290, 1292, 1293, 1294, 1295, 1296, 545, 568, - /* 760 */ 1304, 1305, 1307, 1308, 1309, 1310, 1312, 1315, 39, 37, - /* 770 */ 295, 1725, 1258, 1725, 1725, 602, 326, 1725, 1236, 405, - /* 780 */ 464, 1847, 417, 311, 1445, 309, 308, 1668, 462, 1311, - /* 790 */ 305, 1234, 464, 1263, 129, 128, 599, 598, 597, 390, - /* 800 */ 58, 418, 463, 392, 567, 1842, 620, 618, 553, 567, - /* 810 */ 1260, 567, 1306, 567, 463, 398, 567, 1444, 567, 1671, - /* 820 */ 438, 1242, 1570, 1713, 1702, 1725, 1443, 498, 1755, 502, - /* 830 */ 534, 567, 1573, 383, 1625, 990, 991, 1573, 2, 1573, - /* 840 */ 267, 1573, 564, 1603, 1573, 537, 1573, 33, 32, 1560, - /* 850 */ 1624, 40, 38, 36, 35, 34, 1773, 137, 1725, 1573, - /* 860 */ 649, 608, 601, 1545, 550, 1616, 1556, 1725, 1442, 1725, - /* 870 */ 352, 549, 1491, 416, 1313, 1314, 411, 410, 409, 408, - /* 880 */ 407, 404, 403, 402, 401, 400, 396, 395, 394, 393, - /* 890 */ 387, 386, 385, 384, 475, 381, 380, 1786, 299, 1245, - /* 900 */ 88, 1756, 552, 1758, 1759, 548, 567, 570, 208, 1725, - /* 910 */ 1832, 1852, 1367, 1486, 319, 1828, 1912, 565, 188, 1237, - /* 920 */ 205, 1235, 1274, 212, 544, 1867, 193, 619, 195, 191, - /* 930 */ 1333, 194, 144, 1370, 1573, 477, 72, 456, 452, 448, - /* 940 */ 444, 187, 197, 1240, 1241, 196, 1289, 1290, 1292, 1293, - /* 950 */ 1294, 1295, 1296, 545, 568, 1304, 1305, 1307, 1308, 1309, - /* 960 */ 1310, 1312, 1315, 139, 567, 567, 70, 367, 273, 185, - /* 970 */ 52, 501, 595, 50, 199, 256, 340, 198, 1484, 542, - /* 980 */ 216, 1291, 271, 57, 1334, 1452, 56, 1531, 11, 10, - /* 990 */ 513, 235, 1573, 1573, 1434, 1435, 41, 41, 457, 41, - /* 1000 */ 480, 242, 171, 123, 126, 127, 491, 1339, 223, 1244, - /* 1010 */ 1027, 33, 32, 1393, 1774, 40, 38, 36, 35, 34, - /* 1020 */ 218, 342, 1475, 50, 575, 535, 126, 60, 127, 1248, - /* 1030 */ 526, 184, 177, 532, 182, 1613, 1341, 1297, 435, 1186, - /* 1040 */ 1028, 247, 538, 559, 253, 1086, 29, 324, 1328, 1329, - /* 1050 */ 1330, 1331, 1332, 1336, 1337, 1338, 112, 175, 119, 126, - /* 1060 */ 527, 1863, 299, 266, 1114, 86, 1118, 234, 1125, 5, - /* 1070 */ 3, 237, 239, 344, 1258, 347, 351, 306, 1055, 307, - /* 1080 */ 530, 263, 1202, 399, 167, 1665, 406, 414, 413, 419, - /* 1090 */ 1264, 415, 420, 428, 1333, 1267, 1123, 431, 117, 130, - /* 1100 */ 64, 63, 376, 432, 1266, 165, 174, 1325, 1755, 176, - /* 1110 */ 433, 370, 1268, 229, 1840, 525, 434, 524, 179, 436, - /* 1120 */ 1899, 1265, 294, 181, 183, 360, 68, 358, 354, 350, - /* 1130 */ 162, 345, 437, 186, 158, 440, 1773, 459, 1896, 1247, - /* 1140 */ 1707, 461, 91, 1563, 550, 297, 190, 1559, 1334, 1725, - /* 1150 */ 192, 549, 132, 264, 133, 203, 1561, 492, 1557, 134, - /* 1160 */ 135, 1755, 206, 493, 159, 499, 530, 503, 210, 1263, - /* 1170 */ 514, 1339, 1874, 316, 1864, 556, 496, 1786, 1873, 6, - /* 1180 */ 87, 1756, 552, 1758, 1759, 548, 1854, 570, 509, 1773, - /* 1190 */ 1832, 214, 511, 523, 298, 1828, 217, 550, 510, 508, - /* 1200 */ 146, 318, 1725, 1755, 549, 517, 1899, 224, 222, 225, - /* 1210 */ 29, 324, 1328, 1329, 1330, 1331, 1332, 1336, 1337, 1338, - /* 1220 */ 156, 507, 227, 1367, 1896, 118, 1262, 44, 539, 536, - /* 1230 */ 1786, 1773, 1848, 88, 1756, 552, 1758, 1759, 548, 550, - /* 1240 */ 570, 226, 228, 1832, 1725, 18, 549, 319, 1828, 1912, - /* 1250 */ 333, 332, 320, 1813, 560, 561, 1915, 1895, 1890, 249, - /* 1260 */ 1250, 533, 233, 236, 124, 540, 554, 555, 238, 125, - /* 1270 */ 1706, 1311, 1786, 1243, 251, 88, 1756, 552, 1758, 1759, - /* 1280 */ 548, 1755, 570, 265, 1675, 1832, 562, 557, 328, 319, - /* 1290 */ 1828, 1912, 79, 77, 1306, 1617, 1574, 573, 1546, 268, - /* 1300 */ 1851, 645, 646, 1242, 259, 648, 145, 289, 1755, 1773, - /* 1310 */ 51, 291, 290, 270, 272, 1719, 1718, 550, 62, 1717, - /* 1320 */ 1714, 346, 1725, 348, 549, 349, 1229, 1230, 163, 353, - /* 1330 */ 1712, 355, 356, 357, 1711, 359, 1773, 1710, 361, 530, - /* 1340 */ 1709, 1708, 571, 363, 550, 365, 1692, 368, 164, 1725, - /* 1350 */ 1786, 549, 1205, 280, 1756, 552, 1758, 1759, 548, 369, - /* 1360 */ 570, 1204, 1686, 1685, 374, 375, 530, 1684, 1683, 1174, - /* 1370 */ 1658, 1657, 1656, 65, 1655, 1654, 1755, 1786, 1653, 1899, - /* 1380 */ 280, 1756, 552, 1758, 1759, 548, 1652, 570, 1651, 388, - /* 1390 */ 389, 1650, 391, 158, 1649, 1648, 1647, 1896, 1646, 1645, - /* 1400 */ 1644, 1251, 1643, 1246, 1773, 1176, 1899, 1642, 1641, 1640, - /* 1410 */ 1639, 1638, 550, 1637, 1636, 122, 1635, 1725, 1755, 549, - /* 1420 */ 156, 1634, 1633, 1632, 1896, 1254, 1631, 1630, 1629, 1628, - /* 1430 */ 1627, 1626, 1503, 1471, 172, 424, 568, 1304, 1305, 1307, - /* 1440 */ 1308, 1309, 1310, 1755, 150, 1786, 1773, 1021, 89, 1756, - /* 1450 */ 552, 1758, 1759, 548, 547, 570, 113, 993, 1832, 1725, - /* 1460 */ 992, 549, 541, 1828, 426, 1470, 1700, 1694, 1682, 1681, - /* 1470 */ 1667, 1773, 180, 1552, 173, 114, 178, 1502, 1500, 550, - /* 1480 */ 526, 443, 442, 441, 1725, 1498, 549, 1786, 445, 447, - /* 1490 */ 287, 1756, 552, 1758, 1759, 548, 546, 570, 543, 1804, - /* 1500 */ 1755, 446, 1496, 450, 1494, 454, 449, 1483, 119, 453, - /* 1510 */ 1482, 451, 1786, 189, 455, 142, 1756, 552, 1758, 1759, - /* 1520 */ 548, 1467, 570, 1554, 1129, 1128, 1553, 1054, 1773, 49, - /* 1530 */ 530, 1053, 1052, 1051, 617, 1048, 550, 619, 1492, 312, - /* 1540 */ 1047, 1725, 1487, 549, 1046, 1485, 313, 314, 117, 481, - /* 1550 */ 478, 1466, 1465, 483, 485, 1464, 487, 1755, 1699, 90, - /* 1560 */ 531, 1913, 53, 229, 1840, 525, 1212, 524, 1693, 1786, - /* 1570 */ 1899, 494, 89, 1756, 552, 1758, 1759, 548, 1755, 570, - /* 1580 */ 1680, 1678, 1832, 1679, 156, 1773, 207, 1829, 1896, 136, - /* 1590 */ 495, 315, 1677, 550, 1676, 1408, 500, 4, 1725, 41, - /* 1600 */ 549, 45, 15, 215, 23, 47, 1773, 220, 25, 213, - /* 1610 */ 46, 1392, 506, 1385, 550, 143, 16, 219, 24, 1725, - /* 1620 */ 221, 549, 1745, 74, 230, 147, 1786, 1364, 17, 288, - /* 1630 */ 1756, 552, 1758, 1759, 548, 1755, 570, 1420, 13, 1419, - /* 1640 */ 1363, 321, 1425, 1414, 1424, 1423, 322, 1786, 10, 1326, - /* 1650 */ 283, 1756, 552, 1758, 1759, 548, 19, 570, 1755, 1282, - /* 1660 */ 1299, 148, 160, 1773, 31, 551, 1674, 1298, 12, 20, - /* 1670 */ 21, 550, 241, 1390, 1666, 243, 1725, 248, 549, 75, - /* 1680 */ 558, 250, 76, 252, 1744, 255, 1773, 1789, 80, 522, - /* 1690 */ 1301, 1252, 572, 574, 550, 1115, 569, 335, 578, 1725, - /* 1700 */ 1755, 549, 48, 576, 1786, 1112, 579, 142, 1756, 552, - /* 1710 */ 1758, 1759, 548, 323, 570, 1109, 1755, 581, 582, 584, - /* 1720 */ 587, 1092, 594, 1103, 1101, 585, 588, 1786, 1773, 1107, - /* 1730 */ 288, 1756, 552, 1758, 1759, 548, 547, 570, 81, 1106, - /* 1740 */ 1105, 1725, 82, 549, 1773, 1124, 59, 257, 1120, 1019, - /* 1750 */ 603, 1104, 550, 1914, 1043, 606, 258, 1725, 1061, 549, - /* 1760 */ 1041, 1036, 1040, 1039, 1038, 1037, 1755, 1035, 1034, 1786, - /* 1770 */ 1058, 325, 287, 1756, 552, 1758, 1759, 548, 1056, 570, - /* 1780 */ 1031, 1805, 1030, 1029, 1026, 1786, 1025, 1024, 288, 1756, - /* 1790 */ 552, 1758, 1759, 548, 1773, 570, 652, 1499, 627, 629, - /* 1800 */ 628, 1497, 550, 631, 632, 633, 1495, 1725, 635, 549, - /* 1810 */ 262, 636, 1493, 637, 639, 641, 640, 1481, 643, 983, - /* 1820 */ 1463, 327, 261, 1755, 149, 647, 1438, 1238, 650, 642, - /* 1830 */ 638, 634, 630, 260, 1438, 1786, 269, 1438, 288, 1756, - /* 1840 */ 552, 1758, 1759, 548, 651, 570, 1438, 1438, 1438, 1438, - /* 1850 */ 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 85, 550, - /* 1860 */ 1438, 254, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 1870 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1880 */ 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1438, - /* 1890 */ 1438, 1438, 1786, 1438, 563, 274, 1756, 552, 1758, 1759, - /* 1900 */ 548, 1755, 570, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1910 */ 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 1920 */ 550, 1438, 1438, 1438, 1438, 1725, 211, 549, 1438, 1773, - /* 1930 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, - /* 1940 */ 1438, 1438, 1725, 1755, 549, 1438, 1438, 1210, 1438, 204, - /* 1950 */ 1438, 1438, 1438, 1786, 1755, 1438, 275, 1756, 552, 1758, - /* 1960 */ 1759, 548, 1438, 570, 1438, 1755, 1438, 1438, 1438, 1438, - /* 1970 */ 1786, 1773, 1438, 276, 1756, 552, 1758, 1759, 548, 550, - /* 1980 */ 570, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 1990 */ 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, 1438, - /* 2000 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, - /* 2010 */ 1438, 1438, 1786, 1438, 1438, 282, 1756, 552, 1758, 1759, - /* 2020 */ 548, 1438, 570, 1786, 1438, 1755, 284, 1756, 552, 1758, - /* 2030 */ 1759, 548, 1438, 570, 1786, 1773, 1438, 277, 1756, 552, - /* 2040 */ 1758, 1759, 548, 550, 570, 1438, 1438, 1438, 1725, 1755, - /* 2050 */ 549, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2060 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, - /* 2070 */ 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1773, 1438, 285, - /* 2080 */ 1756, 552, 1758, 1759, 548, 550, 570, 1438, 1438, 1438, - /* 2090 */ 1725, 1438, 549, 1438, 1786, 1438, 1438, 278, 1756, 552, - /* 2100 */ 1758, 1759, 548, 1438, 570, 1755, 1438, 1438, 1438, 1438, - /* 2110 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1786, 1438, - /* 2120 */ 1438, 286, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2130 */ 1438, 1438, 1438, 1773, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2140 */ 1438, 550, 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, - /* 2150 */ 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, - /* 2160 */ 1438, 1438, 1438, 1438, 1438, 1438, 1755, 1438, 1438, 1438, - /* 2170 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 279, 1756, 552, - /* 2180 */ 1758, 1759, 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, - /* 2190 */ 1438, 550, 1438, 1438, 1773, 1438, 1725, 1438, 549, 1438, - /* 2200 */ 1438, 1438, 550, 1438, 1438, 1438, 1438, 1725, 1755, 549, - /* 2210 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, - /* 2220 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 292, 1756, 552, - /* 2230 */ 1758, 1759, 548, 1755, 570, 1786, 1773, 1438, 293, 1756, - /* 2240 */ 552, 1758, 1759, 548, 550, 570, 1438, 1773, 1438, 1725, - /* 2250 */ 1438, 549, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2260 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2270 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1786, 1438, 1438, - /* 2280 */ 1767, 1756, 552, 1758, 1759, 548, 1438, 570, 1786, 1755, - /* 2290 */ 1438, 1766, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2300 */ 1438, 1438, 1786, 1755, 1438, 1765, 1756, 552, 1758, 1759, - /* 2310 */ 548, 1438, 570, 1438, 1438, 1438, 1438, 1773, 1438, 1438, - /* 2320 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2330 */ 1725, 1773, 549, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2340 */ 1438, 1438, 1438, 1438, 1725, 1438, 549, 1438, 1438, 1438, - /* 2350 */ 1438, 1438, 1438, 1755, 1438, 1438, 1438, 1438, 1786, 1438, - /* 2360 */ 1438, 302, 1756, 552, 1758, 1759, 548, 1438, 570, 1438, - /* 2370 */ 1438, 1438, 1786, 1438, 1438, 301, 1756, 552, 1758, 1759, - /* 2380 */ 548, 1773, 570, 1438, 1438, 1438, 1438, 1438, 1438, 550, - /* 2390 */ 1438, 1438, 1438, 1438, 1725, 1755, 549, 1438, 1438, 1438, - /* 2400 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1755, - /* 2410 */ 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2420 */ 1438, 1438, 1786, 1773, 1438, 303, 1756, 552, 1758, 1759, - /* 2430 */ 548, 550, 570, 1438, 1438, 1438, 1725, 1773, 549, 1438, - /* 2440 */ 1438, 1438, 1438, 1438, 1438, 550, 1438, 1438, 1438, 1438, - /* 2450 */ 1725, 1438, 549, 1438, 1438, 1438, 1438, 1438, 1438, 1438, - /* 2460 */ 1438, 1438, 1438, 1438, 1786, 1438, 1438, 300, 1756, 552, - /* 2470 */ 1758, 1759, 548, 1438, 570, 1438, 1438, 1438, 1786, 1438, - /* 2480 */ 1438, 281, 1756, 552, 1758, 1759, 548, 1438, 570, + /* 0 */ 422, 1670, 423, 1475, 294, 1744, 1438, 430, 317, 423, + /* 10 */ 1475, 1563, 39, 37, 1505, 338, 1741, 69, 1619, 1621, + /* 20 */ 326, 1441, 1238, 1744, 1900, 1565, 334, 525, 373, 379, + /* 30 */ 115, 1674, 1775, 1313, 1741, 1236, 1741, 1899, 1552, 1569, + /* 40 */ 518, 1897, 101, 1737, 1743, 100, 99, 98, 97, 96, + /* 50 */ 95, 94, 93, 92, 570, 119, 1308, 987, 1757, 14, + /* 60 */ 61, 1737, 1743, 1737, 1743, 1244, 297, 343, 1900, 39, + /* 70 */ 37, 1376, 570, 439, 570, 474, 473, 326, 517, 1238, + /* 80 */ 472, 157, 1, 116, 469, 1897, 1775, 468, 467, 466, + /* 90 */ 1313, 1004, 1236, 1003, 528, 117, 439, 991, 992, 1727, + /* 100 */ 479, 548, 1380, 310, 649, 566, 458, 1900, 1262, 527, + /* 110 */ 153, 1842, 1843, 1308, 1847, 489, 14, 552, 1315, 1316, + /* 120 */ 157, 1005, 1244, 1550, 1897, 329, 412, 1788, 1671, 202, + /* 130 */ 88, 1758, 551, 1760, 1761, 547, 60, 570, 60, 2, + /* 140 */ 1834, 525, 210, 482, 319, 1830, 152, 476, 30, 240, + /* 150 */ 652, 311, 201, 309, 308, 140, 462, 1452, 156, 421, + /* 160 */ 464, 649, 425, 1239, 262, 1237, 1860, 43, 60, 119, + /* 170 */ 73, 330, 171, 170, 566, 1315, 1316, 55, 149, 138, + /* 180 */ 54, 604, 463, 642, 638, 634, 630, 260, 1576, 1242, + /* 190 */ 1243, 519, 1291, 1292, 1294, 1295, 1296, 1297, 1298, 544, + /* 200 */ 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, 117, + /* 210 */ 1263, 1669, 85, 1323, 294, 254, 372, 167, 371, 1262, + /* 220 */ 1239, 160, 1237, 427, 154, 1842, 1843, 1900, 1847, 1260, + /* 230 */ 1745, 33, 32, 504, 1263, 40, 38, 36, 35, 34, + /* 240 */ 158, 1741, 67, 525, 1897, 66, 1242, 1243, 563, 1291, + /* 250 */ 1292, 1294, 1295, 1296, 1297, 1298, 544, 568, 1306, 1307, + /* 260 */ 1309, 1310, 1311, 1312, 1314, 1317, 39, 37, 1737, 1743, + /* 270 */ 488, 119, 490, 1900, 326, 160, 1238, 160, 69, 570, + /* 280 */ 212, 1293, 300, 486, 60, 484, 157, 1313, 101, 1236, + /* 290 */ 1897, 100, 99, 98, 97, 96, 95, 94, 93, 92, + /* 300 */ 1570, 1211, 151, 205, 1900, 552, 1276, 160, 1136, 1137, + /* 310 */ 1308, 117, 1900, 14, 1335, 1613, 1672, 1898, 1262, 1244, + /* 320 */ 602, 1897, 566, 39, 37, 157, 155, 1842, 1843, 1897, + /* 330 */ 1847, 326, 604, 1238, 1502, 1004, 2, 1003, 1261, 129, + /* 340 */ 128, 599, 598, 597, 1313, 78, 1236, 1094, 593, 592, + /* 350 */ 591, 1098, 590, 1100, 1101, 589, 1103, 586, 649, 1109, + /* 360 */ 583, 1111, 1112, 580, 577, 1005, 1567, 1308, 1336, 36, + /* 370 */ 35, 34, 1315, 1316, 1664, 1463, 1244, 40, 38, 36, + /* 380 */ 35, 34, 33, 32, 42, 169, 40, 38, 36, 35, + /* 390 */ 34, 1341, 1293, 8, 541, 626, 625, 624, 341, 596, + /* 400 */ 623, 622, 621, 121, 616, 615, 614, 613, 612, 611, + /* 410 */ 610, 609, 131, 605, 141, 649, 1727, 1239, 1531, 1237, + /* 420 */ 33, 32, 1397, 160, 40, 38, 36, 35, 34, 1315, + /* 430 */ 1316, 1551, 29, 324, 1330, 1331, 1332, 1333, 1334, 1338, + /* 440 */ 1339, 1340, 600, 1242, 1243, 1617, 1291, 1292, 1294, 1295, + /* 450 */ 1296, 1297, 1298, 544, 568, 1306, 1307, 1309, 1310, 1311, + /* 460 */ 1312, 1314, 1317, 511, 1395, 1396, 1398, 1399, 1056, 567, + /* 470 */ 474, 473, 138, 1337, 1239, 472, 1237, 1264, 116, 469, + /* 480 */ 111, 1577, 468, 467, 466, 33, 32, 460, 1244, 40, + /* 490 */ 38, 36, 35, 34, 607, 1407, 1342, 1574, 1058, 1462, + /* 500 */ 1242, 1243, 203, 1291, 1292, 1294, 1295, 1296, 1297, 1298, + /* 510 */ 544, 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, 1317, + /* 520 */ 39, 37, 1318, 160, 1327, 602, 1620, 1621, 326, 1433, + /* 530 */ 1238, 567, 160, 471, 470, 189, 300, 27, 245, 246, + /* 540 */ 1727, 1313, 162, 1236, 129, 128, 599, 598, 597, 144, + /* 550 */ 1559, 525, 567, 1626, 456, 452, 448, 444, 188, 1574, + /* 560 */ 331, 71, 305, 111, 1308, 556, 1265, 336, 1335, 1624, + /* 570 */ 465, 11, 10, 1244, 339, 138, 497, 39, 37, 119, + /* 580 */ 1574, 1561, 138, 70, 1576, 326, 186, 1238, 33, 32, + /* 590 */ 9, 1576, 40, 38, 36, 35, 34, 84, 1313, 305, + /* 600 */ 1236, 529, 556, 1757, 567, 567, 464, 232, 1626, 1461, + /* 610 */ 120, 1460, 649, 1626, 567, 377, 378, 1432, 1566, 117, + /* 620 */ 337, 1308, 1336, 22, 1625, 382, 1315, 1316, 463, 1624, + /* 630 */ 1244, 1775, 1574, 1574, 230, 1842, 524, 1262, 523, 549, + /* 640 */ 1459, 1900, 1574, 364, 1727, 1341, 548, 9, 185, 178, + /* 650 */ 1727, 183, 1727, 1349, 159, 435, 33, 32, 1897, 514, + /* 660 */ 40, 38, 36, 35, 34, 366, 362, 429, 58, 649, + /* 670 */ 425, 1239, 1788, 1237, 176, 142, 1758, 551, 1760, 1761, + /* 680 */ 547, 1727, 570, 1315, 1316, 1549, 29, 324, 1330, 1331, + /* 690 */ 1332, 1333, 1334, 1338, 1339, 1340, 213, 1242, 1243, 1458, + /* 700 */ 1291, 1292, 1294, 1295, 1296, 1297, 1298, 544, 568, 1306, + /* 710 */ 1307, 1309, 1310, 1311, 1312, 1314, 1317, 1440, 267, 530, + /* 720 */ 1914, 1604, 567, 567, 567, 620, 618, 1557, 1239, 601, + /* 730 */ 1237, 1387, 1617, 397, 398, 438, 206, 520, 515, 1715, + /* 740 */ 1727, 110, 109, 108, 107, 106, 105, 104, 103, 102, + /* 750 */ 1574, 1574, 1574, 525, 1242, 1243, 543, 1291, 1292, 1294, + /* 760 */ 1295, 1296, 1297, 1298, 544, 568, 1306, 1307, 1309, 1310, + /* 770 */ 1311, 1312, 1314, 1317, 39, 37, 296, 1238, 1260, 602, + /* 780 */ 567, 119, 326, 567, 1238, 405, 352, 1457, 417, 1849, + /* 790 */ 1236, 1571, 1849, 595, 1703, 1313, 1373, 1236, 129, 128, + /* 800 */ 599, 598, 597, 529, 1456, 390, 567, 418, 1574, 392, + /* 810 */ 1293, 1574, 244, 1846, 991, 992, 1845, 498, 1308, 1453, + /* 820 */ 1244, 117, 567, 7, 1455, 1849, 1532, 1244, 1727, 1854, + /* 830 */ 1369, 1454, 194, 502, 1574, 192, 230, 1842, 524, 383, + /* 840 */ 523, 26, 235, 1900, 2, 1727, 533, 33, 32, 1844, + /* 850 */ 1574, 40, 38, 36, 35, 34, 157, 28, 512, 649, + /* 860 */ 1897, 44, 4, 33, 32, 1727, 649, 40, 38, 36, + /* 870 */ 35, 34, 1727, 457, 1219, 1220, 1451, 52, 501, 416, + /* 880 */ 1315, 1316, 411, 410, 409, 408, 407, 404, 403, 402, + /* 890 */ 401, 400, 396, 395, 394, 393, 387, 386, 385, 384, + /* 900 */ 1492, 381, 380, 531, 196, 567, 1450, 195, 567, 139, + /* 910 */ 536, 608, 1449, 1546, 273, 491, 564, 1727, 1239, 565, + /* 920 */ 1237, 198, 475, 200, 197, 1239, 199, 1237, 271, 57, + /* 930 */ 11, 10, 56, 1574, 33, 32, 1574, 1448, 40, 38, + /* 940 */ 36, 35, 34, 1757, 1242, 1243, 1447, 1727, 172, 1446, + /* 950 */ 1445, 1242, 1243, 1727, 1291, 1292, 1294, 1295, 1296, 1297, + /* 960 */ 1298, 544, 568, 1306, 1307, 1309, 1310, 1311, 1312, 1314, + /* 970 */ 1317, 1775, 567, 60, 567, 1435, 1436, 209, 1727, 549, + /* 980 */ 1444, 1487, 224, 256, 1727, 340, 548, 1727, 33, 32, + /* 990 */ 1727, 1727, 40, 38, 36, 35, 34, 1443, 1776, 619, + /* 1000 */ 1574, 529, 1574, 477, 1369, 72, 1747, 1247, 1246, 1276, + /* 1010 */ 50, 86, 1788, 217, 1372, 87, 1758, 551, 1760, 1761, + /* 1020 */ 547, 1727, 570, 1485, 1757, 1834, 1476, 33, 32, 299, + /* 1030 */ 1830, 40, 38, 36, 35, 34, 1481, 342, 1727, 367, + /* 1040 */ 1614, 1900, 1749, 534, 1757, 480, 64, 63, 376, 41, + /* 1050 */ 1394, 166, 1775, 219, 159, 41, 83, 370, 1897, 1864, + /* 1060 */ 549, 1028, 229, 526, 41, 1727, 80, 548, 242, 234, + /* 1070 */ 295, 237, 1775, 360, 123, 358, 354, 350, 163, 345, + /* 1080 */ 528, 239, 529, 3, 644, 1727, 5, 548, 126, 1343, + /* 1090 */ 344, 1029, 1260, 1788, 127, 1299, 87, 1758, 551, 1760, + /* 1100 */ 1761, 547, 50, 570, 1187, 347, 1834, 351, 247, 537, + /* 1110 */ 299, 1830, 160, 1788, 559, 306, 88, 1758, 551, 1760, + /* 1120 */ 1761, 547, 1900, 570, 1056, 307, 1834, 1203, 253, 263, + /* 1130 */ 319, 1830, 152, 575, 1087, 157, 1757, 1250, 1249, 1897, + /* 1140 */ 126, 127, 266, 112, 126, 399, 1666, 168, 406, 414, + /* 1150 */ 413, 415, 1861, 419, 1266, 420, 428, 1269, 432, 431, + /* 1160 */ 175, 177, 1268, 433, 1775, 1270, 434, 1267, 180, 137, + /* 1170 */ 436, 182, 549, 1115, 437, 184, 68, 1727, 440, 548, + /* 1180 */ 1119, 1126, 459, 1124, 130, 187, 461, 91, 1564, 191, + /* 1190 */ 1560, 298, 1708, 193, 132, 133, 1562, 1558, 264, 1757, + /* 1200 */ 134, 204, 135, 492, 493, 1788, 207, 316, 88, 1758, + /* 1210 */ 551, 1760, 1761, 547, 496, 570, 499, 503, 1834, 1265, + /* 1220 */ 211, 513, 319, 1830, 1913, 1875, 1757, 1775, 1865, 508, + /* 1230 */ 555, 510, 1874, 1868, 215, 549, 333, 332, 218, 318, + /* 1240 */ 1727, 516, 548, 6, 509, 522, 1252, 1856, 223, 507, + /* 1250 */ 228, 146, 506, 1369, 1775, 225, 118, 1313, 1264, 1245, + /* 1260 */ 320, 538, 549, 1850, 18, 124, 535, 1727, 1788, 548, + /* 1270 */ 125, 88, 1758, 551, 1760, 1761, 547, 226, 570, 227, + /* 1280 */ 1308, 1834, 553, 554, 1707, 319, 1830, 1913, 1815, 1244, + /* 1290 */ 1676, 1896, 557, 328, 561, 1788, 1891, 1757, 88, 1758, + /* 1300 */ 551, 1760, 1761, 547, 1916, 570, 532, 233, 1834, 539, + /* 1310 */ 236, 560, 319, 1830, 1913, 238, 265, 251, 562, 77, + /* 1320 */ 249, 1575, 79, 1853, 268, 1775, 573, 259, 571, 1547, + /* 1330 */ 1618, 645, 646, 549, 648, 145, 270, 272, 1727, 1721, + /* 1340 */ 548, 289, 291, 290, 1720, 62, 1719, 346, 1716, 348, + /* 1350 */ 349, 51, 1231, 1232, 164, 529, 353, 1714, 355, 356, + /* 1360 */ 357, 1713, 1757, 359, 1712, 361, 1788, 1711, 1710, 280, + /* 1370 */ 1758, 551, 1760, 1761, 547, 363, 570, 365, 1693, 165, + /* 1380 */ 368, 369, 1206, 1205, 1687, 1686, 374, 1253, 375, 1248, + /* 1390 */ 1775, 1685, 1684, 1175, 1659, 1900, 1658, 1657, 549, 65, + /* 1400 */ 1656, 1655, 1654, 1727, 1653, 548, 1652, 388, 159, 389, + /* 1410 */ 1651, 1650, 1897, 1256, 391, 1649, 1648, 1647, 1646, 1645, + /* 1420 */ 529, 1644, 1643, 1642, 568, 1306, 1307, 1309, 1310, 1311, + /* 1430 */ 1312, 1788, 1641, 1757, 280, 1758, 551, 1760, 1761, 547, + /* 1440 */ 1640, 570, 1639, 1638, 1637, 122, 1636, 1635, 1634, 1633, + /* 1450 */ 1632, 1631, 1177, 1630, 1629, 1757, 173, 49, 424, 113, + /* 1460 */ 1900, 1775, 1628, 1627, 1504, 1472, 994, 150, 1471, 549, + /* 1470 */ 114, 993, 426, 157, 1727, 174, 548, 1897, 1701, 1695, + /* 1480 */ 1683, 181, 1682, 1775, 179, 1668, 1553, 1022, 1503, 1501, + /* 1490 */ 441, 549, 1499, 1497, 445, 1495, 1727, 1484, 548, 443, + /* 1500 */ 447, 1483, 1788, 1468, 449, 89, 1758, 551, 1760, 1761, + /* 1510 */ 547, 451, 570, 442, 446, 1834, 453, 450, 1757, 1833, + /* 1520 */ 1830, 454, 455, 1555, 1788, 190, 1130, 89, 1758, 551, + /* 1530 */ 1760, 1761, 547, 1129, 570, 1554, 1757, 1834, 1493, 1055, + /* 1540 */ 1054, 540, 1830, 1053, 1052, 617, 1775, 1049, 1048, 619, + /* 1550 */ 1047, 312, 1488, 313, 546, 1486, 478, 481, 314, 1727, + /* 1560 */ 1467, 548, 483, 1466, 1775, 485, 1465, 487, 90, 1700, + /* 1570 */ 1694, 494, 549, 1681, 1213, 53, 136, 1727, 495, 548, + /* 1580 */ 208, 1679, 1680, 1678, 315, 1677, 41, 1788, 15, 1757, + /* 1590 */ 287, 1758, 551, 1760, 1761, 547, 545, 570, 542, 1806, + /* 1600 */ 23, 47, 221, 1409, 216, 1788, 214, 143, 89, 1758, + /* 1610 */ 551, 1760, 1761, 547, 220, 570, 1393, 1775, 1834, 24, + /* 1620 */ 222, 1747, 74, 1831, 1386, 549, 231, 500, 45, 25, + /* 1630 */ 1727, 46, 548, 16, 1366, 147, 1365, 1426, 17, 1415, + /* 1640 */ 1421, 1420, 321, 1757, 505, 10, 1425, 1424, 322, 148, + /* 1650 */ 1301, 19, 1284, 31, 1757, 1300, 1675, 1667, 1788, 12, + /* 1660 */ 1328, 288, 1758, 551, 1760, 1761, 547, 161, 570, 20, + /* 1670 */ 250, 1775, 21, 1746, 241, 550, 1391, 1223, 243, 549, + /* 1680 */ 248, 255, 1775, 13, 1727, 1303, 548, 1254, 574, 80, + /* 1690 */ 549, 75, 558, 252, 572, 1727, 76, 548, 1791, 569, + /* 1700 */ 48, 1093, 1116, 335, 576, 578, 1113, 579, 581, 1110, + /* 1710 */ 582, 1757, 1788, 584, 585, 283, 1758, 551, 1760, 1761, + /* 1720 */ 547, 1104, 570, 1788, 1102, 587, 142, 1758, 551, 1760, + /* 1730 */ 1761, 547, 1757, 570, 588, 1108, 594, 81, 1125, 1775, + /* 1740 */ 1107, 82, 1106, 1105, 59, 257, 1121, 549, 1020, 1044, + /* 1750 */ 1062, 603, 1727, 521, 548, 606, 258, 1042, 1041, 1037, + /* 1760 */ 1775, 1040, 1039, 1038, 1036, 1035, 323, 1057, 546, 1059, + /* 1770 */ 1032, 1915, 1500, 1727, 1757, 548, 1031, 1030, 1027, 1026, + /* 1780 */ 1788, 1025, 627, 288, 1758, 551, 1760, 1761, 547, 629, + /* 1790 */ 570, 1498, 628, 631, 633, 632, 1496, 1757, 635, 636, + /* 1800 */ 637, 1788, 1775, 1494, 287, 1758, 551, 1760, 1761, 547, + /* 1810 */ 549, 570, 639, 1807, 640, 1727, 1482, 548, 641, 643, + /* 1820 */ 984, 1464, 261, 647, 1439, 1775, 1240, 269, 650, 325, + /* 1830 */ 651, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1439, + /* 1840 */ 548, 1439, 1439, 1788, 1439, 1439, 288, 1758, 551, 1760, + /* 1850 */ 1761, 547, 327, 570, 1757, 1439, 1439, 1439, 1439, 1439, + /* 1860 */ 1439, 1439, 1439, 1439, 1439, 1757, 1788, 1439, 1439, 288, + /* 1870 */ 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1439, 1757, + /* 1880 */ 1439, 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 1890 */ 549, 1439, 1439, 1775, 1439, 1727, 1439, 548, 1439, 1439, + /* 1900 */ 1439, 549, 1439, 1439, 1439, 1439, 1727, 1775, 548, 1439, + /* 1910 */ 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, + /* 1920 */ 1727, 1757, 548, 1788, 1439, 1439, 274, 1758, 551, 1760, + /* 1930 */ 1761, 547, 1439, 570, 1788, 1757, 1439, 275, 1758, 551, + /* 1940 */ 1760, 1761, 547, 1439, 570, 1439, 1757, 1439, 1788, 1775, + /* 1950 */ 1439, 276, 1758, 551, 1760, 1761, 547, 549, 570, 1439, + /* 1960 */ 1439, 1439, 1727, 1775, 548, 1439, 1439, 1439, 1439, 1439, + /* 1970 */ 1439, 549, 1439, 1439, 1775, 1439, 1727, 1439, 548, 1439, + /* 1980 */ 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1757, 548, + /* 1990 */ 1788, 1439, 1439, 282, 1758, 551, 1760, 1761, 547, 1439, + /* 2000 */ 570, 1439, 1439, 1439, 1788, 1439, 1439, 284, 1758, 551, + /* 2010 */ 1760, 1761, 547, 1439, 570, 1788, 1775, 1439, 277, 1758, + /* 2020 */ 551, 1760, 1761, 547, 549, 570, 1439, 1439, 1439, 1727, + /* 2030 */ 1757, 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2040 */ 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2050 */ 1439, 1439, 1439, 1757, 1439, 1439, 1439, 1788, 1775, 1439, + /* 2060 */ 285, 1758, 551, 1760, 1761, 547, 549, 570, 1439, 1775, + /* 2070 */ 1439, 1727, 1439, 548, 1439, 1439, 1439, 549, 1439, 1439, + /* 2080 */ 1439, 1775, 1727, 1439, 548, 1439, 1439, 1439, 1439, 549, + /* 2090 */ 1439, 1439, 1439, 1439, 1727, 1439, 548, 1439, 1439, 1788, + /* 2100 */ 1439, 1439, 278, 1758, 551, 1760, 1761, 547, 1757, 570, + /* 2110 */ 1788, 1439, 1439, 286, 1758, 551, 1760, 1761, 547, 1439, + /* 2120 */ 570, 1439, 1788, 1439, 1439, 279, 1758, 551, 1760, 1761, + /* 2130 */ 547, 1439, 570, 1439, 1439, 1757, 1775, 1439, 1439, 1439, + /* 2140 */ 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, + /* 2150 */ 1439, 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2160 */ 1439, 1439, 1757, 1775, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2170 */ 1439, 549, 1439, 1439, 1439, 1439, 1727, 1788, 548, 1439, + /* 2180 */ 292, 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1757, + /* 2190 */ 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, + /* 2200 */ 1439, 1439, 1439, 1727, 1788, 548, 1439, 293, 1758, 551, + /* 2210 */ 1760, 1761, 547, 1439, 570, 1439, 1439, 1775, 1439, 1439, + /* 2220 */ 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, + /* 2230 */ 1727, 1788, 548, 1439, 1769, 1758, 551, 1760, 1761, 547, + /* 2240 */ 1439, 570, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2250 */ 1439, 1439, 1757, 1439, 1439, 1439, 1439, 1439, 1788, 1439, + /* 2260 */ 1439, 1768, 1758, 551, 1760, 1761, 547, 1439, 570, 1439, + /* 2270 */ 1757, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, + /* 2280 */ 1775, 1439, 1439, 1439, 1727, 1439, 548, 1439, 549, 1439, + /* 2290 */ 1439, 1439, 1439, 1727, 1439, 548, 1439, 1439, 1775, 1439, + /* 2300 */ 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, 1439, + /* 2310 */ 1439, 1727, 1788, 548, 1439, 1767, 1758, 551, 1760, 1761, + /* 2320 */ 547, 1788, 570, 1757, 303, 1758, 551, 1760, 1761, 547, + /* 2330 */ 1439, 570, 1439, 1439, 1439, 1439, 1439, 1757, 1439, 1788, + /* 2340 */ 1439, 1439, 302, 1758, 551, 1760, 1761, 547, 1439, 570, + /* 2350 */ 1439, 1775, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, + /* 2360 */ 1439, 1439, 1439, 1439, 1727, 1775, 548, 1439, 1439, 1439, + /* 2370 */ 1439, 1439, 1439, 549, 1439, 1439, 1439, 1439, 1727, 1439, + /* 2380 */ 548, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2390 */ 1439, 1757, 1788, 1439, 1439, 304, 1758, 551, 1760, 1761, + /* 2400 */ 547, 1439, 570, 1439, 1439, 1439, 1788, 1439, 1439, 301, + /* 2410 */ 1758, 551, 1760, 1761, 547, 1439, 570, 1439, 1439, 1775, + /* 2420 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 549, 1439, 1439, + /* 2430 */ 1439, 1439, 1727, 1439, 548, 1439, 1439, 1439, 1439, 1439, + /* 2440 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2450 */ 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, 1439, + /* 2460 */ 1788, 1439, 1439, 281, 1758, 551, 1760, 1761, 547, 1439, + /* 2470 */ 570, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 261, 257, 250, 259, 260, 283, 0, 257, 286, 259, - /* 10 */ 260, 272, 12, 13, 0, 252, 294, 254, 279, 265, - /* 20 */ 20, 0, 22, 283, 21, 280, 286, 261, 289, 283, - /* 30 */ 20, 20, 278, 33, 294, 35, 323, 34, 293, 36, - /* 40 */ 294, 287, 21, 321, 322, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 332, 289, 56, 281, 253, 59, - /* 60 */ 347, 321, 322, 311, 288, 65, 311, 321, 322, 12, - /* 70 */ 13, 14, 332, 297, 20, 61, 62, 20, 332, 22, - /* 80 */ 66, 323, 82, 69, 70, 296, 281, 73, 74, 75, - /* 90 */ 33, 281, 35, 304, 289, 329, 307, 261, 288, 294, - /* 100 */ 253, 296, 311, 351, 104, 347, 351, 297, 272, 343, - /* 110 */ 344, 345, 346, 56, 348, 279, 59, 365, 118, 119, - /* 120 */ 365, 369, 65, 0, 369, 289, 0, 322, 118, 119, - /* 130 */ 325, 326, 327, 328, 329, 330, 82, 332, 263, 82, - /* 140 */ 335, 294, 351, 56, 339, 340, 341, 24, 25, 26, - /* 150 */ 27, 28, 29, 30, 31, 32, 365, 58, 353, 284, - /* 160 */ 369, 104, 0, 163, 266, 165, 361, 362, 270, 82, - /* 170 */ 20, 84, 61, 62, 48, 118, 119, 66, 283, 292, - /* 180 */ 69, 70, 295, 296, 73, 74, 75, 187, 188, 294, - /* 190 */ 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, - /* 200 */ 200, 201, 202, 203, 204, 205, 206, 8, 9, 113, - /* 210 */ 114, 12, 13, 14, 15, 16, 321, 322, 258, 219, - /* 220 */ 163, 261, 165, 61, 62, 63, 64, 332, 66, 67, - /* 230 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - /* 240 */ 78, 79, 20, 4, 187, 188, 4, 190, 191, 192, + /* 0 */ 259, 308, 261, 262, 311, 285, 252, 259, 288, 261, + /* 10 */ 262, 284, 12, 13, 0, 294, 296, 267, 297, 298, + /* 20 */ 20, 0, 22, 285, 353, 285, 288, 263, 313, 263, + /* 30 */ 280, 0, 283, 33, 296, 35, 296, 366, 0, 289, + /* 40 */ 291, 370, 21, 323, 324, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 334, 291, 56, 4, 255, 59, + /* 60 */ 4, 323, 324, 323, 324, 65, 300, 313, 353, 12, + /* 70 */ 13, 14, 334, 58, 334, 61, 62, 20, 329, 22, + /* 80 */ 66, 366, 82, 69, 70, 370, 283, 73, 74, 75, + /* 90 */ 33, 20, 35, 22, 291, 331, 58, 44, 45, 296, + /* 100 */ 4, 298, 14, 37, 104, 20, 35, 353, 20, 345, + /* 110 */ 346, 347, 348, 56, 350, 19, 59, 298, 118, 119, + /* 120 */ 366, 50, 65, 0, 370, 306, 76, 324, 309, 33, + /* 130 */ 327, 328, 329, 330, 331, 332, 82, 334, 82, 82, + /* 140 */ 337, 263, 56, 47, 341, 342, 343, 51, 338, 339, + /* 150 */ 19, 85, 56, 87, 88, 254, 90, 256, 355, 260, + /* 160 */ 94, 104, 263, 163, 33, 165, 363, 82, 82, 291, + /* 170 */ 84, 275, 122, 123, 20, 118, 119, 81, 47, 283, + /* 180 */ 84, 58, 116, 52, 53, 54, 55, 56, 292, 189, + /* 190 */ 190, 20, 192, 193, 194, 195, 196, 197, 198, 199, + /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 331, + /* 210 */ 20, 308, 81, 14, 311, 84, 162, 56, 164, 20, + /* 220 */ 163, 221, 165, 14, 346, 347, 348, 353, 350, 20, + /* 230 */ 285, 8, 9, 313, 20, 12, 13, 14, 15, 16, + /* 240 */ 366, 296, 81, 263, 370, 84, 189, 190, 117, 192, /* 250 */ 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, - /* 260 */ 203, 204, 205, 206, 12, 13, 20, 22, 82, 311, - /* 270 */ 174, 187, 20, 219, 22, 12, 13, 14, 15, 16, - /* 280 */ 35, 20, 83, 44, 45, 33, 263, 35, 95, 96, - /* 290 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 276, - /* 300 */ 107, 108, 109, 110, 111, 112, 219, 284, 56, 351, - /* 310 */ 65, 59, 228, 229, 230, 231, 232, 65, 94, 0, - /* 320 */ 261, 12, 13, 365, 82, 253, 58, 369, 82, 20, - /* 330 */ 20, 22, 22, 20, 82, 273, 82, 113, 114, 115, - /* 340 */ 116, 117, 33, 281, 35, 35, 273, 20, 162, 104, - /* 350 */ 164, 261, 290, 281, 281, 351, 104, 298, 0, 273, - /* 360 */ 50, 289, 113, 290, 351, 56, 294, 281, 296, 365, - /* 370 */ 118, 119, 150, 369, 65, 351, 290, 58, 365, 289, - /* 380 */ 8, 9, 369, 311, 12, 13, 14, 15, 16, 365, - /* 390 */ 14, 82, 261, 369, 322, 289, 20, 325, 326, 327, - /* 400 */ 328, 329, 330, 272, 332, 219, 300, 335, 163, 158, - /* 410 */ 165, 339, 340, 104, 281, 163, 58, 165, 148, 329, - /* 420 */ 289, 82, 289, 351, 175, 176, 65, 118, 119, 178, - /* 430 */ 179, 92, 187, 188, 344, 345, 346, 365, 348, 187, - /* 440 */ 188, 369, 190, 191, 192, 193, 194, 195, 196, 197, - /* 450 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 21, - /* 460 */ 327, 219, 24, 25, 26, 27, 28, 29, 30, 31, - /* 470 */ 32, 14, 163, 219, 165, 8, 9, 20, 2, 12, - /* 480 */ 13, 14, 15, 16, 8, 9, 76, 14, 12, 13, - /* 490 */ 14, 15, 16, 20, 224, 225, 187, 188, 93, 190, - /* 500 */ 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, - /* 510 */ 201, 202, 203, 204, 205, 206, 12, 13, 14, 261, - /* 520 */ 114, 336, 337, 261, 20, 65, 22, 155, 219, 253, - /* 530 */ 272, 253, 122, 123, 272, 46, 20, 33, 22, 35, - /* 540 */ 315, 253, 2, 14, 15, 16, 39, 289, 8, 9, - /* 550 */ 83, 289, 12, 13, 14, 15, 16, 8, 9, 253, - /* 560 */ 56, 12, 13, 14, 15, 16, 50, 191, 253, 65, - /* 570 */ 294, 82, 294, 12, 13, 253, 295, 296, 4, 173, - /* 580 */ 174, 20, 294, 22, 8, 9, 82, 281, 12, 13, - /* 590 */ 14, 15, 16, 19, 33, 289, 35, 281, 265, 261, - /* 600 */ 294, 261, 296, 281, 1, 2, 290, 33, 104, 294, - /* 610 */ 272, 289, 272, 241, 56, 253, 294, 56, 296, 43, - /* 620 */ 287, 47, 118, 119, 0, 51, 65, 289, 322, 289, - /* 630 */ 56, 325, 326, 327, 328, 329, 330, 258, 332, 81, - /* 640 */ 261, 335, 84, 82, 322, 339, 340, 325, 326, 327, - /* 650 */ 328, 329, 330, 35, 332, 81, 294, 335, 84, 261, - /* 660 */ 282, 339, 340, 341, 191, 104, 145, 163, 282, 165, - /* 670 */ 8, 9, 253, 253, 12, 13, 14, 15, 16, 118, - /* 680 */ 119, 0, 291, 65, 362, 294, 83, 289, 253, 168, - /* 690 */ 253, 187, 188, 253, 190, 191, 192, 193, 194, 195, - /* 700 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, - /* 710 */ 206, 267, 268, 294, 294, 8, 9, 4, 94, 12, - /* 720 */ 13, 14, 15, 16, 163, 218, 165, 329, 207, 294, - /* 730 */ 253, 294, 253, 253, 294, 37, 253, 113, 114, 115, - /* 740 */ 116, 117, 344, 345, 346, 83, 348, 306, 187, 188, - /* 750 */ 309, 190, 191, 192, 193, 194, 195, 196, 197, 198, - /* 760 */ 199, 200, 201, 202, 203, 204, 205, 206, 12, 13, - /* 770 */ 18, 294, 20, 294, 294, 94, 20, 294, 22, 27, - /* 780 */ 94, 323, 30, 85, 253, 87, 88, 306, 90, 33, - /* 790 */ 309, 35, 94, 20, 113, 114, 115, 116, 117, 47, - /* 800 */ 3, 49, 116, 51, 261, 347, 267, 268, 296, 261, - /* 810 */ 20, 261, 56, 261, 116, 272, 261, 253, 261, 307, - /* 820 */ 272, 65, 272, 0, 272, 294, 253, 272, 253, 272, - /* 830 */ 43, 261, 289, 81, 281, 44, 45, 289, 82, 289, - /* 840 */ 274, 289, 272, 277, 289, 43, 289, 8, 9, 282, - /* 850 */ 297, 12, 13, 14, 15, 16, 281, 150, 294, 289, - /* 860 */ 104, 269, 291, 271, 289, 294, 282, 294, 253, 294, - /* 870 */ 47, 296, 0, 121, 118, 119, 124, 125, 126, 127, - /* 880 */ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - /* 890 */ 138, 139, 140, 141, 22, 143, 144, 322, 59, 35, - /* 900 */ 325, 326, 327, 328, 329, 330, 261, 332, 56, 294, - /* 910 */ 335, 217, 218, 0, 339, 340, 341, 272, 33, 163, - /* 920 */ 282, 165, 83, 150, 282, 350, 86, 43, 86, 89, - /* 930 */ 91, 89, 47, 220, 289, 22, 84, 52, 53, 54, - /* 940 */ 55, 56, 86, 187, 188, 89, 190, 191, 192, 193, - /* 950 */ 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, - /* 960 */ 204, 205, 206, 18, 261, 261, 81, 83, 23, 84, - /* 970 */ 150, 151, 282, 43, 86, 272, 272, 89, 0, 59, - /* 980 */ 43, 191, 37, 38, 145, 254, 41, 270, 1, 2, - /* 990 */ 363, 372, 289, 289, 118, 119, 43, 43, 262, 43, - /* 1000 */ 22, 43, 57, 43, 43, 43, 318, 168, 358, 35, - /* 1010 */ 35, 8, 9, 83, 281, 12, 13, 14, 15, 16, - /* 1020 */ 83, 262, 260, 43, 43, 238, 43, 82, 43, 165, - /* 1030 */ 261, 146, 147, 236, 149, 293, 83, 83, 153, 83, - /* 1040 */ 65, 83, 240, 83, 83, 83, 207, 208, 209, 210, - /* 1050 */ 211, 212, 213, 214, 215, 216, 43, 172, 289, 43, - /* 1060 */ 349, 324, 59, 83, 83, 120, 83, 366, 83, 221, - /* 1070 */ 352, 366, 366, 320, 20, 261, 47, 319, 35, 267, - /* 1080 */ 311, 313, 161, 261, 42, 261, 301, 145, 299, 261, - /* 1090 */ 20, 299, 255, 255, 91, 20, 83, 317, 329, 83, - /* 1100 */ 155, 156, 157, 296, 20, 160, 265, 187, 253, 265, - /* 1110 */ 310, 166, 20, 344, 345, 346, 312, 348, 265, 310, - /* 1120 */ 351, 20, 177, 265, 265, 180, 265, 182, 183, 184, - /* 1130 */ 185, 186, 302, 265, 365, 261, 281, 255, 369, 165, - /* 1140 */ 294, 281, 261, 281, 289, 255, 281, 281, 145, 294, - /* 1150 */ 281, 296, 281, 317, 281, 263, 281, 171, 281, 281, - /* 1160 */ 281, 253, 263, 316, 219, 261, 311, 261, 263, 20, - /* 1170 */ 227, 168, 357, 310, 324, 226, 296, 322, 357, 233, - /* 1180 */ 325, 326, 327, 328, 329, 330, 360, 332, 294, 281, - /* 1190 */ 335, 305, 294, 154, 339, 340, 305, 289, 235, 234, - /* 1200 */ 357, 294, 294, 253, 296, 294, 351, 356, 359, 355, - /* 1210 */ 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, - /* 1220 */ 365, 222, 320, 218, 369, 289, 20, 42, 239, 237, - /* 1230 */ 322, 281, 323, 325, 326, 327, 328, 329, 330, 289, - /* 1240 */ 332, 354, 342, 335, 294, 82, 296, 339, 340, 341, - /* 1250 */ 12, 13, 242, 338, 147, 303, 373, 368, 350, 289, - /* 1260 */ 22, 368, 367, 367, 305, 368, 294, 294, 367, 305, - /* 1270 */ 294, 33, 322, 35, 263, 325, 326, 327, 328, 329, - /* 1280 */ 330, 253, 332, 277, 294, 335, 302, 294, 294, 339, - /* 1290 */ 340, 341, 82, 263, 56, 294, 289, 285, 271, 261, - /* 1300 */ 350, 36, 256, 65, 263, 255, 309, 275, 253, 281, - /* 1310 */ 314, 275, 275, 264, 251, 0, 0, 289, 42, 0, - /* 1320 */ 0, 73, 294, 35, 296, 181, 35, 35, 35, 181, - /* 1330 */ 0, 35, 35, 181, 0, 181, 281, 0, 35, 311, - /* 1340 */ 0, 0, 104, 22, 289, 35, 0, 168, 82, 294, - /* 1350 */ 322, 296, 165, 325, 326, 327, 328, 329, 330, 167, - /* 1360 */ 332, 163, 0, 0, 159, 158, 311, 0, 0, 46, - /* 1370 */ 0, 0, 0, 142, 0, 0, 253, 322, 0, 351, - /* 1380 */ 325, 326, 327, 328, 329, 330, 0, 332, 0, 137, - /* 1390 */ 35, 0, 137, 365, 0, 0, 0, 369, 0, 0, - /* 1400 */ 0, 163, 0, 165, 281, 22, 351, 0, 0, 0, - /* 1410 */ 0, 0, 289, 0, 0, 42, 0, 294, 253, 296, - /* 1420 */ 365, 0, 0, 0, 369, 187, 0, 0, 0, 0, - /* 1430 */ 0, 0, 0, 0, 42, 46, 198, 199, 200, 201, - /* 1440 */ 202, 203, 204, 253, 43, 322, 281, 60, 325, 326, - /* 1450 */ 327, 328, 329, 330, 289, 332, 39, 14, 335, 294, - /* 1460 */ 14, 296, 339, 340, 46, 0, 0, 0, 0, 0, - /* 1470 */ 0, 281, 154, 0, 40, 39, 39, 0, 0, 289, - /* 1480 */ 261, 39, 47, 35, 294, 0, 296, 322, 35, 39, - /* 1490 */ 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - /* 1500 */ 253, 47, 0, 47, 0, 47, 35, 0, 289, 35, - /* 1510 */ 0, 39, 322, 89, 39, 325, 326, 327, 328, 329, - /* 1520 */ 330, 0, 332, 0, 35, 22, 0, 35, 281, 91, - /* 1530 */ 311, 35, 35, 35, 43, 35, 289, 43, 0, 22, - /* 1540 */ 35, 294, 0, 296, 35, 0, 22, 22, 329, 35, - /* 1550 */ 49, 0, 0, 35, 35, 0, 22, 253, 0, 20, - /* 1560 */ 370, 371, 150, 344, 345, 346, 35, 348, 0, 322, - /* 1570 */ 351, 22, 325, 326, 327, 328, 329, 330, 253, 332, - /* 1580 */ 0, 0, 335, 0, 365, 281, 147, 340, 369, 169, - /* 1590 */ 150, 150, 0, 289, 0, 83, 152, 43, 294, 43, - /* 1600 */ 296, 217, 223, 83, 82, 43, 281, 43, 43, 82, - /* 1610 */ 43, 83, 308, 83, 289, 82, 223, 82, 82, 294, - /* 1620 */ 46, 296, 46, 82, 46, 46, 322, 83, 43, 325, - /* 1630 */ 326, 327, 328, 329, 330, 253, 332, 35, 223, 35, - /* 1640 */ 83, 35, 83, 83, 35, 35, 35, 322, 2, 187, - /* 1650 */ 325, 326, 327, 328, 329, 330, 43, 332, 253, 22, - /* 1660 */ 83, 46, 46, 281, 82, 189, 0, 83, 82, 82, - /* 1670 */ 82, 289, 83, 83, 0, 82, 294, 82, 296, 82, - /* 1680 */ 148, 39, 82, 146, 46, 46, 281, 82, 92, 364, - /* 1690 */ 83, 22, 93, 35, 289, 83, 82, 35, 35, 294, - /* 1700 */ 253, 296, 82, 82, 322, 83, 82, 325, 326, 327, - /* 1710 */ 328, 329, 330, 308, 332, 83, 253, 35, 82, 35, - /* 1720 */ 35, 22, 94, 83, 83, 82, 82, 322, 281, 106, - /* 1730 */ 325, 326, 327, 328, 329, 330, 289, 332, 82, 106, - /* 1740 */ 106, 294, 82, 296, 281, 35, 82, 43, 22, 60, - /* 1750 */ 59, 106, 289, 371, 35, 80, 43, 294, 65, 296, - /* 1760 */ 35, 22, 35, 35, 35, 35, 253, 35, 35, 322, - /* 1770 */ 65, 308, 325, 326, 327, 328, 329, 330, 35, 332, - /* 1780 */ 35, 334, 35, 35, 35, 322, 35, 35, 325, 326, - /* 1790 */ 327, 328, 329, 330, 281, 332, 19, 0, 35, 39, - /* 1800 */ 47, 0, 289, 35, 47, 39, 0, 294, 35, 296, - /* 1810 */ 33, 47, 0, 39, 35, 39, 47, 0, 35, 35, - /* 1820 */ 0, 308, 22, 253, 47, 21, 374, 22, 21, 52, - /* 1830 */ 53, 54, 55, 56, 374, 322, 22, 374, 325, 326, - /* 1840 */ 327, 328, 329, 330, 20, 332, 374, 374, 374, 374, - /* 1850 */ 374, 281, 374, 374, 374, 374, 374, 374, 81, 289, - /* 1860 */ 374, 84, 374, 374, 294, 374, 296, 374, 374, 374, - /* 1870 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - /* 1880 */ 374, 374, 374, 374, 253, 374, 374, 374, 374, 374, - /* 1890 */ 374, 374, 322, 374, 117, 325, 326, 327, 328, 329, - /* 1900 */ 330, 253, 332, 374, 374, 374, 374, 374, 374, 374, - /* 1910 */ 374, 374, 281, 374, 374, 374, 374, 374, 374, 374, - /* 1920 */ 289, 374, 374, 374, 374, 294, 149, 296, 374, 281, - /* 1930 */ 374, 374, 374, 374, 374, 374, 374, 289, 374, 374, - /* 1940 */ 374, 374, 294, 253, 296, 374, 374, 170, 374, 172, - /* 1950 */ 374, 374, 374, 322, 253, 374, 325, 326, 327, 328, - /* 1960 */ 329, 330, 374, 332, 374, 253, 374, 374, 374, 374, - /* 1970 */ 322, 281, 374, 325, 326, 327, 328, 329, 330, 289, - /* 1980 */ 332, 374, 281, 374, 294, 374, 296, 374, 374, 374, - /* 1990 */ 289, 374, 374, 281, 374, 294, 374, 296, 374, 374, - /* 2000 */ 374, 289, 374, 374, 374, 374, 294, 253, 296, 374, - /* 2010 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, - /* 2020 */ 330, 374, 332, 322, 374, 253, 325, 326, 327, 328, - /* 2030 */ 329, 330, 374, 332, 322, 281, 374, 325, 326, 327, - /* 2040 */ 328, 329, 330, 289, 332, 374, 374, 374, 294, 253, - /* 2050 */ 296, 374, 374, 281, 374, 374, 374, 374, 374, 374, - /* 2060 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, - /* 2070 */ 374, 374, 374, 374, 374, 374, 322, 281, 374, 325, - /* 2080 */ 326, 327, 328, 329, 330, 289, 332, 374, 374, 374, - /* 2090 */ 294, 374, 296, 374, 322, 374, 374, 325, 326, 327, - /* 2100 */ 328, 329, 330, 374, 332, 253, 374, 374, 374, 374, - /* 2110 */ 374, 374, 374, 374, 374, 374, 374, 374, 322, 374, - /* 2120 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2130 */ 374, 374, 374, 281, 374, 374, 374, 374, 374, 374, - /* 2140 */ 374, 289, 374, 374, 374, 374, 294, 374, 296, 374, - /* 2150 */ 374, 374, 374, 374, 374, 253, 374, 374, 374, 374, - /* 2160 */ 374, 374, 374, 374, 374, 374, 253, 374, 374, 374, - /* 2170 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2180 */ 328, 329, 330, 281, 332, 374, 374, 374, 374, 374, - /* 2190 */ 374, 289, 374, 374, 281, 374, 294, 374, 296, 374, - /* 2200 */ 374, 374, 289, 374, 374, 374, 374, 294, 253, 296, - /* 2210 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, - /* 2220 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2230 */ 328, 329, 330, 253, 332, 322, 281, 374, 325, 326, - /* 2240 */ 327, 328, 329, 330, 289, 332, 374, 281, 374, 294, - /* 2250 */ 374, 296, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2260 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, - /* 2270 */ 374, 374, 374, 374, 294, 374, 296, 322, 374, 374, - /* 2280 */ 325, 326, 327, 328, 329, 330, 374, 332, 322, 253, - /* 2290 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2300 */ 374, 374, 322, 253, 374, 325, 326, 327, 328, 329, - /* 2310 */ 330, 374, 332, 374, 374, 374, 374, 281, 374, 374, - /* 2320 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2330 */ 294, 281, 296, 374, 374, 374, 374, 374, 374, 289, - /* 2340 */ 374, 374, 374, 374, 294, 374, 296, 374, 374, 374, - /* 2350 */ 374, 374, 374, 253, 374, 374, 374, 374, 322, 374, - /* 2360 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, 374, - /* 2370 */ 374, 374, 322, 374, 374, 325, 326, 327, 328, 329, - /* 2380 */ 330, 281, 332, 374, 374, 374, 374, 374, 374, 289, - /* 2390 */ 374, 374, 374, 374, 294, 253, 296, 374, 374, 374, - /* 2400 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 253, - /* 2410 */ 374, 374, 374, 374, 374, 374, 374, 374, 374, 374, - /* 2420 */ 374, 374, 322, 281, 374, 325, 326, 327, 328, 329, - /* 2430 */ 330, 289, 332, 374, 374, 374, 294, 281, 296, 374, - /* 2440 */ 374, 374, 374, 374, 374, 289, 374, 374, 374, 374, - /* 2450 */ 294, 374, 296, 374, 374, 374, 374, 374, 374, 374, - /* 2460 */ 374, 374, 374, 374, 322, 374, 374, 325, 326, 327, - /* 2470 */ 328, 329, 330, 374, 332, 374, 374, 374, 322, 374, - /* 2480 */ 374, 325, 326, 327, 328, 329, 330, 374, 332, + /* 260 */ 203, 204, 205, 206, 207, 208, 12, 13, 323, 324, + /* 270 */ 21, 291, 313, 353, 20, 221, 22, 221, 267, 334, + /* 280 */ 149, 193, 59, 34, 82, 36, 366, 33, 21, 35, + /* 290 */ 370, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 300 */ 289, 170, 282, 172, 353, 298, 83, 221, 118, 119, + /* 310 */ 56, 331, 353, 59, 91, 295, 309, 366, 20, 65, + /* 320 */ 94, 370, 20, 12, 13, 366, 346, 347, 348, 370, + /* 330 */ 350, 20, 58, 22, 0, 20, 82, 22, 20, 113, + /* 340 */ 114, 115, 116, 117, 33, 265, 35, 95, 96, 97, + /* 350 */ 98, 99, 100, 101, 102, 103, 104, 105, 104, 107, + /* 360 */ 108, 109, 110, 111, 112, 50, 286, 56, 145, 14, + /* 370 */ 15, 16, 118, 119, 291, 255, 65, 12, 13, 14, + /* 380 */ 15, 16, 8, 9, 82, 302, 12, 13, 14, 15, + /* 390 */ 16, 168, 193, 82, 59, 61, 62, 63, 64, 93, + /* 400 */ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + /* 410 */ 76, 77, 78, 79, 268, 104, 296, 163, 272, 165, + /* 420 */ 8, 9, 189, 221, 12, 13, 14, 15, 16, 118, + /* 430 */ 119, 0, 209, 210, 211, 212, 213, 214, 215, 216, + /* 440 */ 217, 218, 293, 189, 190, 296, 192, 193, 194, 195, + /* 450 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + /* 460 */ 206, 207, 208, 230, 231, 232, 233, 234, 35, 263, + /* 470 */ 61, 62, 283, 145, 163, 66, 165, 20, 69, 70, + /* 480 */ 274, 292, 73, 74, 75, 8, 9, 281, 65, 12, + /* 490 */ 13, 14, 15, 16, 65, 83, 168, 291, 65, 255, + /* 500 */ 189, 190, 114, 192, 193, 194, 195, 196, 197, 198, + /* 510 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + /* 520 */ 12, 13, 14, 221, 189, 94, 297, 298, 20, 155, + /* 530 */ 22, 263, 221, 269, 270, 33, 59, 209, 113, 114, + /* 540 */ 296, 33, 274, 35, 113, 114, 115, 116, 117, 47, + /* 550 */ 284, 263, 263, 283, 52, 53, 54, 55, 56, 291, + /* 560 */ 290, 173, 174, 274, 56, 177, 20, 275, 91, 299, + /* 570 */ 281, 1, 2, 65, 275, 283, 317, 12, 13, 291, + /* 580 */ 291, 284, 283, 81, 292, 20, 84, 22, 8, 9, + /* 590 */ 82, 292, 12, 13, 14, 15, 16, 265, 33, 174, + /* 600 */ 35, 313, 177, 255, 263, 263, 94, 150, 283, 255, + /* 610 */ 278, 255, 104, 283, 263, 274, 274, 243, 286, 331, + /* 620 */ 290, 56, 145, 43, 299, 274, 118, 119, 116, 299, + /* 630 */ 65, 283, 291, 291, 346, 347, 348, 20, 350, 291, + /* 640 */ 255, 353, 291, 158, 296, 168, 298, 82, 146, 147, + /* 650 */ 296, 149, 296, 83, 366, 153, 8, 9, 370, 148, + /* 660 */ 12, 13, 14, 15, 16, 180, 181, 260, 3, 104, + /* 670 */ 263, 163, 324, 165, 172, 327, 328, 329, 330, 331, + /* 680 */ 332, 296, 334, 118, 119, 0, 209, 210, 211, 212, + /* 690 */ 213, 214, 215, 216, 217, 218, 150, 189, 190, 255, + /* 700 */ 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, + /* 710 */ 202, 203, 204, 205, 206, 207, 208, 0, 276, 371, + /* 720 */ 372, 279, 263, 263, 263, 269, 270, 284, 163, 293, + /* 730 */ 165, 83, 296, 274, 274, 274, 284, 226, 227, 0, + /* 740 */ 296, 24, 25, 26, 27, 28, 29, 30, 31, 32, + /* 750 */ 291, 291, 291, 263, 189, 190, 284, 192, 193, 194, + /* 760 */ 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + /* 770 */ 205, 206, 207, 208, 12, 13, 18, 22, 20, 94, + /* 780 */ 263, 291, 20, 263, 22, 27, 47, 255, 30, 325, + /* 790 */ 35, 274, 325, 284, 274, 33, 4, 35, 113, 114, + /* 800 */ 115, 116, 117, 313, 255, 47, 263, 49, 291, 51, + /* 810 */ 193, 291, 113, 349, 44, 45, 349, 274, 56, 256, + /* 820 */ 65, 331, 263, 39, 255, 325, 272, 65, 296, 219, + /* 830 */ 220, 255, 86, 274, 291, 89, 346, 347, 348, 81, + /* 840 */ 350, 2, 373, 353, 82, 296, 43, 8, 9, 349, + /* 850 */ 291, 12, 13, 14, 15, 16, 366, 2, 364, 104, + /* 860 */ 370, 42, 43, 8, 9, 296, 104, 12, 13, 14, + /* 870 */ 15, 16, 296, 264, 175, 176, 255, 150, 151, 121, + /* 880 */ 118, 119, 124, 125, 126, 127, 128, 129, 130, 131, + /* 890 */ 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + /* 900 */ 0, 143, 144, 238, 86, 263, 255, 89, 263, 18, + /* 910 */ 43, 271, 255, 273, 23, 320, 274, 296, 163, 274, + /* 920 */ 165, 86, 22, 86, 89, 163, 89, 165, 37, 38, + /* 930 */ 1, 2, 41, 291, 8, 9, 291, 255, 12, 13, + /* 940 */ 14, 15, 16, 255, 189, 190, 255, 296, 57, 255, + /* 950 */ 255, 189, 190, 296, 192, 193, 194, 195, 196, 197, + /* 960 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + /* 970 */ 208, 283, 263, 82, 263, 118, 119, 56, 296, 291, + /* 980 */ 255, 0, 360, 274, 296, 274, 298, 296, 8, 9, + /* 990 */ 296, 296, 12, 13, 14, 15, 16, 255, 283, 43, + /* 1000 */ 291, 313, 291, 22, 220, 84, 46, 35, 35, 83, + /* 1010 */ 43, 120, 324, 43, 222, 327, 328, 329, 330, 331, + /* 1020 */ 332, 296, 334, 0, 255, 337, 262, 8, 9, 341, + /* 1030 */ 342, 12, 13, 14, 15, 16, 0, 264, 296, 83, + /* 1040 */ 295, 353, 82, 240, 255, 22, 155, 156, 157, 43, + /* 1050 */ 83, 160, 283, 83, 366, 43, 82, 166, 370, 326, + /* 1060 */ 291, 35, 344, 351, 43, 296, 92, 298, 43, 367, + /* 1070 */ 179, 367, 283, 182, 43, 184, 185, 186, 187, 188, + /* 1080 */ 291, 367, 313, 354, 48, 296, 223, 298, 43, 83, + /* 1090 */ 322, 65, 20, 324, 43, 83, 327, 328, 329, 330, + /* 1100 */ 331, 332, 43, 334, 83, 263, 337, 47, 83, 242, + /* 1110 */ 341, 342, 221, 324, 83, 321, 327, 328, 329, 330, + /* 1120 */ 331, 332, 353, 334, 35, 269, 337, 161, 83, 315, + /* 1130 */ 341, 342, 343, 43, 83, 366, 255, 165, 165, 370, + /* 1140 */ 43, 43, 83, 43, 43, 263, 263, 42, 303, 145, + /* 1150 */ 301, 301, 363, 263, 20, 257, 257, 20, 298, 319, + /* 1160 */ 267, 267, 20, 312, 283, 20, 314, 20, 267, 150, + /* 1170 */ 312, 267, 291, 83, 304, 267, 267, 296, 263, 298, + /* 1180 */ 83, 83, 257, 83, 83, 267, 283, 263, 283, 283, + /* 1190 */ 283, 257, 296, 283, 283, 283, 283, 283, 319, 255, + /* 1200 */ 283, 265, 283, 171, 318, 324, 265, 312, 327, 328, + /* 1210 */ 329, 330, 331, 332, 298, 334, 263, 263, 337, 20, + /* 1220 */ 265, 229, 341, 342, 343, 359, 255, 283, 326, 296, + /* 1230 */ 228, 296, 359, 352, 307, 291, 12, 13, 307, 296, + /* 1240 */ 296, 296, 298, 235, 237, 154, 22, 362, 361, 236, + /* 1250 */ 322, 359, 224, 220, 283, 358, 291, 33, 20, 35, + /* 1260 */ 244, 241, 291, 325, 82, 307, 239, 296, 324, 298, + /* 1270 */ 307, 327, 328, 329, 330, 331, 332, 357, 334, 356, + /* 1280 */ 56, 337, 296, 296, 296, 341, 342, 343, 340, 65, + /* 1290 */ 296, 369, 296, 296, 305, 324, 352, 255, 327, 328, + /* 1300 */ 329, 330, 331, 332, 374, 334, 369, 368, 337, 369, + /* 1310 */ 368, 147, 341, 342, 343, 368, 279, 265, 304, 265, + /* 1320 */ 291, 291, 82, 352, 263, 283, 287, 265, 104, 273, + /* 1330 */ 296, 36, 258, 291, 257, 311, 266, 253, 296, 0, + /* 1340 */ 298, 277, 277, 277, 0, 42, 0, 73, 0, 35, + /* 1350 */ 183, 316, 35, 35, 35, 313, 183, 0, 35, 35, + /* 1360 */ 183, 0, 255, 183, 0, 35, 324, 0, 0, 327, + /* 1370 */ 328, 329, 330, 331, 332, 22, 334, 35, 0, 82, + /* 1380 */ 168, 167, 165, 163, 0, 0, 159, 163, 158, 165, + /* 1390 */ 283, 0, 0, 46, 0, 353, 0, 0, 291, 142, + /* 1400 */ 0, 0, 0, 296, 0, 298, 0, 137, 366, 35, + /* 1410 */ 0, 0, 370, 189, 137, 0, 0, 0, 0, 0, + /* 1420 */ 313, 0, 0, 0, 200, 201, 202, 203, 204, 205, + /* 1430 */ 206, 324, 0, 255, 327, 328, 329, 330, 331, 332, + /* 1440 */ 0, 334, 0, 0, 0, 42, 0, 0, 0, 0, + /* 1450 */ 0, 0, 22, 0, 0, 255, 42, 91, 46, 39, + /* 1460 */ 353, 283, 0, 0, 0, 0, 14, 43, 0, 291, + /* 1470 */ 39, 14, 46, 366, 296, 40, 298, 370, 0, 0, + /* 1480 */ 0, 154, 0, 283, 39, 0, 0, 60, 0, 0, + /* 1490 */ 35, 291, 0, 0, 35, 0, 296, 0, 298, 39, + /* 1500 */ 39, 0, 324, 0, 35, 327, 328, 329, 330, 331, + /* 1510 */ 332, 39, 334, 47, 47, 337, 35, 47, 255, 341, + /* 1520 */ 342, 47, 39, 0, 324, 89, 35, 327, 328, 329, + /* 1530 */ 330, 331, 332, 22, 334, 0, 255, 337, 0, 35, + /* 1540 */ 35, 341, 342, 35, 35, 43, 283, 35, 35, 43, + /* 1550 */ 35, 22, 0, 22, 291, 0, 49, 35, 22, 296, + /* 1560 */ 0, 298, 35, 0, 283, 35, 0, 22, 20, 0, + /* 1570 */ 0, 22, 291, 0, 35, 150, 169, 296, 150, 298, + /* 1580 */ 147, 0, 0, 0, 150, 0, 43, 324, 225, 255, + /* 1590 */ 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, + /* 1600 */ 82, 43, 43, 83, 83, 324, 82, 82, 327, 328, + /* 1610 */ 329, 330, 331, 332, 82, 334, 83, 283, 337, 82, + /* 1620 */ 46, 46, 82, 342, 83, 291, 46, 152, 219, 43, + /* 1630 */ 296, 43, 298, 225, 83, 46, 83, 83, 43, 83, + /* 1640 */ 35, 35, 35, 255, 310, 2, 35, 35, 35, 46, + /* 1650 */ 83, 43, 22, 82, 255, 83, 0, 0, 324, 82, + /* 1660 */ 189, 327, 328, 329, 330, 331, 332, 46, 334, 82, + /* 1670 */ 39, 283, 82, 46, 83, 191, 83, 178, 82, 291, + /* 1680 */ 82, 46, 283, 225, 296, 83, 298, 22, 35, 92, + /* 1690 */ 291, 82, 148, 146, 93, 296, 82, 298, 82, 82, + /* 1700 */ 82, 22, 83, 35, 82, 35, 83, 82, 35, 83, + /* 1710 */ 82, 255, 324, 35, 82, 327, 328, 329, 330, 331, + /* 1720 */ 332, 83, 334, 324, 83, 35, 327, 328, 329, 330, + /* 1730 */ 331, 332, 255, 334, 82, 106, 94, 82, 35, 283, + /* 1740 */ 106, 82, 106, 106, 82, 43, 22, 291, 60, 35, + /* 1750 */ 65, 59, 296, 365, 298, 80, 43, 35, 35, 22, + /* 1760 */ 283, 35, 35, 35, 35, 35, 310, 35, 291, 65, + /* 1770 */ 35, 372, 0, 296, 255, 298, 35, 35, 35, 35, + /* 1780 */ 324, 35, 35, 327, 328, 329, 330, 331, 332, 39, + /* 1790 */ 334, 0, 47, 35, 39, 47, 0, 255, 35, 47, + /* 1800 */ 39, 324, 283, 0, 327, 328, 329, 330, 331, 332, + /* 1810 */ 291, 334, 35, 336, 47, 296, 0, 298, 39, 35, + /* 1820 */ 35, 0, 22, 21, 375, 283, 22, 22, 21, 310, + /* 1830 */ 20, 375, 375, 291, 375, 375, 375, 375, 296, 375, + /* 1840 */ 298, 375, 375, 324, 375, 375, 327, 328, 329, 330, + /* 1850 */ 331, 332, 310, 334, 255, 375, 375, 375, 375, 375, + /* 1860 */ 375, 375, 375, 375, 375, 255, 324, 375, 375, 327, + /* 1870 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 255, + /* 1880 */ 375, 375, 283, 375, 375, 375, 375, 375, 375, 375, + /* 1890 */ 291, 375, 375, 283, 375, 296, 375, 298, 375, 375, + /* 1900 */ 375, 291, 375, 375, 375, 375, 296, 283, 298, 375, + /* 1910 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 1920 */ 296, 255, 298, 324, 375, 375, 327, 328, 329, 330, + /* 1930 */ 331, 332, 375, 334, 324, 255, 375, 327, 328, 329, + /* 1940 */ 330, 331, 332, 375, 334, 375, 255, 375, 324, 283, + /* 1950 */ 375, 327, 328, 329, 330, 331, 332, 291, 334, 375, + /* 1960 */ 375, 375, 296, 283, 298, 375, 375, 375, 375, 375, + /* 1970 */ 375, 291, 375, 375, 283, 375, 296, 375, 298, 375, + /* 1980 */ 375, 375, 291, 375, 375, 375, 375, 296, 255, 298, + /* 1990 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2000 */ 334, 375, 375, 375, 324, 375, 375, 327, 328, 329, + /* 2010 */ 330, 331, 332, 375, 334, 324, 283, 375, 327, 328, + /* 2020 */ 329, 330, 331, 332, 291, 334, 375, 375, 375, 296, + /* 2030 */ 255, 298, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2040 */ 375, 255, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2050 */ 375, 375, 375, 255, 375, 375, 375, 324, 283, 375, + /* 2060 */ 327, 328, 329, 330, 331, 332, 291, 334, 375, 283, + /* 2070 */ 375, 296, 375, 298, 375, 375, 375, 291, 375, 375, + /* 2080 */ 375, 283, 296, 375, 298, 375, 375, 375, 375, 291, + /* 2090 */ 375, 375, 375, 375, 296, 375, 298, 375, 375, 324, + /* 2100 */ 375, 375, 327, 328, 329, 330, 331, 332, 255, 334, + /* 2110 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2120 */ 334, 375, 324, 375, 375, 327, 328, 329, 330, 331, + /* 2130 */ 332, 375, 334, 375, 375, 255, 283, 375, 375, 375, + /* 2140 */ 375, 375, 375, 375, 291, 375, 375, 375, 375, 296, + /* 2150 */ 375, 298, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2160 */ 375, 375, 255, 283, 375, 375, 375, 375, 375, 375, + /* 2170 */ 375, 291, 375, 375, 375, 375, 296, 324, 298, 375, + /* 2180 */ 327, 328, 329, 330, 331, 332, 375, 334, 375, 255, + /* 2190 */ 283, 375, 375, 375, 375, 375, 375, 375, 291, 375, + /* 2200 */ 375, 375, 375, 296, 324, 298, 375, 327, 328, 329, + /* 2210 */ 330, 331, 332, 375, 334, 375, 375, 283, 375, 375, + /* 2220 */ 375, 375, 375, 375, 375, 291, 375, 375, 375, 375, + /* 2230 */ 296, 324, 298, 375, 327, 328, 329, 330, 331, 332, + /* 2240 */ 375, 334, 375, 255, 375, 375, 375, 375, 375, 375, + /* 2250 */ 375, 375, 255, 375, 375, 375, 375, 375, 324, 375, + /* 2260 */ 375, 327, 328, 329, 330, 331, 332, 375, 334, 375, + /* 2270 */ 255, 283, 375, 375, 375, 375, 375, 375, 375, 291, + /* 2280 */ 283, 375, 375, 375, 296, 375, 298, 375, 291, 375, + /* 2290 */ 375, 375, 375, 296, 375, 298, 375, 375, 283, 375, + /* 2300 */ 375, 375, 375, 375, 375, 375, 291, 375, 375, 375, + /* 2310 */ 375, 296, 324, 298, 375, 327, 328, 329, 330, 331, + /* 2320 */ 332, 324, 334, 255, 327, 328, 329, 330, 331, 332, + /* 2330 */ 375, 334, 375, 375, 375, 375, 375, 255, 375, 324, + /* 2340 */ 375, 375, 327, 328, 329, 330, 331, 332, 375, 334, + /* 2350 */ 375, 283, 375, 375, 375, 375, 375, 375, 375, 291, + /* 2360 */ 375, 375, 375, 375, 296, 283, 298, 375, 375, 375, + /* 2370 */ 375, 375, 375, 291, 375, 375, 375, 375, 296, 375, + /* 2380 */ 298, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2390 */ 375, 255, 324, 375, 375, 327, 328, 329, 330, 331, + /* 2400 */ 332, 375, 334, 375, 375, 375, 324, 375, 375, 327, + /* 2410 */ 328, 329, 330, 331, 332, 375, 334, 375, 375, 283, + /* 2420 */ 375, 375, 375, 375, 375, 375, 375, 291, 375, 375, + /* 2430 */ 375, 375, 296, 375, 298, 375, 375, 375, 375, 375, + /* 2440 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2450 */ 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + /* 2460 */ 324, 375, 375, 327, 328, 329, 330, 331, 332, 375, + /* 2470 */ 334, }; #define YY_SHIFT_COUNT (652) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1824) +#define YY_SHIFT_MAX (1821) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 945, 0, 0, 57, 252, 252, 252, 252, 309, 309, - /* 10 */ 252, 252, 504, 561, 756, 561, 561, 561, 561, 561, - /* 20 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - /* 30 */ 561, 561, 561, 561, 561, 561, 561, 561, 561, 561, - /* 40 */ 561, 561, 54, 54, 246, 246, 246, 1238, 1238, 1238, - /* 50 */ 1238, 186, 87, 254, 11, 11, 239, 239, 242, 10, - /* 60 */ 254, 254, 11, 11, 11, 11, 11, 11, 11, 11, - /* 70 */ 99, 11, 11, 11, 150, 261, 313, 11, 11, 313, - /* 80 */ 11, 313, 313, 313, 11, 268, 752, 839, 1003, 1003, - /* 90 */ 438, 111, 245, 245, 245, 245, 245, 245, 245, 245, - /* 100 */ 245, 245, 245, 245, 245, 245, 245, 245, 245, 245, - /* 110 */ 245, 698, 10, 457, 457, 319, 618, 222, 222, 222, - /* 120 */ 358, 618, 327, 261, 6, 6, 313, 313, 361, 361, - /* 130 */ 405, 460, 193, 193, 193, 193, 193, 193, 193, 1777, - /* 140 */ 21, 14, 372, 84, 310, 406, 270, 376, 473, 516, - /* 150 */ 791, 686, 773, 694, 507, 694, 797, 797, 797, 713, - /* 160 */ 790, 848, 1054, 1029, 1043, 921, 1054, 1054, 1042, 942, - /* 170 */ 942, 1054, 1070, 1070, 1075, 99, 261, 99, 1084, 1092, - /* 180 */ 99, 1084, 99, 1101, 99, 99, 1054, 99, 1070, 313, - /* 190 */ 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - /* 200 */ 1054, 1070, 361, 1075, 268, 986, 261, 268, 1054, 1054, - /* 210 */ 1084, 268, 1149, 361, 943, 949, 361, 943, 949, 361, - /* 220 */ 361, 313, 946, 1039, 943, 963, 965, 999, 848, 1005, - /* 230 */ 327, 1206, 1185, 989, 992, 1010, 989, 992, 989, 992, - /* 240 */ 1163, 949, 361, 361, 361, 361, 361, 949, 361, 1107, - /* 250 */ 327, 1101, 268, 405, 268, 327, 1210, 361, 460, 1054, - /* 260 */ 268, 1265, 1070, 2489, 2489, 2489, 2489, 2489, 2489, 2489, - /* 270 */ 162, 885, 123, 574, 199, 576, 467, 476, 540, 707, - /* 280 */ 662, 549, 549, 549, 549, 549, 549, 549, 549, 624, - /* 290 */ 681, 224, 263, 263, 251, 558, 410, 3, 603, 521, - /* 300 */ 529, 529, 529, 529, 249, 96, 823, 884, 840, 842, - /* 310 */ 856, 888, 872, 913, 978, 852, 820, 930, 937, 987, - /* 320 */ 876, 787, 802, 953, 920, 954, 489, 956, 958, 960, - /* 330 */ 961, 962, 864, 974, 980, 981, 983, 985, 1013, 1016, - /* 340 */ 339, 975, 126, 1315, 1316, 1276, 1319, 1248, 1320, 1288, - /* 350 */ 1144, 1291, 1292, 1293, 1148, 1330, 1296, 1297, 1152, 1334, - /* 360 */ 1154, 1337, 1303, 1340, 1321, 1341, 1310, 1346, 1266, 1179, - /* 370 */ 1192, 1187, 1198, 1362, 1363, 1205, 1207, 1367, 1368, 1323, - /* 380 */ 1370, 1371, 1372, 1231, 1374, 1375, 1378, 1386, 1388, 1252, - /* 390 */ 1355, 1391, 1255, 1394, 1395, 1396, 1398, 1399, 1400, 1402, - /* 400 */ 1407, 1408, 1409, 1410, 1411, 1413, 1414, 1373, 1416, 1421, - /* 410 */ 1422, 1423, 1426, 1427, 1383, 1428, 1429, 1430, 1431, 1432, - /* 420 */ 1433, 1392, 1417, 1401, 1443, 1389, 1446, 1418, 1465, 1434, - /* 430 */ 1436, 1466, 1467, 1468, 1437, 1318, 1469, 1470, 1473, 1387, - /* 440 */ 1477, 1478, 1448, 1435, 1442, 1485, 1453, 1454, 1450, 1502, - /* 450 */ 1471, 1456, 1472, 1504, 1474, 1458, 1475, 1507, 1510, 1521, - /* 460 */ 1523, 1438, 1424, 1489, 1503, 1526, 1492, 1496, 1497, 1498, - /* 470 */ 1491, 1494, 1500, 1505, 1509, 1538, 1517, 1542, 1524, 1501, - /* 480 */ 1545, 1525, 1514, 1551, 1518, 1552, 1519, 1555, 1534, 1539, - /* 490 */ 1558, 1412, 1531, 1568, 1420, 1549, 1440, 1439, 1580, 1581, - /* 500 */ 1441, 1444, 1583, 1592, 1594, 1554, 1556, 1379, 1522, 1512, - /* 510 */ 1527, 1520, 1562, 1528, 1533, 1535, 1536, 1530, 1564, 1574, - /* 520 */ 1576, 1541, 1565, 1393, 1544, 1557, 1578, 1384, 1567, 1579, - /* 530 */ 1559, 1585, 1415, 1560, 1602, 1604, 1606, 1609, 1610, 1611, - /* 540 */ 1560, 1646, 1462, 1613, 1577, 1582, 1584, 1615, 1586, 1587, - /* 550 */ 1616, 1637, 1476, 1588, 1589, 1590, 1593, 1666, 1595, 1532, - /* 560 */ 1597, 1674, 1642, 1537, 1600, 1596, 1638, 1639, 1605, 1607, - /* 570 */ 1614, 1669, 1620, 1599, 1612, 1658, 1662, 1621, 1622, 1663, - /* 580 */ 1624, 1632, 1682, 1636, 1640, 1684, 1643, 1641, 1685, 1644, - /* 590 */ 1623, 1633, 1634, 1645, 1699, 1628, 1656, 1660, 1710, 1664, - /* 600 */ 1704, 1704, 1726, 1689, 1691, 1719, 1693, 1675, 1713, 1725, - /* 610 */ 1727, 1728, 1729, 1730, 1739, 1732, 1733, 1705, 1491, 1743, - /* 620 */ 1494, 1745, 1747, 1748, 1749, 1751, 1752, 1797, 1763, 1753, - /* 630 */ 1760, 1801, 1768, 1757, 1766, 1806, 1773, 1764, 1774, 1812, - /* 640 */ 1779, 1769, 1776, 1817, 1783, 1784, 1820, 1800, 1804, 1805, - /* 650 */ 1814, 1807, 1824, + /* 0 */ 891, 0, 0, 57, 57, 254, 254, 254, 311, 311, + /* 10 */ 254, 254, 508, 565, 762, 565, 565, 565, 565, 565, + /* 20 */ 565, 565, 565, 565, 565, 565, 565, 565, 565, 565, + /* 30 */ 565, 565, 565, 565, 565, 565, 565, 565, 565, 565, + /* 40 */ 565, 565, 302, 302, 85, 85, 85, 1224, 1224, 1224, + /* 50 */ 1224, 54, 86, 202, 154, 154, 53, 53, 56, 190, + /* 60 */ 202, 202, 154, 154, 154, 154, 154, 154, 154, 154, + /* 70 */ 15, 154, 154, 154, 171, 214, 298, 154, 154, 298, + /* 80 */ 154, 298, 298, 298, 154, 274, 758, 223, 477, 477, + /* 90 */ 267, 409, 755, 755, 755, 755, 755, 755, 755, 755, + /* 100 */ 755, 755, 755, 755, 755, 755, 755, 755, 755, 755, + /* 110 */ 755, 66, 190, 209, 209, 38, 433, 457, 457, 457, + /* 120 */ 123, 433, 318, 214, 31, 31, 298, 298, 423, 423, + /* 130 */ 306, 429, 252, 252, 252, 252, 252, 252, 252, 131, + /* 140 */ 21, 14, 374, 233, 71, 388, 511, 88, 199, 315, + /* 150 */ 770, 512, 546, 610, 784, 610, 819, 665, 665, 665, + /* 160 */ 792, 617, 863, 1072, 1060, 1089, 966, 1072, 1072, 1105, + /* 170 */ 1004, 1004, 1072, 1134, 1134, 1137, 15, 214, 15, 1142, + /* 180 */ 1145, 15, 1142, 15, 1147, 15, 15, 1072, 15, 1134, + /* 190 */ 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, + /* 200 */ 298, 1072, 1134, 423, 1137, 274, 1032, 214, 274, 1072, + /* 210 */ 1072, 1142, 274, 1199, 423, 992, 1002, 423, 992, 1002, + /* 220 */ 423, 423, 298, 1008, 1091, 992, 1007, 1013, 1028, 863, + /* 230 */ 1033, 318, 1238, 1020, 1027, 1016, 1020, 1027, 1020, 1027, + /* 240 */ 1182, 1002, 423, 423, 423, 423, 423, 1002, 423, 1164, + /* 250 */ 318, 1147, 274, 306, 274, 318, 1240, 423, 429, 1072, + /* 260 */ 274, 1295, 1134, 2471, 2471, 2471, 2471, 2471, 2471, 2471, + /* 270 */ 334, 502, 717, 96, 412, 580, 648, 839, 855, 1019, + /* 280 */ 926, 980, 980, 980, 980, 980, 980, 980, 980, 431, + /* 290 */ 685, 226, 365, 365, 425, 485, 161, 50, 249, 570, + /* 300 */ 328, 355, 355, 355, 355, 699, 739, 956, 746, 818, + /* 310 */ 835, 837, 900, 981, 1023, 921, 727, 967, 970, 929, + /* 320 */ 857, 803, 867, 1006, 335, 1012, 960, 1021, 1025, 1031, + /* 330 */ 1045, 1051, 972, 973, 1059, 1090, 1097, 1098, 1100, 1101, + /* 340 */ 974, 1026, 1036, 1339, 1344, 1303, 1346, 1274, 1348, 1314, + /* 350 */ 1167, 1317, 1318, 1319, 1173, 1357, 1323, 1324, 1177, 1361, + /* 360 */ 1180, 1364, 1330, 1367, 1353, 1368, 1342, 1378, 1297, 1212, + /* 370 */ 1214, 1217, 1220, 1384, 1385, 1227, 1230, 1391, 1392, 1347, + /* 380 */ 1394, 1396, 1397, 1257, 1400, 1401, 1402, 1404, 1406, 1270, + /* 390 */ 1374, 1410, 1277, 1411, 1415, 1416, 1417, 1418, 1419, 1421, + /* 400 */ 1422, 1423, 1432, 1440, 1442, 1443, 1444, 1403, 1446, 1447, + /* 410 */ 1448, 1449, 1450, 1451, 1430, 1453, 1454, 1462, 1463, 1464, + /* 420 */ 1465, 1414, 1420, 1424, 1452, 1412, 1457, 1426, 1468, 1435, + /* 430 */ 1431, 1478, 1479, 1480, 1445, 1327, 1482, 1485, 1486, 1427, + /* 440 */ 1488, 1489, 1455, 1466, 1460, 1492, 1459, 1467, 1461, 1493, + /* 450 */ 1469, 1470, 1472, 1495, 1481, 1474, 1483, 1497, 1501, 1503, + /* 460 */ 1523, 1366, 1436, 1491, 1511, 1535, 1504, 1505, 1508, 1509, + /* 470 */ 1502, 1506, 1512, 1513, 1515, 1538, 1529, 1552, 1531, 1507, + /* 480 */ 1555, 1536, 1522, 1560, 1527, 1563, 1530, 1566, 1545, 1548, + /* 490 */ 1569, 1425, 1539, 1570, 1407, 1549, 1428, 1433, 1573, 1581, + /* 500 */ 1434, 1475, 1582, 1583, 1585, 1543, 1363, 1518, 1520, 1524, + /* 510 */ 1521, 1558, 1533, 1525, 1532, 1537, 1541, 1559, 1574, 1575, + /* 520 */ 1540, 1586, 1408, 1551, 1553, 1580, 1409, 1588, 1589, 1554, + /* 530 */ 1595, 1458, 1556, 1605, 1606, 1607, 1611, 1612, 1613, 1556, + /* 540 */ 1643, 1471, 1608, 1567, 1571, 1572, 1603, 1577, 1587, 1621, + /* 550 */ 1630, 1484, 1590, 1591, 1593, 1596, 1499, 1656, 1598, 1544, + /* 560 */ 1609, 1657, 1631, 1547, 1614, 1597, 1627, 1635, 1616, 1602, + /* 570 */ 1617, 1665, 1618, 1601, 1619, 1653, 1668, 1622, 1623, 1670, + /* 580 */ 1625, 1626, 1673, 1628, 1638, 1678, 1632, 1641, 1690, 1652, + /* 590 */ 1629, 1634, 1636, 1637, 1679, 1642, 1655, 1659, 1703, 1662, + /* 600 */ 1702, 1702, 1724, 1688, 1692, 1714, 1685, 1675, 1713, 1722, + /* 610 */ 1723, 1726, 1727, 1728, 1737, 1729, 1730, 1704, 1502, 1732, + /* 620 */ 1506, 1735, 1741, 1742, 1743, 1744, 1746, 1772, 1747, 1745, + /* 630 */ 1750, 1791, 1758, 1748, 1755, 1796, 1763, 1752, 1761, 1803, + /* 640 */ 1777, 1767, 1779, 1816, 1784, 1785, 1821, 1800, 1802, 1804, + /* 650 */ 1805, 1807, 1810, }; #define YY_REDUCE_COUNT (269) -#define YY_REDUCE_MIN (-287) -#define YY_REDUCE_MAX (2156) +#define YY_REDUCE_MIN (-329) +#define YY_REDUCE_MAX (2136) static const short yy_reduce_ofst[] = { - /* 0 */ -248, 72, 855, -195, 322, 575, 908, 950, 1028, 1055, - /* 10 */ 306, 1123, 1165, 1190, 1247, 1304, 1325, 1382, 1405, 1447, - /* 20 */ 1463, 1513, 1570, 1631, 1648, 1690, 1701, 1712, 1754, 1772, - /* 30 */ 1796, 1852, 1902, 1913, 1955, 1966, 1980, 2036, 2050, 2100, - /* 40 */ 2142, 2156, 769, 1219, -234, 90, 398, -278, -260, -254, - /* 50 */ -105, -245, -209, -42, -261, -164, -256, -250, 4, -113, - /* 60 */ 13, 24, 131, 258, 262, 338, 340, 543, 548, 550, - /* 70 */ -246, 552, 555, 557, 133, -211, 62, 570, 645, -224, - /* 80 */ 703, 73, -190, 86, 704, 23, 59, 185, 185, 185, - /* 90 */ -237, -102, -153, 276, 278, 288, 315, 362, 419, 420, - /* 100 */ 435, 437, 440, 477, 479, 480, 483, 531, 564, 573, - /* 110 */ 615, -255, 281, -40, 379, 333, 444, -287, -242, 458, - /* 120 */ -125, 539, 106, 512, 441, 481, 316, 553, 391, 571, - /* 130 */ 566, 592, 378, 386, 567, 584, 638, 642, 690, 225, - /* 140 */ 731, 717, 619, 627, 736, 688, 650, 733, 733, 759, - /* 150 */ 762, 742, 737, 711, 711, 711, 701, 705, 706, 718, - /* 160 */ 733, 753, 814, 758, 812, 768, 822, 824, 785, 789, - /* 170 */ 792, 828, 837, 838, 780, 841, 807, 844, 800, 804, - /* 180 */ 853, 809, 858, 830, 859, 861, 874, 868, 882, 860, - /* 190 */ 862, 865, 866, 869, 871, 873, 875, 877, 878, 879, - /* 200 */ 881, 890, 846, 836, 892, 847, 880, 899, 904, 906, - /* 210 */ 863, 905, 850, 894, 815, 886, 898, 821, 891, 907, - /* 220 */ 911, 733, 826, 849, 843, 851, 854, 887, 902, 711, - /* 230 */ 936, 909, 900, 889, 895, 883, 893, 896, 897, 901, - /* 240 */ 915, 959, 972, 973, 976, 990, 993, 964, 994, 952, - /* 250 */ 970, 984, 1011, 1006, 1030, 1007, 1012, 1001, 1027, 1038, - /* 260 */ 1041, 1046, 1050, 996, 997, 1032, 1036, 1037, 1049, 1063, + /* 0 */ -246, 688, 769, -197, 789, 881, 944, 971, 1042, 1107, + /* 10 */ 1178, 1200, 1263, 348, 1281, 1334, 1388, 1399, 1456, 1477, + /* 20 */ 1519, 1542, 1599, 1610, 1624, 1666, 1680, 1691, 1733, 1775, + /* 30 */ 1786, 1798, 1853, 1880, 1907, 1934, 1988, 1997, 2015, 2068, + /* 40 */ 2082, 2136, 288, 490, -236, -122, -20, -280, -262, -260, + /* 50 */ -55, -285, -80, -41, 206, 289, -259, -252, -329, -279, + /* 60 */ -126, -49, 268, 341, 342, 351, 459, 460, 461, 517, + /* 70 */ -250, 520, 543, 559, -251, -181, -104, 642, 645, 270, + /* 80 */ 709, 292, 330, 299, 711, 332, -234, -190, -190, -190, + /* 90 */ -99, 146, 120, 244, 354, 356, 385, 444, 532, 549, + /* 100 */ 569, 576, 621, 651, 657, 682, 691, 694, 695, 725, + /* 110 */ 742, 20, 229, -101, 407, 11, 264, 464, 467, 500, + /* 120 */ 80, 456, 83, 7, -307, -97, 189, 325, 149, 436, + /* 130 */ 442, 640, -273, 266, 297, 443, 452, 472, 509, 259, + /* 140 */ 563, 554, 469, 494, 609, 595, 622, 715, 715, 773, + /* 150 */ 764, 745, 733, 712, 712, 712, 718, 702, 704, 714, + /* 160 */ 729, 715, 768, 842, 794, 856, 814, 882, 883, 845, + /* 170 */ 849, 850, 890, 898, 899, 840, 893, 860, 894, 851, + /* 180 */ 852, 901, 858, 904, 870, 908, 909, 915, 918, 925, + /* 190 */ 903, 905, 906, 907, 910, 911, 912, 913, 914, 917, + /* 200 */ 919, 924, 934, 896, 879, 936, 886, 916, 941, 953, + /* 210 */ 954, 895, 955, 902, 933, 866, 927, 935, 873, 931, + /* 220 */ 943, 945, 715, 885, 887, 892, 897, 920, 923, 928, + /* 230 */ 712, 965, 938, 922, 939, 930, 937, 942, 940, 947, + /* 240 */ 948, 958, 986, 987, 988, 994, 996, 963, 997, 989, + /* 250 */ 1029, 1014, 1052, 1037, 1054, 1030, 1039, 1034, 1056, 1061, + /* 260 */ 1062, 1074, 1077, 1035, 1024, 1064, 1065, 1066, 1070, 1084, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 10 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 20 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 30 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 40 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 50 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 60 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 70 */ 1508, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 80 */ 1436, 1436, 1436, 1436, 1436, 1506, 1659, 1436, 1834, 1436, - /* 90 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 100 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 110 */ 1436, 1436, 1436, 1436, 1436, 1508, 1436, 1846, 1846, 1846, - /* 120 */ 1506, 1436, 1436, 1436, 1703, 1703, 1436, 1436, 1436, 1436, - /* 130 */ 1602, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1695, - /* 140 */ 1436, 1436, 1916, 1436, 1436, 1701, 1870, 1436, 1436, 1436, - /* 150 */ 1436, 1555, 1862, 1838, 1852, 1839, 1901, 1901, 1901, 1855, - /* 160 */ 1436, 1866, 1436, 1436, 1436, 1687, 1436, 1436, 1664, 1661, - /* 170 */ 1661, 1436, 1436, 1436, 1436, 1508, 1436, 1508, 1436, 1436, - /* 180 */ 1508, 1436, 1508, 1436, 1508, 1508, 1436, 1508, 1436, 1436, - /* 190 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 200 */ 1436, 1436, 1436, 1436, 1506, 1697, 1436, 1506, 1436, 1436, - /* 210 */ 1436, 1506, 1436, 1436, 1877, 1875, 1436, 1877, 1875, 1436, - /* 220 */ 1436, 1436, 1889, 1885, 1877, 1893, 1891, 1868, 1866, 1852, - /* 230 */ 1436, 1436, 1836, 1907, 1903, 1919, 1907, 1903, 1907, 1903, - /* 240 */ 1436, 1875, 1436, 1436, 1436, 1436, 1436, 1875, 1436, 1436, - /* 250 */ 1436, 1436, 1506, 1436, 1506, 1436, 1571, 1436, 1436, 1436, - /* 260 */ 1506, 1468, 1436, 1689, 1703, 1605, 1605, 1605, 1509, 1441, - /* 270 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 280 */ 1436, 1772, 1888, 1887, 1810, 1809, 1808, 1806, 1771, 1436, - /* 290 */ 1436, 1567, 1770, 1769, 1436, 1436, 1436, 1436, 1436, 1436, - /* 300 */ 1763, 1764, 1762, 1761, 1436, 1436, 1436, 1436, 1436, 1436, - /* 310 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1835, - /* 320 */ 1436, 1904, 1908, 1436, 1436, 1436, 1746, 1436, 1436, 1436, - /* 330 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 340 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 350 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 360 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 370 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 380 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 390 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 400 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 410 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 420 */ 1436, 1436, 1436, 1473, 1436, 1436, 1436, 1436, 1436, 1436, - /* 430 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 440 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 450 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 460 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 470 */ 1536, 1535, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 480 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 490 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 500 */ 1436, 1436, 1436, 1436, 1436, 1859, 1869, 1436, 1436, 1436, - /* 510 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 520 */ 1746, 1436, 1886, 1436, 1845, 1841, 1436, 1436, 1837, 1436, - /* 530 */ 1436, 1902, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 540 */ 1436, 1830, 1436, 1803, 1436, 1436, 1436, 1436, 1436, 1436, - /* 550 */ 1436, 1436, 1757, 1436, 1436, 1436, 1436, 1707, 1436, 1436, - /* 560 */ 1436, 1436, 1436, 1436, 1436, 1436, 1745, 1436, 1788, 1436, - /* 570 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1599, 1436, 1436, - /* 580 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 590 */ 1584, 1582, 1581, 1580, 1436, 1577, 1436, 1436, 1436, 1436, - /* 600 */ 1608, 1607, 1436, 1436, 1436, 1436, 1436, 1436, 1528, 1436, - /* 610 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1519, 1436, - /* 620 */ 1518, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 630 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 640 */ 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, 1436, - /* 650 */ 1436, 1436, 1436, + /* 0 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 10 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 20 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 30 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 40 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 50 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 60 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 70 */ 1509, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 80 */ 1437, 1437, 1437, 1437, 1437, 1507, 1660, 1437, 1836, 1437, + /* 90 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 100 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 110 */ 1437, 1437, 1437, 1437, 1437, 1509, 1437, 1848, 1848, 1848, + /* 120 */ 1507, 1437, 1437, 1437, 1704, 1704, 1437, 1437, 1437, 1437, + /* 130 */ 1603, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1696, + /* 140 */ 1437, 1437, 1917, 1437, 1437, 1702, 1871, 1437, 1437, 1437, + /* 150 */ 1437, 1556, 1863, 1840, 1854, 1841, 1838, 1902, 1902, 1902, + /* 160 */ 1857, 1437, 1867, 1437, 1437, 1437, 1688, 1437, 1437, 1665, + /* 170 */ 1662, 1662, 1437, 1437, 1437, 1437, 1509, 1437, 1509, 1437, + /* 180 */ 1437, 1509, 1437, 1509, 1437, 1509, 1509, 1437, 1509, 1437, + /* 190 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 200 */ 1437, 1437, 1437, 1437, 1437, 1507, 1698, 1437, 1507, 1437, + /* 210 */ 1437, 1437, 1507, 1437, 1437, 1878, 1876, 1437, 1878, 1876, + /* 220 */ 1437, 1437, 1437, 1890, 1886, 1878, 1894, 1892, 1869, 1867, + /* 230 */ 1854, 1437, 1437, 1908, 1904, 1920, 1908, 1904, 1908, 1904, + /* 240 */ 1437, 1876, 1437, 1437, 1437, 1437, 1437, 1876, 1437, 1437, + /* 250 */ 1437, 1437, 1507, 1437, 1507, 1437, 1572, 1437, 1437, 1437, + /* 260 */ 1507, 1469, 1437, 1690, 1704, 1606, 1606, 1606, 1510, 1442, + /* 270 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 280 */ 1437, 1774, 1889, 1888, 1812, 1811, 1810, 1808, 1773, 1437, + /* 290 */ 1437, 1568, 1772, 1771, 1437, 1437, 1437, 1437, 1437, 1437, + /* 300 */ 1437, 1765, 1766, 1764, 1763, 1437, 1437, 1437, 1437, 1437, + /* 310 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1837, + /* 320 */ 1437, 1905, 1909, 1437, 1437, 1437, 1748, 1437, 1437, 1437, + /* 330 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 340 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 350 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 360 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 370 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 380 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 390 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 400 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 410 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 420 */ 1437, 1437, 1437, 1474, 1437, 1437, 1437, 1437, 1437, 1437, + /* 430 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 440 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 450 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 460 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 470 */ 1537, 1536, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 480 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 490 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 500 */ 1437, 1437, 1437, 1437, 1437, 1870, 1437, 1437, 1437, 1437, + /* 510 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1748, + /* 520 */ 1437, 1887, 1437, 1847, 1843, 1437, 1437, 1839, 1437, 1437, + /* 530 */ 1903, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 540 */ 1832, 1437, 1805, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 550 */ 1437, 1759, 1437, 1437, 1437, 1437, 1437, 1708, 1437, 1437, + /* 560 */ 1437, 1437, 1437, 1437, 1437, 1437, 1747, 1437, 1790, 1437, + /* 570 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1600, 1437, 1437, + /* 580 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 590 */ 1585, 1583, 1582, 1581, 1437, 1578, 1437, 1437, 1437, 1437, + /* 600 */ 1609, 1608, 1437, 1437, 1437, 1437, 1437, 1437, 1529, 1437, + /* 610 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1520, 1437, + /* 620 */ 1519, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 630 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 640 */ 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, 1437, + /* 650 */ 1437, 1437, 1437, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1085,6 +1083,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* TRIGGER => nothing */ 0, /* AT_ONCE => nothing */ 0, /* WINDOW_CLOSE => nothing */ + 0, /* IGNORE => nothing */ + 0, /* EXPIRED => nothing */ 0, /* KILL => nothing */ 0, /* CONNECTION => nothing */ 0, /* TRANSACTION => nothing */ @@ -1152,12 +1152,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 243, /* NK_BITNOT => ID */ - 243, /* INSERT => ID */ - 243, /* VALUES => ID */ - 243, /* IMPORT => ID */ - 243, /* NK_SEMI => ID */ - 243, /* FILE => ID */ + 245, /* NK_BITNOT => ID */ + 245, /* INSERT => ID */ + 245, /* VALUES => ID */ + 245, /* IMPORT => ID */ + 245, /* NK_SEMI => ID */ + 245, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1422,203 +1422,204 @@ static const char *const yyTokenName[] = { /* 174 */ "TRIGGER", /* 175 */ "AT_ONCE", /* 176 */ "WINDOW_CLOSE", - /* 177 */ "KILL", - /* 178 */ "CONNECTION", - /* 179 */ "TRANSACTION", - /* 180 */ "BALANCE", - /* 181 */ "VGROUP", - /* 182 */ "MERGE", - /* 183 */ "REDISTRIBUTE", - /* 184 */ "SPLIT", - /* 185 */ "SYNCDB", - /* 186 */ "DELETE", - /* 187 */ "NULL", - /* 188 */ "NK_QUESTION", - /* 189 */ "NK_ARROW", - /* 190 */ "ROWTS", - /* 191 */ "TBNAME", - /* 192 */ "QSTARTTS", - /* 193 */ "QENDTS", - /* 194 */ "WSTARTTS", - /* 195 */ "WENDTS", - /* 196 */ "WDURATION", - /* 197 */ "CAST", - /* 198 */ "NOW", - /* 199 */ "TODAY", - /* 200 */ "TIMEZONE", - /* 201 */ "CLIENT_VERSION", - /* 202 */ "SERVER_VERSION", - /* 203 */ "SERVER_STATUS", - /* 204 */ "CURRENT_USER", - /* 205 */ "COUNT", - /* 206 */ "LAST_ROW", - /* 207 */ "BETWEEN", - /* 208 */ "IS", - /* 209 */ "NK_LT", - /* 210 */ "NK_GT", - /* 211 */ "NK_LE", - /* 212 */ "NK_GE", - /* 213 */ "NK_NE", - /* 214 */ "MATCH", - /* 215 */ "NMATCH", - /* 216 */ "CONTAINS", - /* 217 */ "JOIN", - /* 218 */ "INNER", - /* 219 */ "SELECT", - /* 220 */ "DISTINCT", - /* 221 */ "WHERE", - /* 222 */ "PARTITION", - /* 223 */ "BY", - /* 224 */ "SESSION", - /* 225 */ "STATE_WINDOW", - /* 226 */ "SLIDING", - /* 227 */ "FILL", - /* 228 */ "VALUE", - /* 229 */ "NONE", - /* 230 */ "PREV", - /* 231 */ "LINEAR", - /* 232 */ "NEXT", - /* 233 */ "HAVING", - /* 234 */ "RANGE", - /* 235 */ "EVERY", - /* 236 */ "ORDER", - /* 237 */ "SLIMIT", - /* 238 */ "SOFFSET", - /* 239 */ "LIMIT", - /* 240 */ "OFFSET", - /* 241 */ "ASC", - /* 242 */ "NULLS", - /* 243 */ "ID", - /* 244 */ "NK_BITNOT", - /* 245 */ "INSERT", - /* 246 */ "VALUES", - /* 247 */ "IMPORT", - /* 248 */ "NK_SEMI", - /* 249 */ "FILE", - /* 250 */ "cmd", - /* 251 */ "account_options", - /* 252 */ "alter_account_options", - /* 253 */ "literal", - /* 254 */ "alter_account_option", - /* 255 */ "user_name", - /* 256 */ "sysinfo_opt", - /* 257 */ "privileges", - /* 258 */ "priv_level", - /* 259 */ "priv_type_list", - /* 260 */ "priv_type", - /* 261 */ "db_name", - /* 262 */ "dnode_endpoint", - /* 263 */ "not_exists_opt", - /* 264 */ "db_options", - /* 265 */ "exists_opt", - /* 266 */ "alter_db_options", - /* 267 */ "integer_list", - /* 268 */ "variable_list", - /* 269 */ "retention_list", - /* 270 */ "alter_db_option", - /* 271 */ "retention", - /* 272 */ "full_table_name", - /* 273 */ "column_def_list", - /* 274 */ "tags_def_opt", - /* 275 */ "table_options", - /* 276 */ "multi_create_clause", - /* 277 */ "tags_def", - /* 278 */ "multi_drop_clause", - /* 279 */ "alter_table_clause", - /* 280 */ "alter_table_options", - /* 281 */ "column_name", - /* 282 */ "type_name", - /* 283 */ "signed_literal", - /* 284 */ "create_subtable_clause", - /* 285 */ "specific_tags_opt", - /* 286 */ "literal_list", - /* 287 */ "drop_table_clause", - /* 288 */ "col_name_list", - /* 289 */ "table_name", - /* 290 */ "column_def", - /* 291 */ "duration_list", - /* 292 */ "rollup_func_list", - /* 293 */ "alter_table_option", - /* 294 */ "duration_literal", - /* 295 */ "rollup_func_name", - /* 296 */ "function_name", - /* 297 */ "col_name", - /* 298 */ "db_name_cond_opt", - /* 299 */ "like_pattern_opt", - /* 300 */ "table_name_cond", - /* 301 */ "from_db_opt", - /* 302 */ "index_name", - /* 303 */ "index_options", - /* 304 */ "func_list", - /* 305 */ "sliding_opt", - /* 306 */ "sma_stream_opt", - /* 307 */ "func", - /* 308 */ "expression_list", - /* 309 */ "stream_options", - /* 310 */ "topic_name", - /* 311 */ "query_expression", - /* 312 */ "cgroup_name", - /* 313 */ "analyze_opt", - /* 314 */ "explain_options", - /* 315 */ "agg_func_opt", - /* 316 */ "bufsize_opt", - /* 317 */ "stream_name", - /* 318 */ "into_opt", - /* 319 */ "dnode_list", - /* 320 */ "where_clause_opt", - /* 321 */ "signed", - /* 322 */ "literal_func", - /* 323 */ "table_alias", - /* 324 */ "column_alias", - /* 325 */ "expression", - /* 326 */ "pseudo_column", - /* 327 */ "column_reference", - /* 328 */ "function_expression", - /* 329 */ "subquery", - /* 330 */ "star_func", - /* 331 */ "star_func_para_list", - /* 332 */ "noarg_func", - /* 333 */ "other_para_list", - /* 334 */ "star_func_para", - /* 335 */ "predicate", - /* 336 */ "compare_op", - /* 337 */ "in_op", - /* 338 */ "in_predicate_value", - /* 339 */ "boolean_value_expression", - /* 340 */ "boolean_primary", - /* 341 */ "common_expression", - /* 342 */ "from_clause_opt", - /* 343 */ "table_reference_list", - /* 344 */ "table_reference", - /* 345 */ "table_primary", - /* 346 */ "joined_table", - /* 347 */ "alias_opt", - /* 348 */ "parenthesized_joined_table", - /* 349 */ "join_type", - /* 350 */ "search_condition", - /* 351 */ "query_specification", - /* 352 */ "set_quantifier_opt", - /* 353 */ "select_list", - /* 354 */ "partition_by_clause_opt", - /* 355 */ "range_opt", - /* 356 */ "every_opt", - /* 357 */ "fill_opt", - /* 358 */ "twindow_clause_opt", - /* 359 */ "group_by_clause_opt", - /* 360 */ "having_clause_opt", - /* 361 */ "select_sublist", - /* 362 */ "select_item", - /* 363 */ "fill_mode", - /* 364 */ "group_by_list", - /* 365 */ "query_expression_body", - /* 366 */ "order_by_clause_opt", - /* 367 */ "slimit_clause_opt", - /* 368 */ "limit_clause_opt", - /* 369 */ "query_primary", - /* 370 */ "sort_specification_list", - /* 371 */ "sort_specification", - /* 372 */ "ordering_specification_opt", - /* 373 */ "null_ordering_opt", + /* 177 */ "IGNORE", + /* 178 */ "EXPIRED", + /* 179 */ "KILL", + /* 180 */ "CONNECTION", + /* 181 */ "TRANSACTION", + /* 182 */ "BALANCE", + /* 183 */ "VGROUP", + /* 184 */ "MERGE", + /* 185 */ "REDISTRIBUTE", + /* 186 */ "SPLIT", + /* 187 */ "SYNCDB", + /* 188 */ "DELETE", + /* 189 */ "NULL", + /* 190 */ "NK_QUESTION", + /* 191 */ "NK_ARROW", + /* 192 */ "ROWTS", + /* 193 */ "TBNAME", + /* 194 */ "QSTARTTS", + /* 195 */ "QENDTS", + /* 196 */ "WSTARTTS", + /* 197 */ "WENDTS", + /* 198 */ "WDURATION", + /* 199 */ "CAST", + /* 200 */ "NOW", + /* 201 */ "TODAY", + /* 202 */ "TIMEZONE", + /* 203 */ "CLIENT_VERSION", + /* 204 */ "SERVER_VERSION", + /* 205 */ "SERVER_STATUS", + /* 206 */ "CURRENT_USER", + /* 207 */ "COUNT", + /* 208 */ "LAST_ROW", + /* 209 */ "BETWEEN", + /* 210 */ "IS", + /* 211 */ "NK_LT", + /* 212 */ "NK_GT", + /* 213 */ "NK_LE", + /* 214 */ "NK_GE", + /* 215 */ "NK_NE", + /* 216 */ "MATCH", + /* 217 */ "NMATCH", + /* 218 */ "CONTAINS", + /* 219 */ "JOIN", + /* 220 */ "INNER", + /* 221 */ "SELECT", + /* 222 */ "DISTINCT", + /* 223 */ "WHERE", + /* 224 */ "PARTITION", + /* 225 */ "BY", + /* 226 */ "SESSION", + /* 227 */ "STATE_WINDOW", + /* 228 */ "SLIDING", + /* 229 */ "FILL", + /* 230 */ "VALUE", + /* 231 */ "NONE", + /* 232 */ "PREV", + /* 233 */ "LINEAR", + /* 234 */ "NEXT", + /* 235 */ "HAVING", + /* 236 */ "RANGE", + /* 237 */ "EVERY", + /* 238 */ "ORDER", + /* 239 */ "SLIMIT", + /* 240 */ "SOFFSET", + /* 241 */ "LIMIT", + /* 242 */ "OFFSET", + /* 243 */ "ASC", + /* 244 */ "NULLS", + /* 245 */ "ID", + /* 246 */ "NK_BITNOT", + /* 247 */ "INSERT", + /* 248 */ "VALUES", + /* 249 */ "IMPORT", + /* 250 */ "NK_SEMI", + /* 251 */ "FILE", + /* 252 */ "cmd", + /* 253 */ "account_options", + /* 254 */ "alter_account_options", + /* 255 */ "literal", + /* 256 */ "alter_account_option", + /* 257 */ "user_name", + /* 258 */ "sysinfo_opt", + /* 259 */ "privileges", + /* 260 */ "priv_level", + /* 261 */ "priv_type_list", + /* 262 */ "priv_type", + /* 263 */ "db_name", + /* 264 */ "dnode_endpoint", + /* 265 */ "not_exists_opt", + /* 266 */ "db_options", + /* 267 */ "exists_opt", + /* 268 */ "alter_db_options", + /* 269 */ "integer_list", + /* 270 */ "variable_list", + /* 271 */ "retention_list", + /* 272 */ "alter_db_option", + /* 273 */ "retention", + /* 274 */ "full_table_name", + /* 275 */ "column_def_list", + /* 276 */ "tags_def_opt", + /* 277 */ "table_options", + /* 278 */ "multi_create_clause", + /* 279 */ "tags_def", + /* 280 */ "multi_drop_clause", + /* 281 */ "alter_table_clause", + /* 282 */ "alter_table_options", + /* 283 */ "column_name", + /* 284 */ "type_name", + /* 285 */ "signed_literal", + /* 286 */ "create_subtable_clause", + /* 287 */ "specific_tags_opt", + /* 288 */ "literal_list", + /* 289 */ "drop_table_clause", + /* 290 */ "col_name_list", + /* 291 */ "table_name", + /* 292 */ "column_def", + /* 293 */ "duration_list", + /* 294 */ "rollup_func_list", + /* 295 */ "alter_table_option", + /* 296 */ "duration_literal", + /* 297 */ "rollup_func_name", + /* 298 */ "function_name", + /* 299 */ "col_name", + /* 300 */ "db_name_cond_opt", + /* 301 */ "like_pattern_opt", + /* 302 */ "table_name_cond", + /* 303 */ "from_db_opt", + /* 304 */ "index_name", + /* 305 */ "index_options", + /* 306 */ "func_list", + /* 307 */ "sliding_opt", + /* 308 */ "sma_stream_opt", + /* 309 */ "func", + /* 310 */ "expression_list", + /* 311 */ "stream_options", + /* 312 */ "topic_name", + /* 313 */ "query_expression", + /* 314 */ "cgroup_name", + /* 315 */ "analyze_opt", + /* 316 */ "explain_options", + /* 317 */ "agg_func_opt", + /* 318 */ "bufsize_opt", + /* 319 */ "stream_name", + /* 320 */ "into_opt", + /* 321 */ "dnode_list", + /* 322 */ "where_clause_opt", + /* 323 */ "signed", + /* 324 */ "literal_func", + /* 325 */ "table_alias", + /* 326 */ "column_alias", + /* 327 */ "expression", + /* 328 */ "pseudo_column", + /* 329 */ "column_reference", + /* 330 */ "function_expression", + /* 331 */ "subquery", + /* 332 */ "star_func", + /* 333 */ "star_func_para_list", + /* 334 */ "noarg_func", + /* 335 */ "other_para_list", + /* 336 */ "star_func_para", + /* 337 */ "predicate", + /* 338 */ "compare_op", + /* 339 */ "in_op", + /* 340 */ "in_predicate_value", + /* 341 */ "boolean_value_expression", + /* 342 */ "boolean_primary", + /* 343 */ "common_expression", + /* 344 */ "from_clause_opt", + /* 345 */ "table_reference_list", + /* 346 */ "table_reference", + /* 347 */ "table_primary", + /* 348 */ "joined_table", + /* 349 */ "alias_opt", + /* 350 */ "parenthesized_joined_table", + /* 351 */ "join_type", + /* 352 */ "search_condition", + /* 353 */ "query_specification", + /* 354 */ "set_quantifier_opt", + /* 355 */ "select_list", + /* 356 */ "partition_by_clause_opt", + /* 357 */ "range_opt", + /* 358 */ "every_opt", + /* 359 */ "fill_opt", + /* 360 */ "twindow_clause_opt", + /* 361 */ "group_by_clause_opt", + /* 362 */ "having_clause_opt", + /* 363 */ "select_item", + /* 364 */ "fill_mode", + /* 365 */ "group_by_list", + /* 366 */ "query_expression_body", + /* 367 */ "order_by_clause_opt", + /* 368 */ "slimit_clause_opt", + /* 369 */ "limit_clause_opt", + /* 370 */ "query_primary", + /* 371 */ "sort_specification_list", + /* 372 */ "sort_specification", + /* 373 */ "ordering_specification_opt", + /* 374 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1895,160 +1896,160 @@ static const char *const yyRuleName[] = { /* 266 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", /* 267 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", /* 268 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 269 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 270 */ "cmd ::= KILL QUERY NK_STRING", - /* 271 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 272 */ "cmd ::= BALANCE VGROUP", - /* 273 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 274 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 275 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 276 */ "dnode_list ::= DNODE NK_INTEGER", - /* 277 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 278 */ "cmd ::= SYNCDB db_name REPLICA", - /* 279 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 280 */ "cmd ::= query_expression", - /* 281 */ "literal ::= NK_INTEGER", - /* 282 */ "literal ::= NK_FLOAT", - /* 283 */ "literal ::= NK_STRING", - /* 284 */ "literal ::= NK_BOOL", - /* 285 */ "literal ::= TIMESTAMP NK_STRING", - /* 286 */ "literal ::= duration_literal", - /* 287 */ "literal ::= NULL", - /* 288 */ "literal ::= NK_QUESTION", - /* 289 */ "duration_literal ::= NK_VARIABLE", - /* 290 */ "signed ::= NK_INTEGER", - /* 291 */ "signed ::= NK_PLUS NK_INTEGER", - /* 292 */ "signed ::= NK_MINUS NK_INTEGER", - /* 293 */ "signed ::= NK_FLOAT", - /* 294 */ "signed ::= NK_PLUS NK_FLOAT", - /* 295 */ "signed ::= NK_MINUS NK_FLOAT", - /* 296 */ "signed_literal ::= signed", - /* 297 */ "signed_literal ::= NK_STRING", - /* 298 */ "signed_literal ::= NK_BOOL", - /* 299 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 300 */ "signed_literal ::= duration_literal", - /* 301 */ "signed_literal ::= NULL", - /* 302 */ "signed_literal ::= literal_func", - /* 303 */ "literal_list ::= signed_literal", - /* 304 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 305 */ "db_name ::= NK_ID", - /* 306 */ "table_name ::= NK_ID", - /* 307 */ "column_name ::= NK_ID", - /* 308 */ "function_name ::= NK_ID", - /* 309 */ "table_alias ::= NK_ID", - /* 310 */ "column_alias ::= NK_ID", - /* 311 */ "user_name ::= NK_ID", - /* 312 */ "index_name ::= NK_ID", - /* 313 */ "topic_name ::= NK_ID", - /* 314 */ "stream_name ::= NK_ID", - /* 315 */ "cgroup_name ::= NK_ID", - /* 316 */ "expression ::= literal", - /* 317 */ "expression ::= pseudo_column", - /* 318 */ "expression ::= column_reference", - /* 319 */ "expression ::= function_expression", - /* 320 */ "expression ::= subquery", - /* 321 */ "expression ::= NK_LP expression NK_RP", - /* 322 */ "expression ::= NK_PLUS expression", - /* 323 */ "expression ::= NK_MINUS expression", - /* 324 */ "expression ::= expression NK_PLUS expression", - /* 325 */ "expression ::= expression NK_MINUS expression", - /* 326 */ "expression ::= expression NK_STAR expression", - /* 327 */ "expression ::= expression NK_SLASH expression", - /* 328 */ "expression ::= expression NK_REM expression", - /* 329 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 330 */ "expression ::= expression NK_BITAND expression", - /* 331 */ "expression ::= expression NK_BITOR expression", - /* 332 */ "expression_list ::= expression", - /* 333 */ "expression_list ::= expression_list NK_COMMA expression", - /* 334 */ "column_reference ::= column_name", - /* 335 */ "column_reference ::= table_name NK_DOT column_name", - /* 336 */ "pseudo_column ::= ROWTS", - /* 337 */ "pseudo_column ::= TBNAME", - /* 338 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 339 */ "pseudo_column ::= QSTARTTS", - /* 340 */ "pseudo_column ::= QENDTS", - /* 341 */ "pseudo_column ::= WSTARTTS", - /* 342 */ "pseudo_column ::= WENDTS", - /* 343 */ "pseudo_column ::= WDURATION", - /* 344 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 345 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 346 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 347 */ "function_expression ::= literal_func", - /* 348 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 349 */ "literal_func ::= NOW", - /* 350 */ "noarg_func ::= NOW", - /* 351 */ "noarg_func ::= TODAY", - /* 352 */ "noarg_func ::= TIMEZONE", - /* 353 */ "noarg_func ::= DATABASE", - /* 354 */ "noarg_func ::= CLIENT_VERSION", - /* 355 */ "noarg_func ::= SERVER_VERSION", - /* 356 */ "noarg_func ::= SERVER_STATUS", - /* 357 */ "noarg_func ::= CURRENT_USER", - /* 358 */ "noarg_func ::= USER", - /* 359 */ "star_func ::= COUNT", - /* 360 */ "star_func ::= FIRST", - /* 361 */ "star_func ::= LAST", - /* 362 */ "star_func ::= LAST_ROW", - /* 363 */ "star_func_para_list ::= NK_STAR", - /* 364 */ "star_func_para_list ::= other_para_list", - /* 365 */ "other_para_list ::= star_func_para", - /* 366 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 367 */ "star_func_para ::= expression", - /* 368 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 369 */ "predicate ::= expression compare_op expression", - /* 370 */ "predicate ::= expression BETWEEN expression AND expression", - /* 371 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 372 */ "predicate ::= expression IS NULL", - /* 373 */ "predicate ::= expression IS NOT NULL", - /* 374 */ "predicate ::= expression in_op in_predicate_value", - /* 375 */ "compare_op ::= NK_LT", - /* 376 */ "compare_op ::= NK_GT", - /* 377 */ "compare_op ::= NK_LE", - /* 378 */ "compare_op ::= NK_GE", - /* 379 */ "compare_op ::= NK_NE", - /* 380 */ "compare_op ::= NK_EQ", - /* 381 */ "compare_op ::= LIKE", - /* 382 */ "compare_op ::= NOT LIKE", - /* 383 */ "compare_op ::= MATCH", - /* 384 */ "compare_op ::= NMATCH", - /* 385 */ "compare_op ::= CONTAINS", - /* 386 */ "in_op ::= IN", - /* 387 */ "in_op ::= NOT IN", - /* 388 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 389 */ "boolean_value_expression ::= boolean_primary", - /* 390 */ "boolean_value_expression ::= NOT boolean_primary", - /* 391 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 392 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 393 */ "boolean_primary ::= predicate", - /* 394 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 395 */ "common_expression ::= expression", - /* 396 */ "common_expression ::= boolean_value_expression", - /* 397 */ "from_clause_opt ::=", - /* 398 */ "from_clause_opt ::= FROM table_reference_list", - /* 399 */ "table_reference_list ::= table_reference", - /* 400 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 401 */ "table_reference ::= table_primary", - /* 402 */ "table_reference ::= joined_table", - /* 403 */ "table_primary ::= table_name alias_opt", - /* 404 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 405 */ "table_primary ::= subquery alias_opt", - /* 406 */ "table_primary ::= parenthesized_joined_table", - /* 407 */ "alias_opt ::=", - /* 408 */ "alias_opt ::= table_alias", - /* 409 */ "alias_opt ::= AS table_alias", - /* 410 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 411 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 412 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 413 */ "join_type ::=", - /* 414 */ "join_type ::= INNER", - /* 415 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 416 */ "set_quantifier_opt ::=", - /* 417 */ "set_quantifier_opt ::= DISTINCT", - /* 418 */ "set_quantifier_opt ::= ALL", - /* 419 */ "select_list ::= NK_STAR", - /* 420 */ "select_list ::= select_sublist", - /* 421 */ "select_sublist ::= select_item", - /* 422 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 269 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 270 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 271 */ "cmd ::= KILL QUERY NK_STRING", + /* 272 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 273 */ "cmd ::= BALANCE VGROUP", + /* 274 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 275 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 276 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 277 */ "dnode_list ::= DNODE NK_INTEGER", + /* 278 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 279 */ "cmd ::= SYNCDB db_name REPLICA", + /* 280 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 281 */ "cmd ::= query_expression", + /* 282 */ "literal ::= NK_INTEGER", + /* 283 */ "literal ::= NK_FLOAT", + /* 284 */ "literal ::= NK_STRING", + /* 285 */ "literal ::= NK_BOOL", + /* 286 */ "literal ::= TIMESTAMP NK_STRING", + /* 287 */ "literal ::= duration_literal", + /* 288 */ "literal ::= NULL", + /* 289 */ "literal ::= NK_QUESTION", + /* 290 */ "duration_literal ::= NK_VARIABLE", + /* 291 */ "signed ::= NK_INTEGER", + /* 292 */ "signed ::= NK_PLUS NK_INTEGER", + /* 293 */ "signed ::= NK_MINUS NK_INTEGER", + /* 294 */ "signed ::= NK_FLOAT", + /* 295 */ "signed ::= NK_PLUS NK_FLOAT", + /* 296 */ "signed ::= NK_MINUS NK_FLOAT", + /* 297 */ "signed_literal ::= signed", + /* 298 */ "signed_literal ::= NK_STRING", + /* 299 */ "signed_literal ::= NK_BOOL", + /* 300 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 301 */ "signed_literal ::= duration_literal", + /* 302 */ "signed_literal ::= NULL", + /* 303 */ "signed_literal ::= literal_func", + /* 304 */ "literal_list ::= signed_literal", + /* 305 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 306 */ "db_name ::= NK_ID", + /* 307 */ "table_name ::= NK_ID", + /* 308 */ "column_name ::= NK_ID", + /* 309 */ "function_name ::= NK_ID", + /* 310 */ "table_alias ::= NK_ID", + /* 311 */ "column_alias ::= NK_ID", + /* 312 */ "user_name ::= NK_ID", + /* 313 */ "index_name ::= NK_ID", + /* 314 */ "topic_name ::= NK_ID", + /* 315 */ "stream_name ::= NK_ID", + /* 316 */ "cgroup_name ::= NK_ID", + /* 317 */ "expression ::= literal", + /* 318 */ "expression ::= pseudo_column", + /* 319 */ "expression ::= column_reference", + /* 320 */ "expression ::= function_expression", + /* 321 */ "expression ::= subquery", + /* 322 */ "expression ::= NK_LP expression NK_RP", + /* 323 */ "expression ::= NK_PLUS expression", + /* 324 */ "expression ::= NK_MINUS expression", + /* 325 */ "expression ::= expression NK_PLUS expression", + /* 326 */ "expression ::= expression NK_MINUS expression", + /* 327 */ "expression ::= expression NK_STAR expression", + /* 328 */ "expression ::= expression NK_SLASH expression", + /* 329 */ "expression ::= expression NK_REM expression", + /* 330 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 331 */ "expression ::= expression NK_BITAND expression", + /* 332 */ "expression ::= expression NK_BITOR expression", + /* 333 */ "expression_list ::= expression", + /* 334 */ "expression_list ::= expression_list NK_COMMA expression", + /* 335 */ "column_reference ::= column_name", + /* 336 */ "column_reference ::= table_name NK_DOT column_name", + /* 337 */ "pseudo_column ::= ROWTS", + /* 338 */ "pseudo_column ::= TBNAME", + /* 339 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 340 */ "pseudo_column ::= QSTARTTS", + /* 341 */ "pseudo_column ::= QENDTS", + /* 342 */ "pseudo_column ::= WSTARTTS", + /* 343 */ "pseudo_column ::= WENDTS", + /* 344 */ "pseudo_column ::= WDURATION", + /* 345 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 346 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 347 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 348 */ "function_expression ::= literal_func", + /* 349 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 350 */ "literal_func ::= NOW", + /* 351 */ "noarg_func ::= NOW", + /* 352 */ "noarg_func ::= TODAY", + /* 353 */ "noarg_func ::= TIMEZONE", + /* 354 */ "noarg_func ::= DATABASE", + /* 355 */ "noarg_func ::= CLIENT_VERSION", + /* 356 */ "noarg_func ::= SERVER_VERSION", + /* 357 */ "noarg_func ::= SERVER_STATUS", + /* 358 */ "noarg_func ::= CURRENT_USER", + /* 359 */ "noarg_func ::= USER", + /* 360 */ "star_func ::= COUNT", + /* 361 */ "star_func ::= FIRST", + /* 362 */ "star_func ::= LAST", + /* 363 */ "star_func ::= LAST_ROW", + /* 364 */ "star_func_para_list ::= NK_STAR", + /* 365 */ "star_func_para_list ::= other_para_list", + /* 366 */ "other_para_list ::= star_func_para", + /* 367 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 368 */ "star_func_para ::= expression", + /* 369 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 370 */ "predicate ::= expression compare_op expression", + /* 371 */ "predicate ::= expression BETWEEN expression AND expression", + /* 372 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 373 */ "predicate ::= expression IS NULL", + /* 374 */ "predicate ::= expression IS NOT NULL", + /* 375 */ "predicate ::= expression in_op in_predicate_value", + /* 376 */ "compare_op ::= NK_LT", + /* 377 */ "compare_op ::= NK_GT", + /* 378 */ "compare_op ::= NK_LE", + /* 379 */ "compare_op ::= NK_GE", + /* 380 */ "compare_op ::= NK_NE", + /* 381 */ "compare_op ::= NK_EQ", + /* 382 */ "compare_op ::= LIKE", + /* 383 */ "compare_op ::= NOT LIKE", + /* 384 */ "compare_op ::= MATCH", + /* 385 */ "compare_op ::= NMATCH", + /* 386 */ "compare_op ::= CONTAINS", + /* 387 */ "in_op ::= IN", + /* 388 */ "in_op ::= NOT IN", + /* 389 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 390 */ "boolean_value_expression ::= boolean_primary", + /* 391 */ "boolean_value_expression ::= NOT boolean_primary", + /* 392 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 393 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 394 */ "boolean_primary ::= predicate", + /* 395 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 396 */ "common_expression ::= expression", + /* 397 */ "common_expression ::= boolean_value_expression", + /* 398 */ "from_clause_opt ::=", + /* 399 */ "from_clause_opt ::= FROM table_reference_list", + /* 400 */ "table_reference_list ::= table_reference", + /* 401 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 402 */ "table_reference ::= table_primary", + /* 403 */ "table_reference ::= joined_table", + /* 404 */ "table_primary ::= table_name alias_opt", + /* 405 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 406 */ "table_primary ::= subquery alias_opt", + /* 407 */ "table_primary ::= parenthesized_joined_table", + /* 408 */ "alias_opt ::=", + /* 409 */ "alias_opt ::= table_alias", + /* 410 */ "alias_opt ::= AS table_alias", + /* 411 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 412 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 413 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 414 */ "join_type ::=", + /* 415 */ "join_type ::= INNER", + /* 416 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 417 */ "set_quantifier_opt ::=", + /* 418 */ "set_quantifier_opt ::= DISTINCT", + /* 419 */ "set_quantifier_opt ::= ALL", + /* 420 */ "select_list ::= select_item", + /* 421 */ "select_list ::= select_list NK_COMMA select_item", + /* 422 */ "select_item ::= NK_STAR", /* 423 */ "select_item ::= common_expression", /* 424 */ "select_item ::= common_expression column_alias", /* 425 */ "select_item ::= common_expression AS column_alias", @@ -2235,182 +2236,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 250: /* cmd */ - case 253: /* literal */ - case 264: /* db_options */ - case 266: /* alter_db_options */ - case 271: /* retention */ - case 272: /* full_table_name */ - case 275: /* table_options */ - case 279: /* alter_table_clause */ - case 280: /* alter_table_options */ - case 283: /* signed_literal */ - case 284: /* create_subtable_clause */ - case 287: /* drop_table_clause */ - case 290: /* column_def */ - case 294: /* duration_literal */ - case 295: /* rollup_func_name */ - case 297: /* col_name */ - case 298: /* db_name_cond_opt */ - case 299: /* like_pattern_opt */ - case 300: /* table_name_cond */ - case 301: /* from_db_opt */ - case 303: /* index_options */ - case 305: /* sliding_opt */ - case 306: /* sma_stream_opt */ - case 307: /* func */ - case 309: /* stream_options */ - case 311: /* query_expression */ - case 314: /* explain_options */ - case 318: /* into_opt */ - case 320: /* where_clause_opt */ - case 321: /* signed */ - case 322: /* literal_func */ - case 325: /* expression */ - case 326: /* pseudo_column */ - case 327: /* column_reference */ - case 328: /* function_expression */ - case 329: /* subquery */ - case 334: /* star_func_para */ - case 335: /* predicate */ - case 338: /* in_predicate_value */ - case 339: /* boolean_value_expression */ - case 340: /* boolean_primary */ - case 341: /* common_expression */ - case 342: /* from_clause_opt */ - case 343: /* table_reference_list */ - case 344: /* table_reference */ - case 345: /* table_primary */ - case 346: /* joined_table */ - case 348: /* parenthesized_joined_table */ - case 350: /* search_condition */ - case 351: /* query_specification */ - case 355: /* range_opt */ - case 356: /* every_opt */ - case 357: /* fill_opt */ - case 358: /* twindow_clause_opt */ - case 360: /* having_clause_opt */ - case 362: /* select_item */ - case 365: /* query_expression_body */ - case 367: /* slimit_clause_opt */ - case 368: /* limit_clause_opt */ - case 369: /* query_primary */ - case 371: /* sort_specification */ + case 252: /* cmd */ + case 255: /* literal */ + case 266: /* db_options */ + case 268: /* alter_db_options */ + case 273: /* retention */ + case 274: /* full_table_name */ + case 277: /* table_options */ + case 281: /* alter_table_clause */ + case 282: /* alter_table_options */ + case 285: /* signed_literal */ + case 286: /* create_subtable_clause */ + case 289: /* drop_table_clause */ + case 292: /* column_def */ + case 296: /* duration_literal */ + case 297: /* rollup_func_name */ + case 299: /* col_name */ + case 300: /* db_name_cond_opt */ + case 301: /* like_pattern_opt */ + case 302: /* table_name_cond */ + case 303: /* from_db_opt */ + case 305: /* index_options */ + case 307: /* sliding_opt */ + case 308: /* sma_stream_opt */ + case 309: /* func */ + case 311: /* stream_options */ + case 313: /* query_expression */ + case 316: /* explain_options */ + case 320: /* into_opt */ + case 322: /* where_clause_opt */ + case 323: /* signed */ + case 324: /* literal_func */ + case 327: /* expression */ + case 328: /* pseudo_column */ + case 329: /* column_reference */ + case 330: /* function_expression */ + case 331: /* subquery */ + case 336: /* star_func_para */ + case 337: /* predicate */ + case 340: /* in_predicate_value */ + case 341: /* boolean_value_expression */ + case 342: /* boolean_primary */ + case 343: /* common_expression */ + case 344: /* from_clause_opt */ + case 345: /* table_reference_list */ + case 346: /* table_reference */ + case 347: /* table_primary */ + case 348: /* joined_table */ + case 350: /* parenthesized_joined_table */ + case 352: /* search_condition */ + case 353: /* query_specification */ + case 357: /* range_opt */ + case 358: /* every_opt */ + case 359: /* fill_opt */ + case 360: /* twindow_clause_opt */ + case 362: /* having_clause_opt */ + case 363: /* select_item */ + case 366: /* query_expression_body */ + case 368: /* slimit_clause_opt */ + case 369: /* limit_clause_opt */ + case 370: /* query_primary */ + case 372: /* sort_specification */ { - nodesDestroyNode((yypminor->yy652)); + nodesDestroyNode((yypminor->yy212)); } break; - case 251: /* account_options */ - case 252: /* alter_account_options */ - case 254: /* alter_account_option */ - case 316: /* bufsize_opt */ + case 253: /* account_options */ + case 254: /* alter_account_options */ + case 256: /* alter_account_option */ + case 318: /* bufsize_opt */ { } break; - case 255: /* user_name */ - case 258: /* priv_level */ - case 261: /* db_name */ - case 262: /* dnode_endpoint */ - case 281: /* column_name */ - case 289: /* table_name */ - case 296: /* function_name */ - case 302: /* index_name */ - case 310: /* topic_name */ - case 312: /* cgroup_name */ - case 317: /* stream_name */ - case 323: /* table_alias */ - case 324: /* column_alias */ - case 330: /* star_func */ - case 332: /* noarg_func */ - case 347: /* alias_opt */ + case 257: /* user_name */ + case 260: /* priv_level */ + case 263: /* db_name */ + case 264: /* dnode_endpoint */ + case 283: /* column_name */ + case 291: /* table_name */ + case 298: /* function_name */ + case 304: /* index_name */ + case 312: /* topic_name */ + case 314: /* cgroup_name */ + case 319: /* stream_name */ + case 325: /* table_alias */ + case 326: /* column_alias */ + case 332: /* star_func */ + case 334: /* noarg_func */ + case 349: /* alias_opt */ { } break; - case 256: /* sysinfo_opt */ + case 258: /* sysinfo_opt */ { } break; - case 257: /* privileges */ - case 259: /* priv_type_list */ - case 260: /* priv_type */ + case 259: /* privileges */ + case 261: /* priv_type_list */ + case 262: /* priv_type */ { } break; - case 263: /* not_exists_opt */ - case 265: /* exists_opt */ - case 313: /* analyze_opt */ - case 315: /* agg_func_opt */ - case 352: /* set_quantifier_opt */ + case 265: /* not_exists_opt */ + case 267: /* exists_opt */ + case 315: /* analyze_opt */ + case 317: /* agg_func_opt */ + case 354: /* set_quantifier_opt */ { } break; - case 267: /* integer_list */ - case 268: /* variable_list */ - case 269: /* retention_list */ - case 273: /* column_def_list */ - case 274: /* tags_def_opt */ - case 276: /* multi_create_clause */ - case 277: /* tags_def */ - case 278: /* multi_drop_clause */ - case 285: /* specific_tags_opt */ - case 286: /* literal_list */ - case 288: /* col_name_list */ - case 291: /* duration_list */ - case 292: /* rollup_func_list */ - case 304: /* func_list */ - case 308: /* expression_list */ - case 319: /* dnode_list */ - case 331: /* star_func_para_list */ - case 333: /* other_para_list */ - case 353: /* select_list */ - case 354: /* partition_by_clause_opt */ - case 359: /* group_by_clause_opt */ - case 361: /* select_sublist */ - case 364: /* group_by_list */ - case 366: /* order_by_clause_opt */ - case 370: /* sort_specification_list */ + case 269: /* integer_list */ + case 270: /* variable_list */ + case 271: /* retention_list */ + case 275: /* column_def_list */ + case 276: /* tags_def_opt */ + case 278: /* multi_create_clause */ + case 279: /* tags_def */ + case 280: /* multi_drop_clause */ + case 287: /* specific_tags_opt */ + case 288: /* literal_list */ + case 290: /* col_name_list */ + case 293: /* duration_list */ + case 294: /* rollup_func_list */ + case 306: /* func_list */ + case 310: /* expression_list */ + case 321: /* dnode_list */ + case 333: /* star_func_para_list */ + case 335: /* other_para_list */ + case 355: /* select_list */ + case 356: /* partition_by_clause_opt */ + case 361: /* group_by_clause_opt */ + case 365: /* group_by_list */ + case 367: /* order_by_clause_opt */ + case 371: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy24)); + nodesDestroyList((yypminor->yy424)); } break; - case 270: /* alter_db_option */ - case 293: /* alter_table_option */ + case 272: /* alter_db_option */ + case 295: /* alter_table_option */ { } break; - case 282: /* type_name */ + case 284: /* type_name */ { } break; - case 336: /* compare_op */ - case 337: /* in_op */ + case 338: /* compare_op */ + case 339: /* in_op */ { } break; - case 349: /* join_type */ + case 351: /* join_type */ { } break; - case 363: /* fill_mode */ + case 364: /* fill_mode */ { } break; - case 372: /* ordering_specification_opt */ + case 373: /* ordering_specification_opt */ { } break; - case 373: /* null_ordering_opt */ + case 374: /* null_ordering_opt */ { } @@ -2709,489 +2709,489 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 250, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 250, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 251, 0 }, /* (2) account_options ::= */ - { 251, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 251, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 251, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 251, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 251, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 251, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 251, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 251, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 251, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 252, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 252, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 254, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 254, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 254, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 254, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 254, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 254, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 254, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 254, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 254, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 254, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 250, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 250, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 250, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 250, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 250, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 256, 0 }, /* (29) sysinfo_opt ::= */ - { 256, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 250, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 250, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 257, -1 }, /* (33) privileges ::= ALL */ - { 257, -1 }, /* (34) privileges ::= priv_type_list */ - { 259, -1 }, /* (35) priv_type_list ::= priv_type */ - { 259, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 260, -1 }, /* (37) priv_type ::= READ */ - { 260, -1 }, /* (38) priv_type ::= WRITE */ - { 258, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 258, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 250, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 250, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 250, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 250, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 250, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 250, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 250, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 250, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 262, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 262, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 262, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 250, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 250, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 250, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 250, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 250, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 250, -2 }, /* (64) cmd ::= USE db_name */ - { 250, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 263, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ - { 263, 0 }, /* (67) not_exists_opt ::= */ - { 265, -2 }, /* (68) exists_opt ::= IF EXISTS */ - { 265, 0 }, /* (69) exists_opt ::= */ - { 264, 0 }, /* (70) db_options ::= */ - { 264, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ - { 264, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ - { 264, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ - { 264, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ - { 264, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ - { 264, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ - { 264, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ - { 264, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ - { 264, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ - { 264, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ - { 264, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ - { 264, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 264, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ - { 264, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ - { 264, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ - { 264, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ - { 264, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ - { 264, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 264, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ - { 264, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 266, -1 }, /* (91) alter_db_options ::= alter_db_option */ - { 266, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ - { 270, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ - { 270, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ - { 270, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ - { 270, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ - { 270, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ - { 270, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ - { 270, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ - { 270, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ - { 270, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ - { 267, -1 }, /* (102) integer_list ::= NK_INTEGER */ - { 267, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 268, -1 }, /* (104) variable_list ::= NK_VARIABLE */ - { 268, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 269, -1 }, /* (106) retention_list ::= retention */ - { 269, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ - { 271, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 250, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 250, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ - { 250, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 250, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ - { 250, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ - { 250, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ - { 250, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ - { 279, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ - { 279, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 279, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 279, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 279, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 279, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 279, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 279, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 279, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 279, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 276, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ - { 276, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 284, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ - { 278, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ - { 278, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 287, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ - { 285, 0 }, /* (132) specific_tags_opt ::= */ - { 285, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 272, -1 }, /* (134) full_table_name ::= table_name */ - { 272, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ - { 273, -1 }, /* (136) column_def_list ::= column_def */ - { 273, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ - { 290, -2 }, /* (138) column_def ::= column_name type_name */ - { 290, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ - { 282, -1 }, /* (140) type_name ::= BOOL */ - { 282, -1 }, /* (141) type_name ::= TINYINT */ - { 282, -1 }, /* (142) type_name ::= SMALLINT */ - { 282, -1 }, /* (143) type_name ::= INT */ - { 282, -1 }, /* (144) type_name ::= INTEGER */ - { 282, -1 }, /* (145) type_name ::= BIGINT */ - { 282, -1 }, /* (146) type_name ::= FLOAT */ - { 282, -1 }, /* (147) type_name ::= DOUBLE */ - { 282, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (149) type_name ::= TIMESTAMP */ - { 282, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 282, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ - { 282, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ - { 282, -2 }, /* (153) type_name ::= INT UNSIGNED */ - { 282, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ - { 282, -1 }, /* (155) type_name ::= JSON */ - { 282, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (157) type_name ::= MEDIUMBLOB */ - { 282, -1 }, /* (158) type_name ::= BLOB */ - { 282, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 282, -1 }, /* (160) type_name ::= DECIMAL */ - { 282, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 282, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 274, 0 }, /* (163) tags_def_opt ::= */ - { 274, -1 }, /* (164) tags_def_opt ::= tags_def */ - { 277, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 275, 0 }, /* (166) table_options ::= */ - { 275, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ - { 275, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ - { 275, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ - { 275, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 275, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ - { 275, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 280, -1 }, /* (173) alter_table_options ::= alter_table_option */ - { 280, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ - { 293, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ - { 293, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ - { 291, -1 }, /* (177) duration_list ::= duration_literal */ - { 291, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ - { 292, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ - { 292, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 295, -1 }, /* (181) rollup_func_name ::= function_name */ - { 295, -1 }, /* (182) rollup_func_name ::= FIRST */ - { 295, -1 }, /* (183) rollup_func_name ::= LAST */ - { 288, -1 }, /* (184) col_name_list ::= col_name */ - { 288, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ - { 297, -1 }, /* (186) col_name ::= column_name */ - { 250, -2 }, /* (187) cmd ::= SHOW DNODES */ - { 250, -2 }, /* (188) cmd ::= SHOW USERS */ - { 250, -2 }, /* (189) cmd ::= SHOW DATABASES */ - { 250, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 250, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 250, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 250, -2 }, /* (193) cmd ::= SHOW MNODES */ - { 250, -2 }, /* (194) cmd ::= SHOW MODULES */ - { 250, -2 }, /* (195) cmd ::= SHOW QNODES */ - { 250, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ - { 250, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 250, -2 }, /* (198) cmd ::= SHOW STREAMS */ - { 250, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ - { 250, -2 }, /* (200) cmd ::= SHOW APPS */ - { 250, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ - { 250, -2 }, /* (202) cmd ::= SHOW LICENCE */ - { 250, -2 }, /* (203) cmd ::= SHOW GRANTS */ - { 250, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ - { 250, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ - { 250, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ - { 250, -2 }, /* (207) cmd ::= SHOW QUERIES */ - { 250, -2 }, /* (208) cmd ::= SHOW SCORES */ - { 250, -2 }, /* (209) cmd ::= SHOW TOPICS */ - { 250, -2 }, /* (210) cmd ::= SHOW VARIABLES */ - { 250, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ - { 250, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 250, -2 }, /* (213) cmd ::= SHOW BNODES */ - { 250, -2 }, /* (214) cmd ::= SHOW SNODES */ - { 250, -2 }, /* (215) cmd ::= SHOW CLUSTER */ - { 250, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ - { 250, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 250, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ - { 250, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ - { 298, 0 }, /* (220) db_name_cond_opt ::= */ - { 298, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ - { 299, 0 }, /* (222) like_pattern_opt ::= */ - { 299, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ - { 300, -1 }, /* (224) table_name_cond ::= table_name */ - { 301, 0 }, /* (225) from_db_opt ::= */ - { 301, -2 }, /* (226) from_db_opt ::= FROM db_name */ - { 250, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 250, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ - { 303, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 303, -12 }, /* (230) 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 */ - { 304, -1 }, /* (231) func_list ::= func */ - { 304, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ - { 307, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ - { 306, 0 }, /* (234) sma_stream_opt ::= */ - { 306, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 306, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 250, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 250, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 250, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 250, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 250, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 250, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ - { 250, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 250, -2 }, /* (244) cmd ::= DESC full_table_name */ - { 250, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ - { 250, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ - { 250, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 313, 0 }, /* (248) analyze_opt ::= */ - { 313, -1 }, /* (249) analyze_opt ::= ANALYZE */ - { 314, 0 }, /* (250) explain_options ::= */ - { 314, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 314, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ - { 250, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 250, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 250, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ - { 315, 0 }, /* (256) agg_func_opt ::= */ - { 315, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ - { 316, 0 }, /* (258) bufsize_opt ::= */ - { 316, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 250, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 250, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ - { 318, 0 }, /* (262) into_opt ::= */ - { 318, -2 }, /* (263) into_opt ::= INTO full_table_name */ - { 309, 0 }, /* (264) stream_options ::= */ - { 309, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 309, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 309, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 309, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ - { 250, -3 }, /* (269) cmd ::= KILL CONNECTION NK_INTEGER */ - { 250, -3 }, /* (270) cmd ::= KILL QUERY NK_STRING */ - { 250, -3 }, /* (271) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 250, -2 }, /* (272) cmd ::= BALANCE VGROUP */ - { 250, -4 }, /* (273) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 250, -4 }, /* (274) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 250, -3 }, /* (275) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 319, -2 }, /* (276) dnode_list ::= DNODE NK_INTEGER */ - { 319, -3 }, /* (277) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 250, -3 }, /* (278) cmd ::= SYNCDB db_name REPLICA */ - { 250, -4 }, /* (279) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 250, -1 }, /* (280) cmd ::= query_expression */ - { 253, -1 }, /* (281) literal ::= NK_INTEGER */ - { 253, -1 }, /* (282) literal ::= NK_FLOAT */ - { 253, -1 }, /* (283) literal ::= NK_STRING */ - { 253, -1 }, /* (284) literal ::= NK_BOOL */ - { 253, -2 }, /* (285) literal ::= TIMESTAMP NK_STRING */ - { 253, -1 }, /* (286) literal ::= duration_literal */ - { 253, -1 }, /* (287) literal ::= NULL */ - { 253, -1 }, /* (288) literal ::= NK_QUESTION */ - { 294, -1 }, /* (289) duration_literal ::= NK_VARIABLE */ - { 321, -1 }, /* (290) signed ::= NK_INTEGER */ - { 321, -2 }, /* (291) signed ::= NK_PLUS NK_INTEGER */ - { 321, -2 }, /* (292) signed ::= NK_MINUS NK_INTEGER */ - { 321, -1 }, /* (293) signed ::= NK_FLOAT */ - { 321, -2 }, /* (294) signed ::= NK_PLUS NK_FLOAT */ - { 321, -2 }, /* (295) signed ::= NK_MINUS NK_FLOAT */ - { 283, -1 }, /* (296) signed_literal ::= signed */ - { 283, -1 }, /* (297) signed_literal ::= NK_STRING */ - { 283, -1 }, /* (298) signed_literal ::= NK_BOOL */ - { 283, -2 }, /* (299) signed_literal ::= TIMESTAMP NK_STRING */ - { 283, -1 }, /* (300) signed_literal ::= duration_literal */ - { 283, -1 }, /* (301) signed_literal ::= NULL */ - { 283, -1 }, /* (302) signed_literal ::= literal_func */ - { 286, -1 }, /* (303) literal_list ::= signed_literal */ - { 286, -3 }, /* (304) literal_list ::= literal_list NK_COMMA signed_literal */ - { 261, -1 }, /* (305) db_name ::= NK_ID */ - { 289, -1 }, /* (306) table_name ::= NK_ID */ - { 281, -1 }, /* (307) column_name ::= NK_ID */ - { 296, -1 }, /* (308) function_name ::= NK_ID */ - { 323, -1 }, /* (309) table_alias ::= NK_ID */ - { 324, -1 }, /* (310) column_alias ::= NK_ID */ - { 255, -1 }, /* (311) user_name ::= NK_ID */ - { 302, -1 }, /* (312) index_name ::= NK_ID */ - { 310, -1 }, /* (313) topic_name ::= NK_ID */ - { 317, -1 }, /* (314) stream_name ::= NK_ID */ - { 312, -1 }, /* (315) cgroup_name ::= NK_ID */ - { 325, -1 }, /* (316) expression ::= literal */ - { 325, -1 }, /* (317) expression ::= pseudo_column */ - { 325, -1 }, /* (318) expression ::= column_reference */ - { 325, -1 }, /* (319) expression ::= function_expression */ - { 325, -1 }, /* (320) expression ::= subquery */ - { 325, -3 }, /* (321) expression ::= NK_LP expression NK_RP */ - { 325, -2 }, /* (322) expression ::= NK_PLUS expression */ - { 325, -2 }, /* (323) expression ::= NK_MINUS expression */ - { 325, -3 }, /* (324) expression ::= expression NK_PLUS expression */ - { 325, -3 }, /* (325) expression ::= expression NK_MINUS expression */ - { 325, -3 }, /* (326) expression ::= expression NK_STAR expression */ - { 325, -3 }, /* (327) expression ::= expression NK_SLASH expression */ - { 325, -3 }, /* (328) expression ::= expression NK_REM expression */ - { 325, -3 }, /* (329) expression ::= column_reference NK_ARROW NK_STRING */ - { 325, -3 }, /* (330) expression ::= expression NK_BITAND expression */ - { 325, -3 }, /* (331) expression ::= expression NK_BITOR expression */ - { 308, -1 }, /* (332) expression_list ::= expression */ - { 308, -3 }, /* (333) expression_list ::= expression_list NK_COMMA expression */ - { 327, -1 }, /* (334) column_reference ::= column_name */ - { 327, -3 }, /* (335) column_reference ::= table_name NK_DOT column_name */ - { 326, -1 }, /* (336) pseudo_column ::= ROWTS */ - { 326, -1 }, /* (337) pseudo_column ::= TBNAME */ - { 326, -3 }, /* (338) pseudo_column ::= table_name NK_DOT TBNAME */ - { 326, -1 }, /* (339) pseudo_column ::= QSTARTTS */ - { 326, -1 }, /* (340) pseudo_column ::= QENDTS */ - { 326, -1 }, /* (341) pseudo_column ::= WSTARTTS */ - { 326, -1 }, /* (342) pseudo_column ::= WENDTS */ - { 326, -1 }, /* (343) pseudo_column ::= WDURATION */ - { 328, -4 }, /* (344) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 328, -4 }, /* (345) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 328, -6 }, /* (346) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 328, -1 }, /* (347) function_expression ::= literal_func */ - { 322, -3 }, /* (348) literal_func ::= noarg_func NK_LP NK_RP */ - { 322, -1 }, /* (349) literal_func ::= NOW */ - { 332, -1 }, /* (350) noarg_func ::= NOW */ - { 332, -1 }, /* (351) noarg_func ::= TODAY */ - { 332, -1 }, /* (352) noarg_func ::= TIMEZONE */ - { 332, -1 }, /* (353) noarg_func ::= DATABASE */ - { 332, -1 }, /* (354) noarg_func ::= CLIENT_VERSION */ - { 332, -1 }, /* (355) noarg_func ::= SERVER_VERSION */ - { 332, -1 }, /* (356) noarg_func ::= SERVER_STATUS */ - { 332, -1 }, /* (357) noarg_func ::= CURRENT_USER */ - { 332, -1 }, /* (358) noarg_func ::= USER */ - { 330, -1 }, /* (359) star_func ::= COUNT */ - { 330, -1 }, /* (360) star_func ::= FIRST */ - { 330, -1 }, /* (361) star_func ::= LAST */ - { 330, -1 }, /* (362) star_func ::= LAST_ROW */ - { 331, -1 }, /* (363) star_func_para_list ::= NK_STAR */ - { 331, -1 }, /* (364) star_func_para_list ::= other_para_list */ - { 333, -1 }, /* (365) other_para_list ::= star_func_para */ - { 333, -3 }, /* (366) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 334, -1 }, /* (367) star_func_para ::= expression */ - { 334, -3 }, /* (368) star_func_para ::= table_name NK_DOT NK_STAR */ - { 335, -3 }, /* (369) predicate ::= expression compare_op expression */ - { 335, -5 }, /* (370) predicate ::= expression BETWEEN expression AND expression */ - { 335, -6 }, /* (371) predicate ::= expression NOT BETWEEN expression AND expression */ - { 335, -3 }, /* (372) predicate ::= expression IS NULL */ - { 335, -4 }, /* (373) predicate ::= expression IS NOT NULL */ - { 335, -3 }, /* (374) predicate ::= expression in_op in_predicate_value */ - { 336, -1 }, /* (375) compare_op ::= NK_LT */ - { 336, -1 }, /* (376) compare_op ::= NK_GT */ - { 336, -1 }, /* (377) compare_op ::= NK_LE */ - { 336, -1 }, /* (378) compare_op ::= NK_GE */ - { 336, -1 }, /* (379) compare_op ::= NK_NE */ - { 336, -1 }, /* (380) compare_op ::= NK_EQ */ - { 336, -1 }, /* (381) compare_op ::= LIKE */ - { 336, -2 }, /* (382) compare_op ::= NOT LIKE */ - { 336, -1 }, /* (383) compare_op ::= MATCH */ - { 336, -1 }, /* (384) compare_op ::= NMATCH */ - { 336, -1 }, /* (385) compare_op ::= CONTAINS */ - { 337, -1 }, /* (386) in_op ::= IN */ - { 337, -2 }, /* (387) in_op ::= NOT IN */ - { 338, -3 }, /* (388) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 339, -1 }, /* (389) boolean_value_expression ::= boolean_primary */ - { 339, -2 }, /* (390) boolean_value_expression ::= NOT boolean_primary */ - { 339, -3 }, /* (391) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 339, -3 }, /* (392) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 340, -1 }, /* (393) boolean_primary ::= predicate */ - { 340, -3 }, /* (394) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 341, -1 }, /* (395) common_expression ::= expression */ - { 341, -1 }, /* (396) common_expression ::= boolean_value_expression */ - { 342, 0 }, /* (397) from_clause_opt ::= */ - { 342, -2 }, /* (398) from_clause_opt ::= FROM table_reference_list */ - { 343, -1 }, /* (399) table_reference_list ::= table_reference */ - { 343, -3 }, /* (400) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 344, -1 }, /* (401) table_reference ::= table_primary */ - { 344, -1 }, /* (402) table_reference ::= joined_table */ - { 345, -2 }, /* (403) table_primary ::= table_name alias_opt */ - { 345, -4 }, /* (404) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 345, -2 }, /* (405) table_primary ::= subquery alias_opt */ - { 345, -1 }, /* (406) table_primary ::= parenthesized_joined_table */ - { 347, 0 }, /* (407) alias_opt ::= */ - { 347, -1 }, /* (408) alias_opt ::= table_alias */ - { 347, -2 }, /* (409) alias_opt ::= AS table_alias */ - { 348, -3 }, /* (410) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 348, -3 }, /* (411) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 346, -6 }, /* (412) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 349, 0 }, /* (413) join_type ::= */ - { 349, -1 }, /* (414) join_type ::= INNER */ - { 351, -12 }, /* (415) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 352, 0 }, /* (416) set_quantifier_opt ::= */ - { 352, -1 }, /* (417) set_quantifier_opt ::= DISTINCT */ - { 352, -1 }, /* (418) set_quantifier_opt ::= ALL */ - { 353, -1 }, /* (419) select_list ::= NK_STAR */ - { 353, -1 }, /* (420) select_list ::= select_sublist */ - { 361, -1 }, /* (421) select_sublist ::= select_item */ - { 361, -3 }, /* (422) select_sublist ::= select_sublist NK_COMMA select_item */ - { 362, -1 }, /* (423) select_item ::= common_expression */ - { 362, -2 }, /* (424) select_item ::= common_expression column_alias */ - { 362, -3 }, /* (425) select_item ::= common_expression AS column_alias */ - { 362, -3 }, /* (426) select_item ::= table_name NK_DOT NK_STAR */ - { 320, 0 }, /* (427) where_clause_opt ::= */ - { 320, -2 }, /* (428) where_clause_opt ::= WHERE search_condition */ - { 354, 0 }, /* (429) partition_by_clause_opt ::= */ - { 354, -3 }, /* (430) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 358, 0 }, /* (431) twindow_clause_opt ::= */ - { 358, -6 }, /* (432) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 358, -4 }, /* (433) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 358, -6 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 358, -8 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 305, 0 }, /* (436) sliding_opt ::= */ - { 305, -4 }, /* (437) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 357, 0 }, /* (438) fill_opt ::= */ - { 357, -4 }, /* (439) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 357, -6 }, /* (440) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 363, -1 }, /* (441) fill_mode ::= NONE */ - { 363, -1 }, /* (442) fill_mode ::= PREV */ - { 363, -1 }, /* (443) fill_mode ::= NULL */ - { 363, -1 }, /* (444) fill_mode ::= LINEAR */ - { 363, -1 }, /* (445) fill_mode ::= NEXT */ - { 359, 0 }, /* (446) group_by_clause_opt ::= */ - { 359, -3 }, /* (447) group_by_clause_opt ::= GROUP BY group_by_list */ - { 364, -1 }, /* (448) group_by_list ::= expression */ - { 364, -3 }, /* (449) group_by_list ::= group_by_list NK_COMMA expression */ - { 360, 0 }, /* (450) having_clause_opt ::= */ - { 360, -2 }, /* (451) having_clause_opt ::= HAVING search_condition */ - { 355, 0 }, /* (452) range_opt ::= */ - { 355, -6 }, /* (453) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 356, 0 }, /* (454) every_opt ::= */ - { 356, -4 }, /* (455) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 311, -4 }, /* (456) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 365, -1 }, /* (457) query_expression_body ::= query_primary */ - { 365, -4 }, /* (458) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 365, -3 }, /* (459) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 369, -1 }, /* (460) query_primary ::= query_specification */ - { 369, -6 }, /* (461) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 366, 0 }, /* (462) order_by_clause_opt ::= */ - { 366, -3 }, /* (463) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 367, 0 }, /* (464) slimit_clause_opt ::= */ - { 367, -2 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 367, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 367, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 368, 0 }, /* (468) limit_clause_opt ::= */ - { 368, -2 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 368, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 368, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 329, -3 }, /* (472) subquery ::= NK_LP query_expression NK_RP */ - { 350, -1 }, /* (473) search_condition ::= common_expression */ - { 370, -1 }, /* (474) sort_specification_list ::= sort_specification */ - { 370, -3 }, /* (475) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 371, -3 }, /* (476) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 372, 0 }, /* (477) ordering_specification_opt ::= */ - { 372, -1 }, /* (478) ordering_specification_opt ::= ASC */ - { 372, -1 }, /* (479) ordering_specification_opt ::= DESC */ - { 373, 0 }, /* (480) null_ordering_opt ::= */ - { 373, -2 }, /* (481) null_ordering_opt ::= NULLS FIRST */ - { 373, -2 }, /* (482) null_ordering_opt ::= NULLS LAST */ + { 252, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 252, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 253, 0 }, /* (2) account_options ::= */ + { 253, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 253, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 253, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 253, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 253, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 253, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 253, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 253, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 253, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 254, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 254, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 256, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 256, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 256, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 256, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 256, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 256, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 256, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 256, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 256, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 256, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 252, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 252, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 252, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 252, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 252, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 258, 0 }, /* (29) sysinfo_opt ::= */ + { 258, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 252, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 252, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 259, -1 }, /* (33) privileges ::= ALL */ + { 259, -1 }, /* (34) privileges ::= priv_type_list */ + { 261, -1 }, /* (35) priv_type_list ::= priv_type */ + { 261, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 262, -1 }, /* (37) priv_type ::= READ */ + { 262, -1 }, /* (38) priv_type ::= WRITE */ + { 260, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 260, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 252, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 252, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 252, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 252, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 252, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 252, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 252, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 252, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 264, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 264, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 264, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 252, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 252, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 252, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 252, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 252, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 252, -2 }, /* (64) cmd ::= USE db_name */ + { 252, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 265, -3 }, /* (66) not_exists_opt ::= IF NOT EXISTS */ + { 265, 0 }, /* (67) not_exists_opt ::= */ + { 267, -2 }, /* (68) exists_opt ::= IF EXISTS */ + { 267, 0 }, /* (69) exists_opt ::= */ + { 266, 0 }, /* (70) db_options ::= */ + { 266, -3 }, /* (71) db_options ::= db_options BUFFER NK_INTEGER */ + { 266, -3 }, /* (72) db_options ::= db_options CACHELAST NK_INTEGER */ + { 266, -3 }, /* (73) db_options ::= db_options COMP NK_INTEGER */ + { 266, -3 }, /* (74) db_options ::= db_options DURATION NK_INTEGER */ + { 266, -3 }, /* (75) db_options ::= db_options DURATION NK_VARIABLE */ + { 266, -3 }, /* (76) db_options ::= db_options FSYNC NK_INTEGER */ + { 266, -3 }, /* (77) db_options ::= db_options MAXROWS NK_INTEGER */ + { 266, -3 }, /* (78) db_options ::= db_options MINROWS NK_INTEGER */ + { 266, -3 }, /* (79) db_options ::= db_options KEEP integer_list */ + { 266, -3 }, /* (80) db_options ::= db_options KEEP variable_list */ + { 266, -3 }, /* (81) db_options ::= db_options PAGES NK_INTEGER */ + { 266, -3 }, /* (82) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 266, -3 }, /* (83) db_options ::= db_options PRECISION NK_STRING */ + { 266, -3 }, /* (84) db_options ::= db_options REPLICA NK_INTEGER */ + { 266, -3 }, /* (85) db_options ::= db_options STRICT NK_INTEGER */ + { 266, -3 }, /* (86) db_options ::= db_options WAL NK_INTEGER */ + { 266, -3 }, /* (87) db_options ::= db_options VGROUPS NK_INTEGER */ + { 266, -3 }, /* (88) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 266, -3 }, /* (89) db_options ::= db_options RETENTIONS retention_list */ + { 266, -3 }, /* (90) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 268, -1 }, /* (91) alter_db_options ::= alter_db_option */ + { 268, -2 }, /* (92) alter_db_options ::= alter_db_options alter_db_option */ + { 272, -2 }, /* (93) alter_db_option ::= BUFFER NK_INTEGER */ + { 272, -2 }, /* (94) alter_db_option ::= CACHELAST NK_INTEGER */ + { 272, -2 }, /* (95) alter_db_option ::= FSYNC NK_INTEGER */ + { 272, -2 }, /* (96) alter_db_option ::= KEEP integer_list */ + { 272, -2 }, /* (97) alter_db_option ::= KEEP variable_list */ + { 272, -2 }, /* (98) alter_db_option ::= PAGES NK_INTEGER */ + { 272, -2 }, /* (99) alter_db_option ::= REPLICA NK_INTEGER */ + { 272, -2 }, /* (100) alter_db_option ::= STRICT NK_INTEGER */ + { 272, -2 }, /* (101) alter_db_option ::= WAL NK_INTEGER */ + { 269, -1 }, /* (102) integer_list ::= NK_INTEGER */ + { 269, -3 }, /* (103) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 270, -1 }, /* (104) variable_list ::= NK_VARIABLE */ + { 270, -3 }, /* (105) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 271, -1 }, /* (106) retention_list ::= retention */ + { 271, -3 }, /* (107) retention_list ::= retention_list NK_COMMA retention */ + { 273, -3 }, /* (108) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 252, -9 }, /* (109) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 252, -3 }, /* (110) cmd ::= CREATE TABLE multi_create_clause */ + { 252, -9 }, /* (111) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 252, -3 }, /* (112) cmd ::= DROP TABLE multi_drop_clause */ + { 252, -4 }, /* (113) cmd ::= DROP STABLE exists_opt full_table_name */ + { 252, -3 }, /* (114) cmd ::= ALTER TABLE alter_table_clause */ + { 252, -3 }, /* (115) cmd ::= ALTER STABLE alter_table_clause */ + { 281, -2 }, /* (116) alter_table_clause ::= full_table_name alter_table_options */ + { 281, -5 }, /* (117) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 281, -4 }, /* (118) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 281, -5 }, /* (119) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 281, -5 }, /* (120) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 281, -5 }, /* (121) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 281, -4 }, /* (122) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 281, -5 }, /* (123) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 281, -5 }, /* (124) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 281, -6 }, /* (125) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 278, -1 }, /* (126) multi_create_clause ::= create_subtable_clause */ + { 278, -2 }, /* (127) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 286, -10 }, /* (128) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ + { 280, -1 }, /* (129) multi_drop_clause ::= drop_table_clause */ + { 280, -2 }, /* (130) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 289, -2 }, /* (131) drop_table_clause ::= exists_opt full_table_name */ + { 287, 0 }, /* (132) specific_tags_opt ::= */ + { 287, -3 }, /* (133) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 274, -1 }, /* (134) full_table_name ::= table_name */ + { 274, -3 }, /* (135) full_table_name ::= db_name NK_DOT table_name */ + { 275, -1 }, /* (136) column_def_list ::= column_def */ + { 275, -3 }, /* (137) column_def_list ::= column_def_list NK_COMMA column_def */ + { 292, -2 }, /* (138) column_def ::= column_name type_name */ + { 292, -4 }, /* (139) column_def ::= column_name type_name COMMENT NK_STRING */ + { 284, -1 }, /* (140) type_name ::= BOOL */ + { 284, -1 }, /* (141) type_name ::= TINYINT */ + { 284, -1 }, /* (142) type_name ::= SMALLINT */ + { 284, -1 }, /* (143) type_name ::= INT */ + { 284, -1 }, /* (144) type_name ::= INTEGER */ + { 284, -1 }, /* (145) type_name ::= BIGINT */ + { 284, -1 }, /* (146) type_name ::= FLOAT */ + { 284, -1 }, /* (147) type_name ::= DOUBLE */ + { 284, -4 }, /* (148) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (149) type_name ::= TIMESTAMP */ + { 284, -4 }, /* (150) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 284, -2 }, /* (151) type_name ::= TINYINT UNSIGNED */ + { 284, -2 }, /* (152) type_name ::= SMALLINT UNSIGNED */ + { 284, -2 }, /* (153) type_name ::= INT UNSIGNED */ + { 284, -2 }, /* (154) type_name ::= BIGINT UNSIGNED */ + { 284, -1 }, /* (155) type_name ::= JSON */ + { 284, -4 }, /* (156) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (157) type_name ::= MEDIUMBLOB */ + { 284, -1 }, /* (158) type_name ::= BLOB */ + { 284, -4 }, /* (159) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 284, -1 }, /* (160) type_name ::= DECIMAL */ + { 284, -4 }, /* (161) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 284, -6 }, /* (162) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 276, 0 }, /* (163) tags_def_opt ::= */ + { 276, -1 }, /* (164) tags_def_opt ::= tags_def */ + { 279, -4 }, /* (165) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 277, 0 }, /* (166) table_options ::= */ + { 277, -3 }, /* (167) table_options ::= table_options COMMENT NK_STRING */ + { 277, -3 }, /* (168) table_options ::= table_options MAX_DELAY duration_list */ + { 277, -3 }, /* (169) table_options ::= table_options WATERMARK duration_list */ + { 277, -5 }, /* (170) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 277, -3 }, /* (171) table_options ::= table_options TTL NK_INTEGER */ + { 277, -5 }, /* (172) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 282, -1 }, /* (173) alter_table_options ::= alter_table_option */ + { 282, -2 }, /* (174) alter_table_options ::= alter_table_options alter_table_option */ + { 295, -2 }, /* (175) alter_table_option ::= COMMENT NK_STRING */ + { 295, -2 }, /* (176) alter_table_option ::= TTL NK_INTEGER */ + { 293, -1 }, /* (177) duration_list ::= duration_literal */ + { 293, -3 }, /* (178) duration_list ::= duration_list NK_COMMA duration_literal */ + { 294, -1 }, /* (179) rollup_func_list ::= rollup_func_name */ + { 294, -3 }, /* (180) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 297, -1 }, /* (181) rollup_func_name ::= function_name */ + { 297, -1 }, /* (182) rollup_func_name ::= FIRST */ + { 297, -1 }, /* (183) rollup_func_name ::= LAST */ + { 290, -1 }, /* (184) col_name_list ::= col_name */ + { 290, -3 }, /* (185) col_name_list ::= col_name_list NK_COMMA col_name */ + { 299, -1 }, /* (186) col_name ::= column_name */ + { 252, -2 }, /* (187) cmd ::= SHOW DNODES */ + { 252, -2 }, /* (188) cmd ::= SHOW USERS */ + { 252, -2 }, /* (189) cmd ::= SHOW DATABASES */ + { 252, -4 }, /* (190) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 252, -4 }, /* (191) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 252, -3 }, /* (192) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 252, -2 }, /* (193) cmd ::= SHOW MNODES */ + { 252, -2 }, /* (194) cmd ::= SHOW MODULES */ + { 252, -2 }, /* (195) cmd ::= SHOW QNODES */ + { 252, -2 }, /* (196) cmd ::= SHOW FUNCTIONS */ + { 252, -5 }, /* (197) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 252, -2 }, /* (198) cmd ::= SHOW STREAMS */ + { 252, -2 }, /* (199) cmd ::= SHOW ACCOUNTS */ + { 252, -2 }, /* (200) cmd ::= SHOW APPS */ + { 252, -2 }, /* (201) cmd ::= SHOW CONNECTIONS */ + { 252, -2 }, /* (202) cmd ::= SHOW LICENCE */ + { 252, -2 }, /* (203) cmd ::= SHOW GRANTS */ + { 252, -4 }, /* (204) cmd ::= SHOW CREATE DATABASE db_name */ + { 252, -4 }, /* (205) cmd ::= SHOW CREATE TABLE full_table_name */ + { 252, -4 }, /* (206) cmd ::= SHOW CREATE STABLE full_table_name */ + { 252, -2 }, /* (207) cmd ::= SHOW QUERIES */ + { 252, -2 }, /* (208) cmd ::= SHOW SCORES */ + { 252, -2 }, /* (209) cmd ::= SHOW TOPICS */ + { 252, -2 }, /* (210) cmd ::= SHOW VARIABLES */ + { 252, -3 }, /* (211) cmd ::= SHOW LOCAL VARIABLES */ + { 252, -4 }, /* (212) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 252, -2 }, /* (213) cmd ::= SHOW BNODES */ + { 252, -2 }, /* (214) cmd ::= SHOW SNODES */ + { 252, -2 }, /* (215) cmd ::= SHOW CLUSTER */ + { 252, -2 }, /* (216) cmd ::= SHOW TRANSACTIONS */ + { 252, -4 }, /* (217) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 252, -2 }, /* (218) cmd ::= SHOW CONSUMERS */ + { 252, -2 }, /* (219) cmd ::= SHOW SUBSCRIPTIONS */ + { 300, 0 }, /* (220) db_name_cond_opt ::= */ + { 300, -2 }, /* (221) db_name_cond_opt ::= db_name NK_DOT */ + { 301, 0 }, /* (222) like_pattern_opt ::= */ + { 301, -2 }, /* (223) like_pattern_opt ::= LIKE NK_STRING */ + { 302, -1 }, /* (224) table_name_cond ::= table_name */ + { 303, 0 }, /* (225) from_db_opt ::= */ + { 303, -2 }, /* (226) from_db_opt ::= FROM db_name */ + { 252, -8 }, /* (227) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 252, -4 }, /* (228) cmd ::= DROP INDEX exists_opt index_name */ + { 305, -10 }, /* (229) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 305, -12 }, /* (230) 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 */ + { 306, -1 }, /* (231) func_list ::= func */ + { 306, -3 }, /* (232) func_list ::= func_list NK_COMMA func */ + { 309, -4 }, /* (233) func ::= function_name NK_LP expression_list NK_RP */ + { 308, 0 }, /* (234) sma_stream_opt ::= */ + { 308, -3 }, /* (235) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 308, -3 }, /* (236) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 252, -6 }, /* (237) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 252, -7 }, /* (238) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 252, -9 }, /* (239) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 252, -7 }, /* (240) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 252, -9 }, /* (241) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 252, -4 }, /* (242) cmd ::= DROP TOPIC exists_opt topic_name */ + { 252, -7 }, /* (243) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 252, -2 }, /* (244) cmd ::= DESC full_table_name */ + { 252, -2 }, /* (245) cmd ::= DESCRIBE full_table_name */ + { 252, -3 }, /* (246) cmd ::= RESET QUERY CACHE */ + { 252, -4 }, /* (247) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 315, 0 }, /* (248) analyze_opt ::= */ + { 315, -1 }, /* (249) analyze_opt ::= ANALYZE */ + { 316, 0 }, /* (250) explain_options ::= */ + { 316, -3 }, /* (251) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 316, -3 }, /* (252) explain_options ::= explain_options RATIO NK_FLOAT */ + { 252, -6 }, /* (253) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 252, -10 }, /* (254) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 252, -4 }, /* (255) cmd ::= DROP FUNCTION exists_opt function_name */ + { 317, 0 }, /* (256) agg_func_opt ::= */ + { 317, -1 }, /* (257) agg_func_opt ::= AGGREGATE */ + { 318, 0 }, /* (258) bufsize_opt ::= */ + { 318, -2 }, /* (259) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 252, -8 }, /* (260) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 252, -4 }, /* (261) cmd ::= DROP STREAM exists_opt stream_name */ + { 320, 0 }, /* (262) into_opt ::= */ + { 320, -2 }, /* (263) into_opt ::= INTO full_table_name */ + { 311, 0 }, /* (264) stream_options ::= */ + { 311, -3 }, /* (265) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 311, -3 }, /* (266) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 311, -4 }, /* (267) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 311, -3 }, /* (268) stream_options ::= stream_options WATERMARK duration_literal */ + { 311, -3 }, /* (269) stream_options ::= stream_options IGNORE EXPIRED */ + { 252, -3 }, /* (270) cmd ::= KILL CONNECTION NK_INTEGER */ + { 252, -3 }, /* (271) cmd ::= KILL QUERY NK_STRING */ + { 252, -3 }, /* (272) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 252, -2 }, /* (273) cmd ::= BALANCE VGROUP */ + { 252, -4 }, /* (274) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 252, -4 }, /* (275) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 252, -3 }, /* (276) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 321, -2 }, /* (277) dnode_list ::= DNODE NK_INTEGER */ + { 321, -3 }, /* (278) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 252, -3 }, /* (279) cmd ::= SYNCDB db_name REPLICA */ + { 252, -4 }, /* (280) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 252, -1 }, /* (281) cmd ::= query_expression */ + { 255, -1 }, /* (282) literal ::= NK_INTEGER */ + { 255, -1 }, /* (283) literal ::= NK_FLOAT */ + { 255, -1 }, /* (284) literal ::= NK_STRING */ + { 255, -1 }, /* (285) literal ::= NK_BOOL */ + { 255, -2 }, /* (286) literal ::= TIMESTAMP NK_STRING */ + { 255, -1 }, /* (287) literal ::= duration_literal */ + { 255, -1 }, /* (288) literal ::= NULL */ + { 255, -1 }, /* (289) literal ::= NK_QUESTION */ + { 296, -1 }, /* (290) duration_literal ::= NK_VARIABLE */ + { 323, -1 }, /* (291) signed ::= NK_INTEGER */ + { 323, -2 }, /* (292) signed ::= NK_PLUS NK_INTEGER */ + { 323, -2 }, /* (293) signed ::= NK_MINUS NK_INTEGER */ + { 323, -1 }, /* (294) signed ::= NK_FLOAT */ + { 323, -2 }, /* (295) signed ::= NK_PLUS NK_FLOAT */ + { 323, -2 }, /* (296) signed ::= NK_MINUS NK_FLOAT */ + { 285, -1 }, /* (297) signed_literal ::= signed */ + { 285, -1 }, /* (298) signed_literal ::= NK_STRING */ + { 285, -1 }, /* (299) signed_literal ::= NK_BOOL */ + { 285, -2 }, /* (300) signed_literal ::= TIMESTAMP NK_STRING */ + { 285, -1 }, /* (301) signed_literal ::= duration_literal */ + { 285, -1 }, /* (302) signed_literal ::= NULL */ + { 285, -1 }, /* (303) signed_literal ::= literal_func */ + { 288, -1 }, /* (304) literal_list ::= signed_literal */ + { 288, -3 }, /* (305) literal_list ::= literal_list NK_COMMA signed_literal */ + { 263, -1 }, /* (306) db_name ::= NK_ID */ + { 291, -1 }, /* (307) table_name ::= NK_ID */ + { 283, -1 }, /* (308) column_name ::= NK_ID */ + { 298, -1 }, /* (309) function_name ::= NK_ID */ + { 325, -1 }, /* (310) table_alias ::= NK_ID */ + { 326, -1 }, /* (311) column_alias ::= NK_ID */ + { 257, -1 }, /* (312) user_name ::= NK_ID */ + { 304, -1 }, /* (313) index_name ::= NK_ID */ + { 312, -1 }, /* (314) topic_name ::= NK_ID */ + { 319, -1 }, /* (315) stream_name ::= NK_ID */ + { 314, -1 }, /* (316) cgroup_name ::= NK_ID */ + { 327, -1 }, /* (317) expression ::= literal */ + { 327, -1 }, /* (318) expression ::= pseudo_column */ + { 327, -1 }, /* (319) expression ::= column_reference */ + { 327, -1 }, /* (320) expression ::= function_expression */ + { 327, -1 }, /* (321) expression ::= subquery */ + { 327, -3 }, /* (322) expression ::= NK_LP expression NK_RP */ + { 327, -2 }, /* (323) expression ::= NK_PLUS expression */ + { 327, -2 }, /* (324) expression ::= NK_MINUS expression */ + { 327, -3 }, /* (325) expression ::= expression NK_PLUS expression */ + { 327, -3 }, /* (326) expression ::= expression NK_MINUS expression */ + { 327, -3 }, /* (327) expression ::= expression NK_STAR expression */ + { 327, -3 }, /* (328) expression ::= expression NK_SLASH expression */ + { 327, -3 }, /* (329) expression ::= expression NK_REM expression */ + { 327, -3 }, /* (330) expression ::= column_reference NK_ARROW NK_STRING */ + { 327, -3 }, /* (331) expression ::= expression NK_BITAND expression */ + { 327, -3 }, /* (332) expression ::= expression NK_BITOR expression */ + { 310, -1 }, /* (333) expression_list ::= expression */ + { 310, -3 }, /* (334) expression_list ::= expression_list NK_COMMA expression */ + { 329, -1 }, /* (335) column_reference ::= column_name */ + { 329, -3 }, /* (336) column_reference ::= table_name NK_DOT column_name */ + { 328, -1 }, /* (337) pseudo_column ::= ROWTS */ + { 328, -1 }, /* (338) pseudo_column ::= TBNAME */ + { 328, -3 }, /* (339) pseudo_column ::= table_name NK_DOT TBNAME */ + { 328, -1 }, /* (340) pseudo_column ::= QSTARTTS */ + { 328, -1 }, /* (341) pseudo_column ::= QENDTS */ + { 328, -1 }, /* (342) pseudo_column ::= WSTARTTS */ + { 328, -1 }, /* (343) pseudo_column ::= WENDTS */ + { 328, -1 }, /* (344) pseudo_column ::= WDURATION */ + { 330, -4 }, /* (345) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 330, -4 }, /* (346) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 330, -6 }, /* (347) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 330, -1 }, /* (348) function_expression ::= literal_func */ + { 324, -3 }, /* (349) literal_func ::= noarg_func NK_LP NK_RP */ + { 324, -1 }, /* (350) literal_func ::= NOW */ + { 334, -1 }, /* (351) noarg_func ::= NOW */ + { 334, -1 }, /* (352) noarg_func ::= TODAY */ + { 334, -1 }, /* (353) noarg_func ::= TIMEZONE */ + { 334, -1 }, /* (354) noarg_func ::= DATABASE */ + { 334, -1 }, /* (355) noarg_func ::= CLIENT_VERSION */ + { 334, -1 }, /* (356) noarg_func ::= SERVER_VERSION */ + { 334, -1 }, /* (357) noarg_func ::= SERVER_STATUS */ + { 334, -1 }, /* (358) noarg_func ::= CURRENT_USER */ + { 334, -1 }, /* (359) noarg_func ::= USER */ + { 332, -1 }, /* (360) star_func ::= COUNT */ + { 332, -1 }, /* (361) star_func ::= FIRST */ + { 332, -1 }, /* (362) star_func ::= LAST */ + { 332, -1 }, /* (363) star_func ::= LAST_ROW */ + { 333, -1 }, /* (364) star_func_para_list ::= NK_STAR */ + { 333, -1 }, /* (365) star_func_para_list ::= other_para_list */ + { 335, -1 }, /* (366) other_para_list ::= star_func_para */ + { 335, -3 }, /* (367) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 336, -1 }, /* (368) star_func_para ::= expression */ + { 336, -3 }, /* (369) star_func_para ::= table_name NK_DOT NK_STAR */ + { 337, -3 }, /* (370) predicate ::= expression compare_op expression */ + { 337, -5 }, /* (371) predicate ::= expression BETWEEN expression AND expression */ + { 337, -6 }, /* (372) predicate ::= expression NOT BETWEEN expression AND expression */ + { 337, -3 }, /* (373) predicate ::= expression IS NULL */ + { 337, -4 }, /* (374) predicate ::= expression IS NOT NULL */ + { 337, -3 }, /* (375) predicate ::= expression in_op in_predicate_value */ + { 338, -1 }, /* (376) compare_op ::= NK_LT */ + { 338, -1 }, /* (377) compare_op ::= NK_GT */ + { 338, -1 }, /* (378) compare_op ::= NK_LE */ + { 338, -1 }, /* (379) compare_op ::= NK_GE */ + { 338, -1 }, /* (380) compare_op ::= NK_NE */ + { 338, -1 }, /* (381) compare_op ::= NK_EQ */ + { 338, -1 }, /* (382) compare_op ::= LIKE */ + { 338, -2 }, /* (383) compare_op ::= NOT LIKE */ + { 338, -1 }, /* (384) compare_op ::= MATCH */ + { 338, -1 }, /* (385) compare_op ::= NMATCH */ + { 338, -1 }, /* (386) compare_op ::= CONTAINS */ + { 339, -1 }, /* (387) in_op ::= IN */ + { 339, -2 }, /* (388) in_op ::= NOT IN */ + { 340, -3 }, /* (389) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 341, -1 }, /* (390) boolean_value_expression ::= boolean_primary */ + { 341, -2 }, /* (391) boolean_value_expression ::= NOT boolean_primary */ + { 341, -3 }, /* (392) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 341, -3 }, /* (393) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 342, -1 }, /* (394) boolean_primary ::= predicate */ + { 342, -3 }, /* (395) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 343, -1 }, /* (396) common_expression ::= expression */ + { 343, -1 }, /* (397) common_expression ::= boolean_value_expression */ + { 344, 0 }, /* (398) from_clause_opt ::= */ + { 344, -2 }, /* (399) from_clause_opt ::= FROM table_reference_list */ + { 345, -1 }, /* (400) table_reference_list ::= table_reference */ + { 345, -3 }, /* (401) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 346, -1 }, /* (402) table_reference ::= table_primary */ + { 346, -1 }, /* (403) table_reference ::= joined_table */ + { 347, -2 }, /* (404) table_primary ::= table_name alias_opt */ + { 347, -4 }, /* (405) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 347, -2 }, /* (406) table_primary ::= subquery alias_opt */ + { 347, -1 }, /* (407) table_primary ::= parenthesized_joined_table */ + { 349, 0 }, /* (408) alias_opt ::= */ + { 349, -1 }, /* (409) alias_opt ::= table_alias */ + { 349, -2 }, /* (410) alias_opt ::= AS table_alias */ + { 350, -3 }, /* (411) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 350, -3 }, /* (412) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 348, -6 }, /* (413) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 351, 0 }, /* (414) join_type ::= */ + { 351, -1 }, /* (415) join_type ::= INNER */ + { 353, -12 }, /* (416) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 354, 0 }, /* (417) set_quantifier_opt ::= */ + { 354, -1 }, /* (418) set_quantifier_opt ::= DISTINCT */ + { 354, -1 }, /* (419) set_quantifier_opt ::= ALL */ + { 355, -1 }, /* (420) select_list ::= select_item */ + { 355, -3 }, /* (421) select_list ::= select_list NK_COMMA select_item */ + { 363, -1 }, /* (422) select_item ::= NK_STAR */ + { 363, -1 }, /* (423) select_item ::= common_expression */ + { 363, -2 }, /* (424) select_item ::= common_expression column_alias */ + { 363, -3 }, /* (425) select_item ::= common_expression AS column_alias */ + { 363, -3 }, /* (426) select_item ::= table_name NK_DOT NK_STAR */ + { 322, 0 }, /* (427) where_clause_opt ::= */ + { 322, -2 }, /* (428) where_clause_opt ::= WHERE search_condition */ + { 356, 0 }, /* (429) partition_by_clause_opt ::= */ + { 356, -3 }, /* (430) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 360, 0 }, /* (431) twindow_clause_opt ::= */ + { 360, -6 }, /* (432) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 360, -4 }, /* (433) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 360, -6 }, /* (434) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 360, -8 }, /* (435) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 307, 0 }, /* (436) sliding_opt ::= */ + { 307, -4 }, /* (437) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 359, 0 }, /* (438) fill_opt ::= */ + { 359, -4 }, /* (439) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 359, -6 }, /* (440) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 364, -1 }, /* (441) fill_mode ::= NONE */ + { 364, -1 }, /* (442) fill_mode ::= PREV */ + { 364, -1 }, /* (443) fill_mode ::= NULL */ + { 364, -1 }, /* (444) fill_mode ::= LINEAR */ + { 364, -1 }, /* (445) fill_mode ::= NEXT */ + { 361, 0 }, /* (446) group_by_clause_opt ::= */ + { 361, -3 }, /* (447) group_by_clause_opt ::= GROUP BY group_by_list */ + { 365, -1 }, /* (448) group_by_list ::= expression */ + { 365, -3 }, /* (449) group_by_list ::= group_by_list NK_COMMA expression */ + { 362, 0 }, /* (450) having_clause_opt ::= */ + { 362, -2 }, /* (451) having_clause_opt ::= HAVING search_condition */ + { 357, 0 }, /* (452) range_opt ::= */ + { 357, -6 }, /* (453) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 358, 0 }, /* (454) every_opt ::= */ + { 358, -4 }, /* (455) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 313, -4 }, /* (456) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 366, -1 }, /* (457) query_expression_body ::= query_primary */ + { 366, -4 }, /* (458) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 366, -3 }, /* (459) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 370, -1 }, /* (460) query_primary ::= query_specification */ + { 370, -6 }, /* (461) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 367, 0 }, /* (462) order_by_clause_opt ::= */ + { 367, -3 }, /* (463) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 368, 0 }, /* (464) slimit_clause_opt ::= */ + { 368, -2 }, /* (465) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 368, -4 }, /* (466) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 368, -4 }, /* (467) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 369, 0 }, /* (468) limit_clause_opt ::= */ + { 369, -2 }, /* (469) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 369, -4 }, /* (470) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 369, -4 }, /* (471) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 331, -3 }, /* (472) subquery ::= NK_LP query_expression NK_RP */ + { 352, -1 }, /* (473) search_condition ::= common_expression */ + { 371, -1 }, /* (474) sort_specification_list ::= sort_specification */ + { 371, -3 }, /* (475) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 372, -3 }, /* (476) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 373, 0 }, /* (477) ordering_specification_opt ::= */ + { 373, -1 }, /* (478) ordering_specification_opt ::= ASC */ + { 373, -1 }, /* (479) ordering_specification_opt ::= DESC */ + { 374, 0 }, /* (480) null_ordering_opt ::= */ + { 374, -2 }, /* (481) null_ordering_opt ::= NULLS FIRST */ + { 374, -2 }, /* (482) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3280,11 +3280,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,251,&yymsp[0].minor); + yy_destructor(yypParser,253,&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,252,&yymsp[0].minor); + yy_destructor(yypParser,254,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3298,20 +3298,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,251,&yymsp[-2].minor); +{ yy_destructor(yypParser,253,&yymsp[-2].minor); { } - yy_destructor(yypParser,253,&yymsp[0].minor); + yy_destructor(yypParser,255,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,254,&yymsp[0].minor); +{ yy_destructor(yypParser,256,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,252,&yymsp[-1].minor); +{ yy_destructor(yypParser,254,&yymsp[-1].minor); { } - yy_destructor(yypParser,254,&yymsp[0].minor); + yy_destructor(yypParser,256,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3325,72 +3325,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,253,&yymsp[0].minor); + yy_destructor(yypParser,255,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy0, yymsp[0].minor.yy619); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy0, yymsp[0].minor.yy653); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy657, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy329, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy329); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy619 = 1; } +{ yymsp[1].minor.yy653 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy619 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy653 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy701, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy609, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy701 = yymsp[0].minor.yy701; } - yymsp[0].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy609 = yymsp[0].minor.yy609; } + yymsp[0].minor.yy609 = yylhsminor.yy609; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy701 = yymsp[-2].minor.yy701 | yymsp[0].minor.yy701; } - yymsp[-2].minor.yy701 = yylhsminor.yy701; +{ yylhsminor.yy609 = yymsp[-2].minor.yy609 | yymsp[0].minor.yy609; } + yymsp[-2].minor.yy609 = yylhsminor.yy609; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy701 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy609 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy657 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy329 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy329 = yylhsminor.yy329; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy657 = yymsp[-2].minor.yy657; } - yymsp[-2].minor.yy657 = yylhsminor.yy657; +{ yylhsminor.yy329 = yymsp[-2].minor.yy329; } + yymsp[-2].minor.yy329 = yylhsminor.yy329; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy657, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy329, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy329); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3407,32 +3407,32 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 305: /* db_name ::= NK_ID */ yytestcase(yyruleno==305); - case 306: /* table_name ::= NK_ID */ yytestcase(yyruleno==306); - case 307: /* column_name ::= NK_ID */ yytestcase(yyruleno==307); - case 308: /* function_name ::= NK_ID */ yytestcase(yyruleno==308); - case 309: /* table_alias ::= NK_ID */ yytestcase(yyruleno==309); - case 310: /* column_alias ::= NK_ID */ yytestcase(yyruleno==310); - case 311: /* user_name ::= NK_ID */ yytestcase(yyruleno==311); - case 312: /* index_name ::= NK_ID */ yytestcase(yyruleno==312); - case 313: /* topic_name ::= NK_ID */ yytestcase(yyruleno==313); - case 314: /* stream_name ::= NK_ID */ yytestcase(yyruleno==314); - case 315: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==315); - case 350: /* noarg_func ::= NOW */ yytestcase(yyruleno==350); - case 351: /* noarg_func ::= TODAY */ yytestcase(yyruleno==351); - case 352: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==352); - case 353: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==353); - case 354: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==354); - case 355: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==355); - case 356: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==356); - case 357: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==357); - case 358: /* noarg_func ::= USER */ yytestcase(yyruleno==358); - case 359: /* star_func ::= COUNT */ yytestcase(yyruleno==359); - case 360: /* star_func ::= FIRST */ yytestcase(yyruleno==360); - case 361: /* star_func ::= LAST */ yytestcase(yyruleno==361); - case 362: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==362); -{ yylhsminor.yy657 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy657 = yylhsminor.yy657; + case 306: /* db_name ::= NK_ID */ yytestcase(yyruleno==306); + case 307: /* table_name ::= NK_ID */ yytestcase(yyruleno==307); + case 308: /* column_name ::= NK_ID */ yytestcase(yyruleno==308); + case 309: /* function_name ::= NK_ID */ yytestcase(yyruleno==309); + case 310: /* table_alias ::= NK_ID */ yytestcase(yyruleno==310); + case 311: /* column_alias ::= NK_ID */ yytestcase(yyruleno==311); + case 312: /* user_name ::= NK_ID */ yytestcase(yyruleno==312); + case 313: /* index_name ::= NK_ID */ yytestcase(yyruleno==313); + case 314: /* topic_name ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* stream_name ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==316); + case 351: /* noarg_func ::= NOW */ yytestcase(yyruleno==351); + case 352: /* noarg_func ::= TODAY */ yytestcase(yyruleno==352); + case 353: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==353); + case 354: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==354); + case 355: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==355); + case 356: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==356); + case 357: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==357); + case 358: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==358); + case 359: /* noarg_func ::= USER */ yytestcase(yyruleno==359); + case 360: /* star_func ::= COUNT */ yytestcase(yyruleno==360); + case 361: /* star_func ::= FIRST */ yytestcase(yyruleno==361); + case 362: /* star_func ::= LAST */ yytestcase(yyruleno==362); + case 363: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==363); +{ yylhsminor.yy329 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy329 = yylhsminor.yy329; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3465,156 +3465,156 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy97, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy737, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy212); } break; case 66: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy97 = true; } +{ yymsp[-2].minor.yy737 = true; } break; case 67: /* not_exists_opt ::= */ case 69: /* exists_opt ::= */ yytestcase(yyruleno==69); case 248: /* analyze_opt ::= */ yytestcase(yyruleno==248); case 256: /* agg_func_opt ::= */ yytestcase(yyruleno==256); - case 416: /* set_quantifier_opt ::= */ yytestcase(yyruleno==416); -{ yymsp[1].minor.yy97 = false; } + case 417: /* set_quantifier_opt ::= */ yytestcase(yyruleno==417); +{ yymsp[1].minor.yy737 = false; } break; case 68: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy97 = true; } +{ yymsp[-1].minor.yy737 = true; } break; case 70: /* db_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultDatabaseOptions(pCxt); } break; case 71: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 72: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 73: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 74: /* db_options ::= db_options DURATION NK_INTEGER */ case 75: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==75); -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 76: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 77: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 78: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 79: /* db_options ::= db_options KEEP integer_list */ case 80: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==80); -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_KEEP, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_KEEP, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 81: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 82: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 83: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 84: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 85: /* db_options ::= db_options STRICT NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 86: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 87: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 88: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 89: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_RETENTIONS, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_RETENTIONS, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 90: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy652 = setDatabaseOption(pCxt, yymsp[-2].minor.yy652, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setDatabaseOption(pCxt, yymsp[-2].minor.yy212, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 91: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy652 = createAlterDatabaseOptions(pCxt); yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yylhsminor.yy652, &yymsp[0].minor.yy189); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterDatabaseOptions(pCxt); yylhsminor.yy212 = setAlterDatabaseOption(pCxt, yylhsminor.yy212, &yymsp[0].minor.yy245); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 92: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy652 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy652, &yymsp[0].minor.yy189); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy212, &yymsp[0].minor.yy245); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 93: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 94: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 95: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 96: /* alter_db_option ::= KEEP integer_list */ case 97: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==97); -{ yymsp[-1].minor.yy189.type = DB_OPTION_KEEP; yymsp[-1].minor.yy189.pList = yymsp[0].minor.yy24; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_KEEP; yymsp[-1].minor.yy245.pList = yymsp[0].minor.yy424; } break; case 98: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_PAGES; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_PAGES; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 99: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 100: /* alter_db_option ::= STRICT NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_STRICT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_STRICT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 101: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_WAL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = DB_OPTION_WAL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 102: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 103: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 277: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==277); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 278: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==278); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 104: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy24 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 105: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 106: /* retention_list ::= retention */ case 126: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==126); @@ -3623,265 +3623,264 @@ static YYACTIONTYPE yy_reduce( case 179: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==179); case 184: /* col_name_list ::= col_name */ yytestcase(yyruleno==184); case 231: /* func_list ::= func */ yytestcase(yyruleno==231); - case 303: /* literal_list ::= signed_literal */ yytestcase(yyruleno==303); - case 365: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==365); - case 421: /* select_sublist ::= select_item */ yytestcase(yyruleno==421); + case 304: /* literal_list ::= signed_literal */ yytestcase(yyruleno==304); + case 366: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==366); + case 420: /* select_list ::= select_item */ yytestcase(yyruleno==420); case 474: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==474); -{ yylhsminor.yy24 = createNodeList(pCxt, yymsp[0].minor.yy652); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = createNodeList(pCxt, yymsp[0].minor.yy212); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 107: /* retention_list ::= retention_list NK_COMMA retention */ case 137: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==137); case 180: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==180); case 185: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); case 232: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==232); - case 304: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==304); - case 366: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==366); - case 422: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==422); + case 305: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==305); + case 367: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==367); + case 421: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==421); case 475: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==475); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 108: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy652 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 109: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 111: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==111); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-5].minor.yy652, yymsp[-3].minor.yy24, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy737, yymsp[-5].minor.yy212, yymsp[-3].minor.yy424, yymsp[-1].minor.yy424, yymsp[0].minor.yy212); } break; case 110: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 112: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy24); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy424); } break; case 113: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy212); } break; case 114: /* cmd ::= ALTER TABLE alter_table_clause */ case 115: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==115); - case 280: /* cmd ::= query_expression */ yytestcase(yyruleno==280); -{ pCxt->pRootNode = yymsp[0].minor.yy652; } + case 281: /* cmd ::= query_expression */ yytestcase(yyruleno==281); +{ pCxt->pRootNode = yymsp[0].minor.yy212; } break; case 116: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy652 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 117: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 118: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy212, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 119: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 120: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 121: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 122: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy652 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy652, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy212, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 123: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy652 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 124: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy652 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy652, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy212, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 125: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy652 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy652, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy212, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; case 127: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 130: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==130); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-1].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-1].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy424 = yylhsminor.yy424; break; case 128: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP table_options */ -{ yylhsminor.yy652 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy97, yymsp[-8].minor.yy652, yymsp[-6].minor.yy652, yymsp[-5].minor.yy24, yymsp[-2].minor.yy24, yymsp[0].minor.yy652); } - yymsp[-9].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy737, yymsp[-8].minor.yy212, yymsp[-6].minor.yy212, yymsp[-5].minor.yy424, yymsp[-2].minor.yy424, yymsp[0].minor.yy212); } + yymsp[-9].minor.yy212 = yylhsminor.yy212; break; case 131: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy652 = createDropTableClause(pCxt, yymsp[-1].minor.yy97, yymsp[0].minor.yy652); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createDropTableClause(pCxt, yymsp[-1].minor.yy737, yymsp[0].minor.yy212); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 132: /* specific_tags_opt ::= */ case 163: /* tags_def_opt ::= */ yytestcase(yyruleno==163); case 429: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==429); case 446: /* group_by_clause_opt ::= */ yytestcase(yyruleno==446); case 462: /* order_by_clause_opt ::= */ yytestcase(yyruleno==462); -{ yymsp[1].minor.yy24 = NULL; } +{ yymsp[1].minor.yy424 = NULL; } break; case 133: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy24 = yymsp[-1].minor.yy24; } +{ yymsp[-2].minor.yy424 = yymsp[-1].minor.yy424; } break; case 134: /* full_table_name ::= table_name */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy657, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy329, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 135: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, NULL); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createRealTableNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, NULL); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 138: /* column_def ::= column_name type_name */ -{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy657, yymsp[0].minor.yy48, NULL); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy329, yymsp[0].minor.yy34, NULL); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 139: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy652 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-2].minor.yy48, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-2].minor.yy34, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 140: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 141: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 142: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 143: /* type_name ::= INT */ case 144: /* type_name ::= INTEGER */ yytestcase(yyruleno==144); -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_INT); } break; case 145: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 146: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 147: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 148: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 149: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 150: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 151: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 152: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 153: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 154: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy48 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy34 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 155: /* type_name ::= JSON */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 156: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 158: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 159: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy34 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 160: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 161: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 162: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy48 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy34 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 164: /* tags_def_opt ::= tags_def */ - case 364: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==364); - case 420: /* select_list ::= select_sublist */ yytestcase(yyruleno==420); -{ yylhsminor.yy24 = yymsp[0].minor.yy24; } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 365: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==365); +{ yylhsminor.yy424 = yymsp[0].minor.yy424; } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 165: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy24 = yymsp[-1].minor.yy24; } +{ yymsp[-3].minor.yy424 = yymsp[-1].minor.yy424; } break; case 166: /* table_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultTableOptions(pCxt); } break; case 167: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 168: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 169: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy24); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy424); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 170: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy24); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 171: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-2].minor.yy652, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-2].minor.yy212, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 172: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-4].minor.yy652, TABLE_OPTION_SMA, yymsp[-1].minor.yy24); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-4].minor.yy212, TABLE_OPTION_SMA, yymsp[-1].minor.yy424); } + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; case 173: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy652 = createAlterTableOptions(pCxt); yylhsminor.yy652 = setTableOption(pCxt, yylhsminor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createAlterTableOptions(pCxt); yylhsminor.yy212 = setTableOption(pCxt, yylhsminor.yy212, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 174: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy652 = setTableOption(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setTableOption(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy245.type, &yymsp[0].minor.yy245.val); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 175: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 176: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy245.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy245.val = yymsp[0].minor.yy0; } break; case 177: /* duration_list ::= duration_literal */ - case 332: /* expression_list ::= expression */ yytestcase(yyruleno==332); -{ yylhsminor.yy24 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 333: /* expression_list ::= expression */ yytestcase(yyruleno==333); +{ yylhsminor.yy424 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 178: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 333: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==333); -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; + case 334: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==334); +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 181: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy657, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy329, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 182: /* rollup_func_name ::= FIRST */ case 183: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==183); -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 186: /* col_name ::= column_name */ -{ yylhsminor.yy652 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 187: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3893,13 +3892,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 190: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } break; case 191: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, OP_TYPE_LIKE); } break; case 192: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy652, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy212, NULL, OP_TYPE_LIKE); } break; case 193: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -3914,7 +3913,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 197: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy652, yymsp[-1].minor.yy652, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy212, yymsp[-1].minor.yy212, OP_TYPE_EQUAL); } break; case 198: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -3933,13 +3932,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 204: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy329); } break; case 205: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy212); } break; case 206: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy212); } break; case 207: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -3972,7 +3971,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 217: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy212); } break; case 218: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -3982,15 +3981,15 @@ static YYACTIONTYPE yy_reduce( break; case 220: /* db_name_cond_opt ::= */ case 225: /* from_db_opt ::= */ yytestcase(yyruleno==225); -{ yymsp[1].minor.yy652 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultDatabaseCondValue(pCxt); } break; case 221: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 222: /* like_pattern_opt ::= */ case 262: /* into_opt ::= */ yytestcase(yyruleno==262); - case 397: /* from_clause_opt ::= */ yytestcase(yyruleno==397); + case 398: /* from_clause_opt ::= */ yytestcase(yyruleno==398); case 427: /* where_clause_opt ::= */ yytestcase(yyruleno==427); case 431: /* twindow_clause_opt ::= */ yytestcase(yyruleno==431); case 436: /* sliding_opt ::= */ yytestcase(yyruleno==436); @@ -4000,680 +3999,685 @@ static YYACTIONTYPE yy_reduce( case 454: /* every_opt ::= */ yytestcase(yyruleno==454); case 464: /* slimit_clause_opt ::= */ yytestcase(yyruleno==464); case 468: /* limit_clause_opt ::= */ yytestcase(yyruleno==468); -{ yymsp[1].minor.yy652 = NULL; } +{ yymsp[1].minor.yy212 = NULL; } break; case 223: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 224: /* table_name_cond ::= table_name */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 226: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy657); } +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy329); } break; case 227: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, NULL, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, NULL, yymsp[0].minor.yy212); } break; case 228: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 229: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy652 = createIndexOption(pCxt, yymsp[-7].minor.yy24, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-9].minor.yy212 = createIndexOption(pCxt, yymsp[-7].minor.yy424, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 230: /* 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.yy652 = createIndexOption(pCxt, yymsp[-9].minor.yy24, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-11].minor.yy212 = createIndexOption(pCxt, yymsp[-9].minor.yy424, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 233: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy652 = createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 234: /* sma_stream_opt ::= */ case 264: /* stream_options ::= */ yytestcase(yyruleno==264); -{ yymsp[1].minor.yy652 = createStreamOptions(pCxt); } +{ yymsp[1].minor.yy212 = createStreamOptions(pCxt); } break; case 235: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ case 268: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==268); -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 236: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 237: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, yymsp[0].minor.yy212); } break; case 238: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy657, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy329, false); } break; case 239: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[0].minor.yy657, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy737, &yymsp[-5].minor.yy329, &yymsp[0].minor.yy329, true); } break; case 240: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy97, &yymsp[-3].minor.yy657, yymsp[0].minor.yy652, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy737, &yymsp[-3].minor.yy329, yymsp[0].minor.yy212, false); } break; case 241: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy97, &yymsp[-5].minor.yy657, yymsp[0].minor.yy652, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy737, &yymsp[-5].minor.yy329, yymsp[0].minor.yy212, true); } break; case 242: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 243: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy97, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy737, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329); } break; case 244: /* cmd ::= DESC full_table_name */ case 245: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==245); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy212); } break; case 246: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 247: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy97, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy737, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 249: /* analyze_opt ::= ANALYZE */ case 257: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==257); - case 417: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==417); -{ yymsp[0].minor.yy97 = true; } + case 418: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==418); +{ yymsp[0].minor.yy737 = true; } break; case 250: /* explain_options ::= */ -{ yymsp[1].minor.yy652 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy212 = createDefaultExplainOptions(pCxt); } break; case 251: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy652 = setExplainVerbose(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setExplainVerbose(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 252: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy652 = setExplainRatio(pCxt, yymsp[-2].minor.yy652, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setExplainRatio(pCxt, yymsp[-2].minor.yy212, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 253: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy24); } +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy424); } break; case 254: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy97, yymsp[-8].minor.yy97, &yymsp[-5].minor.yy657, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy48, yymsp[0].minor.yy244); } +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy737, yymsp[-8].minor.yy737, &yymsp[-5].minor.yy329, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy34, yymsp[0].minor.yy610); } break; case 255: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 258: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy244 = 0; } +{ yymsp[1].minor.yy610 = 0; } break; case 259: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy244 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy610 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; case 260: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy97, &yymsp[-4].minor.yy657, yymsp[-2].minor.yy652, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy737, &yymsp[-4].minor.yy329, yymsp[-2].minor.yy212, yymsp[-3].minor.yy212, yymsp[0].minor.yy212); } break; case 261: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy97, &yymsp[0].minor.yy657); } +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy737, &yymsp[0].minor.yy329); } break; case 263: /* into_opt ::= INTO full_table_name */ - case 398: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==398); + case 399: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==399); case 428: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==428); case 451: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==451); -{ yymsp[-1].minor.yy652 = yymsp[0].minor.yy652; } +{ yymsp[-1].minor.yy212 = yymsp[0].minor.yy212; } break; case 265: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 266: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy652)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy652 = yymsp[-2].minor.yy652; } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 267: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy652)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy652)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); yylhsminor.yy652 = yymsp[-3].minor.yy652; } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ ((SStreamOptions*)yymsp[-3].minor.yy212)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy212)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); yylhsminor.yy212 = yymsp[-3].minor.yy212; } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 269: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 269: /* stream_options ::= stream_options IGNORE EXPIRED */ +{ ((SStreamOptions*)yymsp[-2].minor.yy212)->ignoreExpired = true; yylhsminor.yy212 = yymsp[-2].minor.yy212; } + yymsp[-2].minor.yy212 = yylhsminor.yy212; + break; + case 270: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 270: /* cmd ::= KILL QUERY NK_STRING */ + case 271: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 271: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 272: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 272: /* cmd ::= BALANCE VGROUP */ + case 273: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 273: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 274: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 274: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy24); } + case 275: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy424); } break; - case 275: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 276: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 276: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy24 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 277: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy424 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 278: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy657); } + case 279: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy329); } break; - case 279: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } + case 280: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; - case 281: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 282: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 282: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 283: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 283: /* literal ::= NK_STRING */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 284: /* literal ::= NK_STRING */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 284: /* literal ::= NK_BOOL */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 285: /* literal ::= NK_BOOL */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 285: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + case 286: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 286: /* literal ::= duration_literal */ - case 296: /* signed_literal ::= signed */ yytestcase(yyruleno==296); - case 316: /* expression ::= literal */ yytestcase(yyruleno==316); - case 317: /* expression ::= pseudo_column */ yytestcase(yyruleno==317); - case 318: /* expression ::= column_reference */ yytestcase(yyruleno==318); - case 319: /* expression ::= function_expression */ yytestcase(yyruleno==319); - case 320: /* expression ::= subquery */ yytestcase(yyruleno==320); - case 347: /* function_expression ::= literal_func */ yytestcase(yyruleno==347); - case 389: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==389); - case 393: /* boolean_primary ::= predicate */ yytestcase(yyruleno==393); - case 395: /* common_expression ::= expression */ yytestcase(yyruleno==395); - case 396: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==396); - case 399: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==399); - case 401: /* table_reference ::= table_primary */ yytestcase(yyruleno==401); - case 402: /* table_reference ::= joined_table */ yytestcase(yyruleno==402); - case 406: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==406); + case 287: /* literal ::= duration_literal */ + case 297: /* signed_literal ::= signed */ yytestcase(yyruleno==297); + case 317: /* expression ::= literal */ yytestcase(yyruleno==317); + case 318: /* expression ::= pseudo_column */ yytestcase(yyruleno==318); + case 319: /* expression ::= column_reference */ yytestcase(yyruleno==319); + case 320: /* expression ::= function_expression */ yytestcase(yyruleno==320); + case 321: /* expression ::= subquery */ yytestcase(yyruleno==321); + case 348: /* function_expression ::= literal_func */ yytestcase(yyruleno==348); + case 390: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==390); + case 394: /* boolean_primary ::= predicate */ yytestcase(yyruleno==394); + case 396: /* common_expression ::= expression */ yytestcase(yyruleno==396); + case 397: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==397); + case 400: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==400); + case 402: /* table_reference ::= table_primary */ yytestcase(yyruleno==402); + case 403: /* table_reference ::= joined_table */ yytestcase(yyruleno==403); + case 407: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==407); case 457: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==457); case 460: /* query_primary ::= query_specification */ yytestcase(yyruleno==460); -{ yylhsminor.yy652 = yymsp[0].minor.yy652; } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = yymsp[0].minor.yy212; } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 287: /* literal ::= NULL */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 288: /* literal ::= NULL */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 288: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 289: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 289: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 290: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 290: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 291: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 291: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + case 292: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 292: /* signed ::= NK_MINUS NK_INTEGER */ + case 293: /* 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.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 293: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 294: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 294: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 295: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 295: /* signed ::= NK_MINUS NK_FLOAT */ + case 296: /* 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.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 297: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 298: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 298: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 299: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 299: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 300: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 300: /* signed_literal ::= duration_literal */ - case 302: /* signed_literal ::= literal_func */ yytestcase(yyruleno==302); - case 367: /* star_func_para ::= expression */ yytestcase(yyruleno==367); + case 301: /* signed_literal ::= duration_literal */ + case 303: /* signed_literal ::= literal_func */ yytestcase(yyruleno==303); + case 368: /* star_func_para ::= expression */ yytestcase(yyruleno==368); case 423: /* select_item ::= common_expression */ yytestcase(yyruleno==423); case 473: /* search_condition ::= common_expression */ yytestcase(yyruleno==473); -{ yylhsminor.yy652 = releaseRawExprNode(pCxt, yymsp[0].minor.yy652); } - yymsp[0].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = releaseRawExprNode(pCxt, yymsp[0].minor.yy212); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 301: /* signed_literal ::= NULL */ -{ yylhsminor.yy652 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 302: /* signed_literal ::= NULL */ +{ yylhsminor.yy212 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 321: /* expression ::= NK_LP expression NK_RP */ - case 394: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==394); -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 322: /* expression ::= NK_LP expression NK_RP */ + case 395: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==395); +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 322: /* expression ::= NK_PLUS expression */ + case 323: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy652)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy212)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 323: /* expression ::= NK_MINUS expression */ + case 324: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy212), NULL)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 324: /* expression ::= expression NK_PLUS expression */ + case 325: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 325: /* expression ::= expression NK_MINUS expression */ + case 326: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 326: /* expression ::= expression NK_STAR expression */ + case 327: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 327: /* expression ::= expression NK_SLASH expression */ + case 328: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 328: /* expression ::= expression NK_REM expression */ + case 329: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 329: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 330: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 330: /* expression ::= expression NK_BITAND expression */ + case 331: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 331: /* expression ::= expression NK_BITOR expression */ + case 332: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 334: /* column_reference ::= column_name */ -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy657, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy657)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 335: /* column_reference ::= column_name */ +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy329, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy329)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 335: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657, createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy657)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 336: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329, createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy329)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 336: /* pseudo_column ::= ROWTS */ - case 337: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==337); - case 339: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==339); - case 340: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==340); - case 341: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==341); - case 342: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==342); - case 343: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==343); - case 349: /* literal_func ::= NOW */ yytestcase(yyruleno==349); -{ yylhsminor.yy652 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy652 = yylhsminor.yy652; + case 337: /* pseudo_column ::= ROWTS */ + case 338: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==338); + case 340: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==340); + case 341: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==341); + case 342: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==342); + case 343: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==343); + case 344: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==344); + case 350: /* literal_func ::= NOW */ yytestcase(yyruleno==350); +{ yylhsminor.yy212 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; - case 338: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy657)))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 339: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy329)))); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 344: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 345: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==345); -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy657, yymsp[-1].minor.yy24)); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + case 345: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 346: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==346); +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy329, yymsp[-1].minor.yy424)); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 346: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy48)); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; + case 347: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy34)); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 348: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy657, NULL)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 349: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy329, NULL)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 363: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy24 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy24 = yylhsminor.yy24; + case 364: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy424 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; - case 368: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 369: /* star_func_para ::= table_name NK_DOT NK_STAR */ case 426: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==426); -{ yylhsminor.yy652 = createColumnNode(pCxt, &yymsp[-2].minor.yy657, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createColumnNode(pCxt, &yymsp[-2].minor.yy329, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 369: /* predicate ::= expression compare_op expression */ - case 374: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==374); + case 370: /* predicate ::= expression compare_op expression */ + case 375: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==375); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy700, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy290, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 370: /* predicate ::= expression BETWEEN expression AND expression */ + case 371: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy212), releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-4].minor.yy652 = yylhsminor.yy652; + yymsp[-4].minor.yy212 = yylhsminor.yy212; break; - case 371: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 372: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 372: /* predicate ::= expression IS NULL */ + case 373: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), NULL)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 373: /* predicate ::= expression IS NOT NULL */ + case 374: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL)); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 375: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_THAN; } + case 376: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_THAN; } break; - case 376: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_THAN; } + case 377: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_THAN; } break; - case 377: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy700 = OP_TYPE_LOWER_EQUAL; } + case 378: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy290 = OP_TYPE_LOWER_EQUAL; } break; - case 378: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy700 = OP_TYPE_GREATER_EQUAL; } + case 379: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy290 = OP_TYPE_GREATER_EQUAL; } break; - case 379: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy700 = OP_TYPE_NOT_EQUAL; } + case 380: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy290 = OP_TYPE_NOT_EQUAL; } break; - case 380: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy700 = OP_TYPE_EQUAL; } + case 381: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy290 = OP_TYPE_EQUAL; } break; - case 381: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy700 = OP_TYPE_LIKE; } + case 382: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy290 = OP_TYPE_LIKE; } break; - case 382: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_LIKE; } + case 383: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_LIKE; } break; - case 383: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy700 = OP_TYPE_MATCH; } + case 384: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy290 = OP_TYPE_MATCH; } break; - case 384: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy700 = OP_TYPE_NMATCH; } + case 385: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy290 = OP_TYPE_NMATCH; } break; - case 385: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy700 = OP_TYPE_JSON_CONTAINS; } + case 386: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy290 = OP_TYPE_JSON_CONTAINS; } break; - case 386: /* in_op ::= IN */ -{ yymsp[0].minor.yy700 = OP_TYPE_IN; } + case 387: /* in_op ::= IN */ +{ yymsp[0].minor.yy290 = OP_TYPE_IN; } break; - case 387: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy700 = OP_TYPE_NOT_IN; } + case 388: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy290 = OP_TYPE_NOT_IN; } break; - case 388: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 389: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 390: /* boolean_value_expression ::= NOT boolean_primary */ + case 391: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy652), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy212), NULL)); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 391: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 392: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 392: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 393: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy652); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy652); - yylhsminor.yy652 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy212); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy212); + yylhsminor.yy212 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 400: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy652 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy652, yymsp[0].minor.yy652, NULL); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; + case 401: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy212 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy212, yymsp[0].minor.yy212, NULL); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; - case 403: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + case 404: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy212 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 404: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy652 = createRealTableNode(pCxt, &yymsp[-3].minor.yy657, &yymsp[-1].minor.yy657, &yymsp[0].minor.yy657); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + case 405: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy212 = createRealTableNode(pCxt, &yymsp[-3].minor.yy329, &yymsp[-1].minor.yy329, &yymsp[0].minor.yy329); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; - case 405: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy652 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; + case 406: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy212 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; - case 407: /* alias_opt ::= */ -{ yymsp[1].minor.yy657 = nil_token; } + case 408: /* alias_opt ::= */ +{ yymsp[1].minor.yy329 = nil_token; } break; - case 408: /* alias_opt ::= table_alias */ -{ yylhsminor.yy657 = yymsp[0].minor.yy657; } - yymsp[0].minor.yy657 = yylhsminor.yy657; + case 409: /* alias_opt ::= table_alias */ +{ yylhsminor.yy329 = yymsp[0].minor.yy329; } + yymsp[0].minor.yy329 = yylhsminor.yy329; break; - case 409: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy657 = yymsp[0].minor.yy657; } + case 410: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy329 = yymsp[0].minor.yy329; } break; - case 410: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 411: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==411); -{ yymsp[-2].minor.yy652 = yymsp[-1].minor.yy652; } + case 411: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 412: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==412); +{ yymsp[-2].minor.yy212 = yymsp[-1].minor.yy212; } break; - case 412: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy652 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy652, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-5].minor.yy652 = yylhsminor.yy652; + case 413: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy212 = createJoinTableNode(pCxt, yymsp[-4].minor.yy162, yymsp[-5].minor.yy212, yymsp[-2].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-5].minor.yy212 = yylhsminor.yy212; break; - case 413: /* join_type ::= */ -{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; } + case 414: /* join_type ::= */ +{ yymsp[1].minor.yy162 = JOIN_TYPE_INNER; } break; - case 414: /* join_type ::= INNER */ -{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; } + case 415: /* join_type ::= INNER */ +{ yymsp[0].minor.yy162 = JOIN_TYPE_INNER; } break; - case 415: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 416: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy652 = createSelectStmt(pCxt, yymsp[-10].minor.yy97, yymsp[-9].minor.yy24, yymsp[-8].minor.yy652); - yymsp[-11].minor.yy652 = addWhereClause(pCxt, yymsp[-11].minor.yy652, yymsp[-7].minor.yy652); - yymsp[-11].minor.yy652 = addPartitionByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-6].minor.yy24); - yymsp[-11].minor.yy652 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy652, yymsp[-2].minor.yy652); - yymsp[-11].minor.yy652 = addGroupByClause(pCxt, yymsp[-11].minor.yy652, yymsp[-1].minor.yy24); - yymsp[-11].minor.yy652 = addHavingClause(pCxt, yymsp[-11].minor.yy652, yymsp[0].minor.yy652); - yymsp[-11].minor.yy652 = addRangeClause(pCxt, yymsp[-11].minor.yy652, yymsp[-5].minor.yy652); - yymsp[-11].minor.yy652 = addEveryClause(pCxt, yymsp[-11].minor.yy652, yymsp[-4].minor.yy652); - yymsp[-11].minor.yy652 = addFillClause(pCxt, yymsp[-11].minor.yy652, yymsp[-3].minor.yy652); + yymsp[-11].minor.yy212 = createSelectStmt(pCxt, yymsp[-10].minor.yy737, yymsp[-9].minor.yy424, yymsp[-8].minor.yy212); + yymsp[-11].minor.yy212 = addWhereClause(pCxt, yymsp[-11].minor.yy212, yymsp[-7].minor.yy212); + yymsp[-11].minor.yy212 = addPartitionByClause(pCxt, yymsp[-11].minor.yy212, yymsp[-6].minor.yy424); + yymsp[-11].minor.yy212 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy212, yymsp[-2].minor.yy212); + yymsp[-11].minor.yy212 = addGroupByClause(pCxt, yymsp[-11].minor.yy212, yymsp[-1].minor.yy424); + yymsp[-11].minor.yy212 = addHavingClause(pCxt, yymsp[-11].minor.yy212, yymsp[0].minor.yy212); + yymsp[-11].minor.yy212 = addRangeClause(pCxt, yymsp[-11].minor.yy212, yymsp[-5].minor.yy212); + yymsp[-11].minor.yy212 = addEveryClause(pCxt, yymsp[-11].minor.yy212, yymsp[-4].minor.yy212); + yymsp[-11].minor.yy212 = addFillClause(pCxt, yymsp[-11].minor.yy212, yymsp[-3].minor.yy212); } break; - case 418: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy97 = false; } + case 419: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy737 = false; } break; - case 419: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy24 = NULL; } + case 422: /* select_item ::= NK_STAR */ +{ yylhsminor.yy212 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy212 = yylhsminor.yy212; break; case 424: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-1].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-1].minor.yy212 = yylhsminor.yy212; break; case 425: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy652 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), &yymsp[0].minor.yy657); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), &yymsp[0].minor.yy329); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 430: /* partition_by_clause_opt ::= PARTITION BY expression_list */ case 447: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==447); case 463: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==463); -{ yymsp[-2].minor.yy24 = yymsp[0].minor.yy24; } +{ yymsp[-2].minor.yy424 = yymsp[0].minor.yy424; } break; case 432: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy652 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } +{ yymsp[-5].minor.yy212 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; case 433: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy652 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } +{ yymsp[-3].minor.yy212 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; case 434: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), NULL, yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-5].minor.yy212 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), NULL, yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 435: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy652 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy652), releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), yymsp[-1].minor.yy652, yymsp[0].minor.yy652); } +{ yymsp[-7].minor.yy212 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy212), releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), yymsp[-1].minor.yy212, yymsp[0].minor.yy212); } break; case 437: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ case 455: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==455); -{ yymsp[-3].minor.yy652 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy652); } +{ yymsp[-3].minor.yy212 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy212); } break; case 439: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy652 = createFillNode(pCxt, yymsp[-1].minor.yy250, NULL); } +{ yymsp[-3].minor.yy212 = createFillNode(pCxt, yymsp[-1].minor.yy294, NULL); } break; case 440: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy652 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy24)); } +{ yymsp[-5].minor.yy212 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy424)); } break; case 441: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy250 = FILL_MODE_NONE; } +{ yymsp[0].minor.yy294 = FILL_MODE_NONE; } break; case 442: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy250 = FILL_MODE_PREV; } +{ yymsp[0].minor.yy294 = FILL_MODE_PREV; } break; case 443: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy250 = FILL_MODE_NULL; } +{ yymsp[0].minor.yy294 = FILL_MODE_NULL; } break; case 444: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy250 = FILL_MODE_LINEAR; } +{ yymsp[0].minor.yy294 = FILL_MODE_LINEAR; } break; case 445: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy250 = FILL_MODE_NEXT; } +{ yymsp[0].minor.yy294 = FILL_MODE_NEXT; } break; case 448: /* group_by_list ::= expression */ -{ yylhsminor.yy24 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[0].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } + yymsp[0].minor.yy424 = yylhsminor.yy424; break; case 449: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy24 = addNodeToList(pCxt, yymsp[-2].minor.yy24, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy652))); } - yymsp[-2].minor.yy24 = yylhsminor.yy24; +{ yylhsminor.yy424 = addNodeToList(pCxt, yymsp[-2].minor.yy424, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy212))); } + yymsp[-2].minor.yy424 = yylhsminor.yy424; break; case 453: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy652 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy652), releaseRawExprNode(pCxt, yymsp[-1].minor.yy652)); } +{ yymsp[-5].minor.yy212 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy212), releaseRawExprNode(pCxt, yymsp[-1].minor.yy212)); } break; case 456: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy652 = addOrderByClause(pCxt, yymsp[-3].minor.yy652, yymsp[-2].minor.yy24); - yylhsminor.yy652 = addSlimitClause(pCxt, yylhsminor.yy652, yymsp[-1].minor.yy652); - yylhsminor.yy652 = addLimitClause(pCxt, yylhsminor.yy652, yymsp[0].minor.yy652); + yylhsminor.yy212 = addOrderByClause(pCxt, yymsp[-3].minor.yy212, yymsp[-2].minor.yy424); + yylhsminor.yy212 = addSlimitClause(pCxt, yylhsminor.yy212, yymsp[-1].minor.yy212); + yylhsminor.yy212 = addLimitClause(pCxt, yylhsminor.yy212, yymsp[0].minor.yy212); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 458: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-3].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-3].minor.yy212 = yylhsminor.yy212; break; case 459: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy652 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy652, yymsp[0].minor.yy652); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy212, yymsp[0].minor.yy212); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 461: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ -{ yymsp[-5].minor.yy652 = yymsp[-4].minor.yy652; } - yy_destructor(yypParser,366,&yymsp[-3].minor); - yy_destructor(yypParser,367,&yymsp[-2].minor); - yy_destructor(yypParser,368,&yymsp[-1].minor); +{ yymsp[-5].minor.yy212 = yymsp[-4].minor.yy212; } + yy_destructor(yypParser,367,&yymsp[-3].minor); + yy_destructor(yypParser,368,&yymsp[-2].minor); + yy_destructor(yypParser,369,&yymsp[-1].minor); break; case 465: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ case 469: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==469); -{ yymsp[-1].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } +{ yymsp[-1].minor.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; case 466: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ case 470: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==470); -{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } +{ yymsp[-3].minor.yy212 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; case 467: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ case 471: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==471); -{ yymsp[-3].minor.yy652 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } +{ yymsp[-3].minor.yy212 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; case 472: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy652 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy652); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy212); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 476: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy652 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy652), yymsp[-1].minor.yy598, yymsp[0].minor.yy653); } - yymsp[-2].minor.yy652 = yylhsminor.yy652; +{ yylhsminor.yy212 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy212), yymsp[-1].minor.yy188, yymsp[0].minor.yy607); } + yymsp[-2].minor.yy212 = yylhsminor.yy212; break; case 477: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy598 = ORDER_ASC; } +{ yymsp[1].minor.yy188 = ORDER_ASC; } break; case 478: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy598 = ORDER_ASC; } +{ yymsp[0].minor.yy188 = ORDER_ASC; } break; case 479: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy598 = ORDER_DESC; } +{ yymsp[0].minor.yy188 = ORDER_DESC; } break; case 480: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy653 = NULL_ORDER_DEFAULT; } +{ yymsp[1].minor.yy607 = NULL_ORDER_DEFAULT; } break; case 481: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy653 = NULL_ORDER_FIRST; } +{ yymsp[-1].minor.yy607 = NULL_ORDER_FIRST; } break; case 482: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy653 = NULL_ORDER_LAST; } +{ yymsp[-1].minor.yy607 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index 7de92bba0c..babd096d56 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -526,20 +526,22 @@ TEST_F(ParserInitialCTest, createStream) { memset(&expect, 0, sizeof(SCMCreateStreamReq)); }; - auto setCreateStreamReqFunc = - [&](const char* pStream, const char* pSrcDb, const char* pSql, const char* pDstStb = nullptr, int8_t igExists = 0, - int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, int64_t watermark = 0) { - snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); - snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); - if (NULL != pDstStb) { - snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); - } - expect.igExists = igExists; - expect.sql = strdup(pSql); - expect.triggerType = triggerType; - expect.maxDelay = maxDelay; - expect.watermark = watermark; - }; + auto setCreateStreamReqFunc = [&](const char* pStream, const char* pSrcDb, const char* pSql, + const char* pDstStb = nullptr, int8_t igExists = 0, + int8_t triggerType = STREAM_TRIGGER_AT_ONCE, int64_t maxDelay = 0, + int64_t watermark = 0, int8_t igExpired = 0) { + snprintf(expect.name, sizeof(expect.name), "0.%s", pStream); + snprintf(expect.sourceDB, sizeof(expect.sourceDB), "0.%s", pSrcDb); + if (NULL != pDstStb) { + snprintf(expect.targetStbFullName, sizeof(expect.targetStbFullName), "0.test.%s", pDstStb); + } + expect.igExists = igExists; + expect.sql = strdup(pSql); + expect.triggerType = triggerType; + expect.maxDelay = maxDelay; + expect.watermark = watermark; + expect.igExpired = igExpired; + }; setCheckDdlFunc([&](const SQuery* pQuery, ParserStage stage) { ASSERT_EQ(nodeType(pQuery->pRoot), QUERY_NODE_CREATE_STREAM_STMT); @@ -555,6 +557,7 @@ TEST_F(ParserInitialCTest, createStream) { ASSERT_EQ(req.triggerType, expect.triggerType); ASSERT_EQ(req.maxDelay, expect.maxDelay); ASSERT_EQ(req.watermark, expect.watermark); + ASSERT_EQ(req.igExpired, expect.igExpired); tFreeSCMCreateStreamReq(&req); }); @@ -571,9 +574,10 @@ TEST_F(ParserInitialCTest, createStream) { clearCreateStreamReq(); setCreateStreamReqFunc( - "s1", "test", "create stream if not exists s1 trigger max_delay 20s watermark 10s into st1 as select * from t1", - "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND); - run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s INTO st1 AS SELECT * FROM t1"); + "s1", "test", + "create stream if not exists s1 trigger max_delay 20s watermark 10s ignore expired into st1 as select * from t1", + "st1", 1, STREAM_TRIGGER_MAX_DELAY, 20 * MILLISECOND_PER_SECOND, 10 * MILLISECOND_PER_SECOND, 1); + run("CREATE STREAM IF NOT EXISTS s1 TRIGGER MAX_DELAY 20s WATERMARK 10s IGNORE EXPIRED INTO st1 AS SELECT * FROM t1"); clearCreateStreamReq(); } diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index ef8b109b62..9dda90f77f 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -154,16 +154,12 @@ static int32_t createSelectRootLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p return createRootLogicNode(pCxt, pSelect, pSelect->precision, (FCreateLogicNode)func, pRoot); } -static EScanType getScanType(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SNodeList* pScanPseudoCols, - SNodeList* pScanCols, int8_t tableType) { +static EScanType getScanType(SLogicPlanContext* pCxt, SNodeList* pScanPseudoCols, SNodeList* pScanCols, + int8_t tableType) { if (pCxt->pPlanCxt->topicQuery || pCxt->pPlanCxt->streamQuery) { return SCAN_TYPE_STREAM; } - if (pSelect->hasLastRowFunc) { - return SCAN_TYPE_LAST_ROW; - } - if (NULL == pScanCols) { // select count(*) from t return NULL == pScanPseudoCols @@ -279,7 +275,7 @@ static int32_t createScanLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect code = rewriteExprsForSelect(pScan->pScanPseudoCols, pSelect, SQL_CLAUSE_FROM); } - pScan->scanType = getScanType(pCxt, pSelect, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType); + pScan->scanType = getScanType(pCxt, pScan->pScanPseudoCols, pScan->pScanCols, pScan->tableType); if (TSDB_CODE_SUCCESS == code) { code = addPrimaryKeyCol(pScan->tableId, &pScan->pScanCols); @@ -474,6 +470,8 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, return TSDB_CODE_OUT_OF_MEMORY; } + pAgg->hasLastRow = pSelect->hasLastRowFunc; + int32_t code = TSDB_CODE_SUCCESS; // set grouyp keys, agg funcs and having conditions @@ -616,10 +614,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm if (pCxt->pPlanCxt->streamQuery) { pWindow->triggerType = pCxt->pPlanCxt->triggerType; pWindow->watermark = pCxt->pPlanCxt->watermark; - } - - if (pCxt->pPlanCxt->rSmaQuery) { - /*pWindow->filesFactor = pCxt->pPlanCxt->filesFactor;*/ + pWindow->igExpired = pCxt->pPlanCxt->igExpired; } if (TSDB_CODE_SUCCESS == code) { diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index b5b53f00a0..c303c63ab7 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -227,8 +227,7 @@ static void scanPathOptSetScanWin(SScanLogicNode* pScan) { pScan->slidingUnit = ((SWindowLogicNode*)pParent)->slidingUnit; pScan->triggerType = ((SWindowLogicNode*)pParent)->triggerType; pScan->watermark = ((SWindowLogicNode*)pParent)->watermark; - pScan->tsColId = ((SColumnNode*)((SWindowLogicNode*)pParent)->pTspk)->colId; - pScan->filesFactor = ((SWindowLogicNode*)pParent)->filesFactor; + pScan->igExpired = ((SWindowLogicNode*)pParent)->igExpired; } } @@ -587,11 +586,160 @@ static int32_t pushDownCondOptDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* p return code; } -static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAgg) { - // todo +typedef struct SPartAggCondContext { + SAggLogicNode* pAgg; + bool hasAggFunc; +} SPartAggCondContext; + +static EDealRes partAggCondHasAggFuncImpl(SNode* pNode, void* pContext) { + SPartAggCondContext* pCxt = pContext; + if (QUERY_NODE_COLUMN == nodeType(pNode)) { + SNode* pAggFunc = NULL; + FOREACH(pAggFunc, pCxt->pAgg->pAggFuncs) { + if (strcmp(((SColumnNode*)pNode)->colName, ((SFunctionNode*)pAggFunc)->node.aliasName) == 0) { + pCxt->hasAggFunc = true; + return DEAL_RES_END; + } + } + } + return DEAL_RES_CONTINUE; +} + +static int32_t partitionAggCondHasAggFunc(SAggLogicNode* pAgg, SNode* pCond) { + SPartAggCondContext cxt = {.pAgg = pAgg, .hasAggFunc = false}; + nodesWalkExpr(pCond, partAggCondHasAggFuncImpl, &cxt); + return cxt.hasAggFunc; +} + +static int32_t partitionAggCondConj(SAggLogicNode* pAgg, SNode** ppAggFuncCond, SNode** ppGroupKeyCond) { + SLogicConditionNode* pLogicCond = (SLogicConditionNode*)pAgg->node.pConditions; + int32_t code = TSDB_CODE_SUCCESS; + + SNodeList* pAggFuncConds = NULL; + SNodeList* pGroupKeyConds = NULL; + SNode* pCond = NULL; + FOREACH(pCond, pLogicCond->pParameterList) { + if (partitionAggCondHasAggFunc(pAgg, pCond)) { + code = nodesListMakeAppend(&pAggFuncConds, nodesCloneNode(pCond)); + } else { + code = nodesListMakeAppend(&pGroupKeyConds, nodesCloneNode(pCond)); + } + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + + SNode* pTempAggFuncCond = NULL; + SNode* pTempGroupKeyCond = NULL; + if (TSDB_CODE_SUCCESS == code) { + code = nodesMergeConds(&pTempAggFuncCond, &pAggFuncConds); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesMergeConds(&pTempGroupKeyCond, &pGroupKeyConds); + } + + if (TSDB_CODE_SUCCESS == code) { + *ppAggFuncCond = pTempAggFuncCond; + *ppGroupKeyCond = pTempGroupKeyCond; + } else { + nodesDestroyList(pAggFuncConds); + nodesDestroyList(pGroupKeyConds); + nodesDestroyNode(pTempAggFuncCond); + nodesDestroyNode(pTempGroupKeyCond); + } + pAgg->node.pConditions = NULL; + return code; +} + +static int32_t partitionAggCond(SAggLogicNode* pAgg, SNode** ppAggFunCond, SNode** ppGroupKeyCond) { + SNode* pAggNodeCond = pAgg->node.pConditions; + if (QUERY_NODE_LOGIC_CONDITION == nodeType(pAggNodeCond) && + LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)(pAggNodeCond))->condType) { + return partitionAggCondConj(pAgg, ppAggFunCond, ppGroupKeyCond); + } + if (partitionAggCondHasAggFunc(pAgg, pAggNodeCond)) { + *ppAggFunCond = pAggNodeCond; + } else { + *ppGroupKeyCond = pAggNodeCond; + } + pAgg->node.pConditions = NULL; return TSDB_CODE_SUCCESS; } +static int32_t pushCondToAggCond(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode** pAggFuncCond) { + pushDownCondOptAppendCond(&pAgg->node.pConditions, pAggFuncCond); + return TSDB_CODE_SUCCESS; +} + +typedef struct SRewriteAggGroupKeyCondContext{ + SAggLogicNode *pAgg; + int32_t errCode; +} SRewriteAggGroupKeyCondContext; + +static EDealRes rewriteAggGroupKeyCondForPushDownImpl(SNode** pNode, void* pContext) { + SRewriteAggGroupKeyCondContext* pCxt = pContext; + SAggLogicNode* pAgg = pCxt->pAgg; + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SNode* pGroupKey = NULL; + FOREACH(pGroupKey, pAgg->pGroupKeys) { + SNode* pGroup = NULL; + FOREACH(pGroup, ((SGroupingSetNode*)pGroupKey)->pParameterList) { + if (0 == strcmp(((SExprNode*)pGroup)->aliasName, ((SColumnNode*)(*pNode))->colName)) { + SNode* pExpr = nodesCloneNode(pGroup); + if (pExpr == NULL) { + pCxt->errCode = terrno; + return DEAL_RES_ERROR; + } + nodesDestroyNode(*pNode); + *pNode = pExpr; + } + } + } + return DEAL_RES_IGNORE_CHILD; + } + return DEAL_RES_CONTINUE; +} + +static int32_t rewriteAggGroupKeyCondForPushDown(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode* pGroupKeyCond) { + SRewriteAggGroupKeyCondContext cxt = {.pAgg = pAgg, .errCode = TSDB_CODE_SUCCESS}; + nodesRewriteExpr(&pGroupKeyCond, rewriteAggGroupKeyCondForPushDownImpl, &cxt); + return cxt.errCode; +} + +static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAgg) { + if (NULL == pAgg->node.pConditions || + OPTIMIZE_FLAG_TEST_MASK(pAgg->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE)) { + return TSDB_CODE_SUCCESS; + } + //TODO: remove it after full implementation of pushing down to child + if (1 != LIST_LENGTH(pAgg->node.pChildren) || + QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pAgg->node.pChildren, 0))) { + return TSDB_CODE_SUCCESS; + } + + SNode* pAggFuncCond = NULL; + SNode* pGroupKeyCond = NULL; + int32_t code = partitionAggCond(pAgg, &pAggFuncCond, &pGroupKeyCond); + if (TSDB_CODE_SUCCESS == code && NULL != pAggFuncCond) { + code = pushCondToAggCond(pCxt, pAgg, &pAggFuncCond); + } + if (TSDB_CODE_SUCCESS == code && NULL != pGroupKeyCond) { + code = rewriteAggGroupKeyCondForPushDown(pCxt, pAgg, pGroupKeyCond); + } + if (TSDB_CODE_SUCCESS == code && NULL != pGroupKeyCond) { + SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0); + code = pushDownCondOptPushCondToChild(pCxt, pChild, &pGroupKeyCond); + } + if (TSDB_CODE_SUCCESS == code) { + OPTIMIZE_FLAG_SET_MASK(pAgg->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE); + pCxt->optimized = true; + } else { + nodesDestroyNode(pGroupKeyCond); + nodesDestroyNode(pAggFuncCond); + } + return code; +} + static int32_t pushDownCondOptimizeImpl(SOptimizeContext* pCxt, SLogicNode* pLogicNode) { int32_t code = TSDB_CODE_SUCCESS; switch (nodeType(pLogicNode)) { @@ -1622,6 +1770,46 @@ static int32_t rewriteUniqueOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLog return rewriteUniqueOptimizeImpl(pCxt, pLogicSubplan, pIndef); } +static bool lastRowScanOptMayBeOptimized(SLogicNode* pNode) { + if (QUERY_NODE_LOGIC_PLAN_AGG != nodeType(pNode) || !(((SAggLogicNode*)pNode)->hasLastRow) || + NULL != ((SAggLogicNode*)pNode)->pGroupKeys || 1 != LIST_LENGTH(pNode->pChildren) || + QUERY_NODE_LOGIC_PLAN_SCAN != nodeType(nodesListGetNode(pNode->pChildren, 0)) || + NULL != ((SScanLogicNode*)nodesListGetNode(pNode->pChildren, 0))->node.pConditions) { + return false; + } + + SNode* pFunc = NULL; + FOREACH(pFunc, ((SAggLogicNode*)pNode)->pAggFuncs) { + if (FUNCTION_TYPE_LAST_ROW != ((SFunctionNode*)pFunc)->funcType) { + return false; + } + } + + return true; +} + +static int32_t lastRowScanOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan) { + SAggLogicNode* pAgg = (SAggLogicNode*)optFindPossibleNode(pLogicSubplan->pNode, lastRowScanOptMayBeOptimized); + + if (NULL == pAgg) { + return TSDB_CODE_SUCCESS; + } + + SNode* pNode = NULL; + FOREACH(pNode, pAgg->pAggFuncs) { + SFunctionNode* pFunc = (SFunctionNode*)pNode; + int32_t len = snprintf(pFunc->functionName, sizeof(pFunc->functionName), "_cache_last_row"); + pFunc->functionName[len] = '\0'; + fmGetFuncInfo(pFunc, NULL, 0); + } + pAgg->hasLastRow = false; + + ((SScanLogicNode*)nodesListGetNode(pAgg->node.pChildren, 0))->scanType = SCAN_TYPE_LAST_ROW; + + pCxt->optimized = true; + return TSDB_CODE_SUCCESS; +} + // merge projects static bool mergeProjectsMayBeOptimized(SLogicNode* pNode) { if (QUERY_NODE_LOGIC_PLAN_PROJECT != nodeType(pNode) || 1 != LIST_LENGTH(pNode->pChildren)) { @@ -1668,8 +1856,8 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) { static int32_t mergeProjectsOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pLogicSubplan, SLogicNode* pSelfNode) { SLogicNode* pChild = (SLogicNode*)nodesListGetNode(pSelfNode->pChildren, 0); - SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; + SMergeProjectionsContext cxt = {.pChildProj = (SProjectLogicNode*)pChild, .errCode = TSDB_CODE_SUCCESS}; nodesRewriteExprs(((SProjectLogicNode*)pSelfNode)->pProjections, mergeProjectionsExpr, &cxt); int32_t code = cxt.errCode; @@ -1710,7 +1898,8 @@ static const SOptimizeRule optimizeRuleSet[] = { {.pName = "EliminateProject", .optimizeFunc = eliminateProjOptimize}, {.pName = "EliminateSetOperator", .optimizeFunc = eliminateSetOpOptimize}, {.pName = "RewriteTail", .optimizeFunc = rewriteTailOptimize}, - {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize} + {.pName = "RewriteUnique", .optimizeFunc = rewriteUniqueOptimize}, + {.pName = "LastRowScan", .optimizeFunc = lastRowScanOptimize} }; // clang-format on diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 46747af3a9..aac9c25f77 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -534,8 +534,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->slidingUnit = pScanLogicNode->slidingUnit; pTableScan->triggerType = pScanLogicNode->triggerType; pTableScan->watermark = pScanLogicNode->watermark; - pTableScan->tsColId = pScanLogicNode->tsColId; - pTableScan->filesFactor = pScanLogicNode->filesFactor; + pTableScan->igExpired = pScanLogicNode->igExpired; return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); } @@ -1054,7 +1053,7 @@ static int32_t createWindowPhysiNodeFinalize(SPhysiPlanContext* pCxt, SNodeList* pWindow->triggerType = pWindowLogicNode->triggerType; pWindow->watermark = pWindowLogicNode->watermark; - pWindow->filesFactor = pWindowLogicNode->filesFactor; + pWindow->igExpired = pWindowLogicNode->igExpired; if (TSDB_CODE_SUCCESS == code) { *pPhyNode = (SPhysiNode*)pWindow; @@ -1344,7 +1343,7 @@ static int32_t createMergePhysiNode(SPhysiPlanContext* pCxt, SMergeLogicNode* pM } } - if (TSDB_CODE_SUCCESS == code) { + if (TSDB_CODE_SUCCESS == code && NULL != pMergeLogicNode->pMergeKeys) { code = setListSlotId(pCxt, pMerge->node.pOutputDataBlockDesc->dataBlockId, -1, pMergeLogicNode->pMergeKeys, &pMerge->pMergeKeys); } @@ -1555,7 +1554,11 @@ static int32_t createPhysiSubplan(SPhysiPlanContext* pCxt, SLogicSubplan* pLogic if (SUBPLAN_TYPE_MODIFY == pLogicSubplan->subplanType) { code = buildVnodeModifySubplan(pCxt, pLogicSubplan, pSubplan); } else { - pSubplan->msgType = TDMT_VND_QUERY; + if (SUBPLAN_TYPE_SCAN == pSubplan->subplanType) { + pSubplan->msgType = TDMT_SCH_QUERY; + } else { + pSubplan->msgType = TDMT_SCH_MERGE_QUERY; + } code = createPhysiNode(pCxt, pLogicSubplan->pNode, pSubplan, &pSubplan->pNode); if (TSDB_CODE_SUCCESS == code && !pCxt->pPlanCxt->streamQuery && !pCxt->pPlanCxt->topicQuery) { code = createDataDispatcher(pCxt, pSubplan->pNode, &pSubplan->pDataSink); diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 9d23df5bda..60c04c2c30 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -197,6 +197,8 @@ static bool stbSplNeedSplit(bool streamQuery, SLogicNode* pNode) { return stbSplIsMultiTbScan(streamQuery, (SScanLogicNode*)pNode); case QUERY_NODE_LOGIC_PLAN_JOIN: return !(((SJoinLogicNode*)pNode)->isSingleTableJoin); + case QUERY_NODE_LOGIC_PLAN_PARTITION: + return stbSplHasMultiTbScan(streamQuery, pNode); case QUERY_NODE_LOGIC_PLAN_AGG: return !stbSplHasGatherExecFunc(((SAggLogicNode*)pNode)->pAggFuncs) && stbSplHasMultiTbScan(streamQuery, pNode); case QUERY_NODE_LOGIC_PLAN_WINDOW: @@ -431,7 +433,7 @@ static int32_t stbSplSplitIntervalForBatch(SSplitContext* pCxt, SStableSplitInfo SNodeList* pMergeKeys = NULL; code = stbSplCreateMergeKeysByPrimaryKey(((SWindowLogicNode*)pInfo->pSplitNode)->pTspk, &pMergeKeys); if (TSDB_CODE_SUCCESS == code) { - code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, false); + code = stbSplCreateMergeNode(pCxt, NULL, pInfo->pSplitNode, pMergeKeys, pPartWindow, true); } if (TSDB_CODE_SUCCESS != code) { nodesDestroyList(pMergeKeys); @@ -887,6 +889,16 @@ static int32_t stbSplSplitJoinNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) return code; } +static int32_t stbSplSplitPartitionNode(SSplitContext* pCxt, SStableSplitInfo* pInfo) { + int32_t code = stbSplCreateMergeNode(pCxt, pInfo->pSubplan, pInfo->pSplitNode, NULL, pInfo->pSplitNode, true); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeStrictAppend(&pInfo->pSubplan->pChildren, + (SNode*)splCreateScanSubplan(pCxt, pInfo->pSplitNode, SPLIT_FLAG_STABLE_SPLIT)); + } + ++(pCxt->groupId); + return code; +} + static int32_t stableSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { if (pCxt->pPlanCxt->rSmaQuery) { return TSDB_CODE_SUCCESS; @@ -905,6 +917,9 @@ static int32_t stableSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) { case QUERY_NODE_LOGIC_PLAN_JOIN: code = stbSplSplitJoinNode(pCxt, &info); break; + case QUERY_NODE_LOGIC_PLAN_PARTITION: + code = stbSplSplitPartitionNode(pCxt, &info); + break; case QUERY_NODE_LOGIC_PLAN_AGG: code = stbSplSplitAggNode(pCxt, &info); break; diff --git a/source/libs/planner/test/planBasicTest.cpp b/source/libs/planner/test/planBasicTest.cpp index ff725c444e..b886fca2af 100644 --- a/source/libs/planner/test/planBasicTest.cpp +++ b/source/libs/planner/test/planBasicTest.cpp @@ -99,6 +99,8 @@ TEST_F(PlanBasicTest, lastRowFunc) { run("SELECT LAST_ROW(c1, c2) FROM t1"); run("SELECT LAST_ROW(c1) FROM st1"); + + run("SELECT LAST_ROW(c1), SUM(c3) FROM t1"); } TEST_F(PlanBasicTest, sampleFunc) { diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 9ba149a33b..69d48b2179 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -216,7 +216,8 @@ void destroyQueryExecRes(SQueryExecRes* pRes) { tFreeSSubmitRsp((SSubmitRsp*)pRes->res); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { taosArrayDestroy((SArray*)pRes->res); break; } diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index b433a88001..908149c3ea 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -20,7 +20,9 @@ #include "systable.h" #pragma GCC diagnostic push +#ifdef COMPILER_SUPPORTS_CXX13 #pragma GCC diagnostic ignored "-Wformat-truncation" +#endif int32_t (*queryBuildMsg[TDMT_MAX])(void *input, char **msg, int32_t msgSize, int32_t *msgLen, void*(*mallocFp)(int32_t)) = {0}; int32_t (*queryProcessMsgRsp[TDMT_MAX])(void *output, char *msg, int32_t msgSize) = {0}; diff --git a/source/libs/qworker/inc/qwInt.h b/source/libs/qworker/inc/qwInt.h index 2368b13dd6..6faffa13b3 100644 --- a/source/libs/qworker/inc/qwInt.h +++ b/source/libs/qworker/inc/qwInt.h @@ -75,6 +75,7 @@ typedef struct SQWDebug { bool lockEnable; bool statusEnable; bool dumpEnable; + bool tmp; } SQWDebug; extern SQWDebug gQWDebug; @@ -82,6 +83,7 @@ extern SQWDebug gQWDebug; typedef struct SQWMsg { void *node; int32_t code; + int32_t msgType; char *msg; int32_t msgLen; SRpcHandleInfo connInfo; @@ -100,6 +102,7 @@ typedef struct SQWHbInfo { typedef struct SQWPhaseInput { int32_t code; + int32_t msgType; } SQWPhaseInput; typedef struct SQWPhaseOutput { @@ -119,6 +122,8 @@ typedef struct SQWTaskCtx { int8_t phase; int8_t taskType; int8_t explain; + int32_t queryType; + int32_t execId; bool queryFetched; bool queryEnd; @@ -197,8 +202,8 @@ typedef struct SQWorkerMgmt { int32_t paramIdx; } SQWorkerMgmt; -#define QW_FPARAMS_DEF SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId -#define QW_IDS() sId, qId, tId, rId +#define QW_FPARAMS_DEF SQWorker *mgmt, uint64_t sId, uint64_t qId, uint64_t tId, int64_t rId, int32_t eId +#define QW_IDS() sId, qId, tId, rId, eId #define QW_FPARAMS() mgmt, QW_IDS() #define QW_STAT_INC(_item, _n) atomic_add_fetch_64(&(_item), _n) @@ -223,15 +228,18 @@ typedef struct SQWorkerMgmt { #define QW_TASK_READY(status) \ (status == JOB_TASK_STATUS_SUCCEED || status == JOB_TASK_STATUS_FAILED || status == JOB_TASK_STATUS_CANCELLED || \ status == JOB_TASK_STATUS_PARTIAL_SUCCEED) -#define QW_SET_QTID(id, qId, tId) \ - do { \ - *(uint64_t *)(id) = (qId); \ - *(uint64_t *)((char *)(id) + sizeof(qId)) = (tId); \ +#define QW_SET_QTID(id, qId, tId, eId) \ + do { \ + *(uint64_t *)(id) = (qId); \ + *(uint64_t *)((char *)(id) + sizeof(qId)) = (tId); \ + *(int32_t *)((char *)(id) + sizeof(qId) + sizeof(tId)) = (eId); \ } while (0) -#define QW_GET_QTID(id, qId, tId) \ - do { \ - (qId) = *(uint64_t *)(id); \ - (tId) = *(uint64_t *)((char *)(id) + sizeof(qId)); \ + +#define QW_GET_QTID(id, qId, tId, eId) \ + do { \ + (qId) = *(uint64_t *)(id); \ + (tId) = *(uint64_t *)((char *)(id) + sizeof(qId)); \ + (eId) = *(int32_t *)((char *)(id) + sizeof(qId) + sizeof(tId)); \ } while (0) #define QW_ERR_RET(c) \ @@ -273,22 +281,22 @@ typedef struct SQWorkerMgmt { #define QW_SCH_ELOG(param, ...) qError("QW:%p SID:%" PRIx64 " " param, mgmt, sId, __VA_ARGS__) #define QW_SCH_DLOG(param, ...) qDebug("QW:%p SID:%" PRIx64 " " param, mgmt, sId, __VA_ARGS__) -#define QW_TASK_ELOG(param, ...) qError("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) -#define QW_TASK_WLOG(param, ...) qWarn("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) -#define QW_TASK_DLOG(param, ...) qDebug("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) +#define QW_TASK_ELOG(param, ...) qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) +#define QW_TASK_WLOG(param, ...) qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) +#define QW_TASK_DLOG(param, ...) qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) #define QW_TASK_DLOGL(param, ...) \ - qDebugL("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId, __VA_ARGS__) + qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId, __VA_ARGS__) -#define QW_TASK_ELOG_E(param) qError("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) -#define QW_TASK_WLOG_E(param) qWarn("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) -#define QW_TASK_DLOG_E(param) qDebug("QW:%p QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, qId, tId) +#define QW_TASK_ELOG_E(param) qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) +#define QW_TASK_WLOG_E(param) qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) +#define QW_TASK_DLOG_E(param) qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, qId, tId, eId) #define QW_SCH_TASK_ELOG(param, ...) \ - qError("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qError("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_WLOG(param, ...) \ - qWarn("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qWarn("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_SCH_TASK_DLOG(param, ...) \ - qDebug("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, mgmt, sId, qId, tId, __VA_ARGS__) + qDebug("QW:%p SID:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, mgmt, sId, qId, tId, eId, __VA_ARGS__) #define QW_LOCK_DEBUG(...) \ do { \ @@ -362,6 +370,8 @@ void qwFreeTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx *ctx); void qwDbgDumpMgmtInfo(SQWorker *mgmt); int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore); +int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SEpSet *pEpSet); +int32_t qwAddTaskCtx(QW_FPARAMS_DEF); #ifdef __cplusplus diff --git a/source/libs/qworker/inc/qwMsg.h b/source/libs/qworker/inc/qwMsg.h index 8c7c030dce..9e9d1f44cb 100644 --- a/source/libs/qworker/inc/qwMsg.h +++ b/source/libs/qworker/inc/qwMsg.h @@ -39,7 +39,7 @@ int32_t qwBuildAndSendFetchRsp(SRpcHandleInfo *pConn, SRetrieveTableRsp *pRsp, i int32_t code); void qwBuildFetchRsp(void *msg, SOutputData *input, int32_t len, bool qComplete); int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn); -int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo); +int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo); int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execInfo, int32_t num); void qwFreeFetchRsp(void *msg); int32_t qwMallocFetchRsp(int32_t length, SRetrieveTableRsp **rsp); diff --git a/source/libs/qworker/src/qwDbg.c b/source/libs/qworker/src/qwDbg.c index add9700a3a..68058334ab 100644 --- a/source/libs/qworker/src/qwDbg.c +++ b/source/libs/qworker/src/qwDbg.c @@ -9,7 +9,7 @@ #include "tmsg.h" #include "tname.h" -SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false}; +SQWDebug gQWDebug = {.statusEnable = true, .dumpEnable = false, .tmp = false}; int32_t qwDbgValidateStatus(QW_FPARAMS_DEF, int8_t oriStatus, int8_t newStatus, bool *ignore) { if (!gQWDebug.statusEnable) { @@ -121,3 +121,90 @@ void qwDbgDumpMgmtInfo(SQWorker *mgmt) { } +int32_t qwDbgBuildAndSendRedirectRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, SEpSet *pEpSet) { + int32_t contLen = 0; + char* rsp = NULL; + + if (pEpSet) { + contLen = tSerializeSEpSet(NULL, 0, pEpSet); + rsp = rpcMallocCont(contLen); + tSerializeSEpSet(rsp, contLen, pEpSet); + } + + SRpcMsg rpcRsp = { + .msgType = rspType, + .pCont = rsp, + .contLen = contLen, + .code = code, + .info = *pConn, + }; + rpcRsp.info.hasEpSet = 1; + + tmsgSendRsp(&rpcRsp); + + qDebug("response %s msg, code: %s", TMSG_INFO(rspType), tstrerror(code)); + + return TSDB_CODE_SUCCESS; +} + +int32_t qwDbgResponseREdirect(SQWMsg *qwMsg, SQWTaskCtx *ctx) { + if (gQWDebug.tmp) { + if (TDMT_SCH_QUERY == qwMsg->msgType) { + SEpSet epSet = {0}; + epSet.inUse = 1; + epSet.numOfEps = 3; + strcpy(epSet.eps[0].fqdn, "localhost"); + epSet.eps[0].port = 7100; + strcpy(epSet.eps[1].fqdn, "localhost"); + epSet.eps[1].port = 7200; + strcpy(epSet.eps[2].fqdn, "localhost"); + epSet.eps[2].port = 7300; + + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, &epSet); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } + + if (TDMT_SCH_MERGE_QUERY == qwMsg->msgType) { + ctx->phase = QW_PHASE_POST_QUERY; + qwDbgBuildAndSendRedirectRsp(qwMsg->msgType + 1, &qwMsg->connInfo, TSDB_CODE_RPC_REDIRECT, NULL); + gQWDebug.tmp = false; + return TSDB_CODE_SUCCESS; + } + } + + return TSDB_CODE_SUCCESS; +} + + +int32_t qwDbgEnableDebug(char *option) { + if (0 == strcasecmp(option, "lock")) { + gQWDebug.lockEnable = true; + qDebug("qw lock debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "status")) { + gQWDebug.statusEnable = true; + qDebug("qw status debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "dump")) { + gQWDebug.dumpEnable = true; + qDebug("qw dump debug enabled"); + return TSDB_CODE_SUCCESS; + } + + if (0 == strcasecmp(option, "tmp")) { + gQWDebug.tmp = true; + qDebug("qw tmp debug enabled"); + return TSDB_CODE_SUCCESS; + } + + qError("invalid qw debug option:%s", option); + + return TSDB_CODE_APP_ERROR; +} + + diff --git a/source/libs/qworker/src/qwMsg.c b/source/libs/qworker/src/qwMsg.c index 82a62b5c5a..cc4228f7c7 100644 --- a/source/libs/qworker/src/qwMsg.c +++ b/source/libs/qworker/src/qwMsg.c @@ -43,7 +43,7 @@ void qwFreeFetchRsp(void *msg) { } } -int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo) { +int32_t qwBuildAndSendQueryRsp(int32_t rspType, SRpcHandleInfo *pConn, int32_t code, STbVerInfo* tbInfo) { SQueryTableRsp *pRsp = (SQueryTableRsp *)rpcMallocCont(sizeof(SQueryTableRsp)); pRsp->code = code; if (tbInfo) { @@ -53,7 +53,7 @@ int32_t qwBuildAndSendQueryRsp(SRpcHandleInfo *pConn, int32_t code, STbVerInfo* } SRpcMsg rpcRsp = { - .msgType = TDMT_VND_QUERY_RSP, + .msgType = rspType, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -73,7 +73,7 @@ int32_t qwBuildAndSendExplainRsp(SRpcHandleInfo *pConn, SExplainExecInfo *execIn tSerializeSExplainRsp(pRsp, contLen, &rsp); SRpcMsg rpcRsp = { - .msgType = TDMT_VND_EXPLAIN_RSP, + .msgType = TDMT_SCH_EXPLAIN_RSP, .pCont = pRsp, .contLen = contLen, .code = 0, @@ -92,7 +92,7 @@ int32_t qwBuildAndSendHbRsp(SRpcHandleInfo *pConn, SSchedulerHbRsp *pStatus, int tSerializeSSchedulerHbRsp(pRsp, contLen, pStatus); SRpcMsg rpcRsp = { - .msgType = TDMT_VND_QUERY_HEARTBEAT_RSP, + .msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP, .contLen = contLen, .pCont = pRsp, .code = code, @@ -112,7 +112,7 @@ int32_t qwBuildAndSendFetchRsp(SRpcHandleInfo *pConn, SRetrieveTableRsp *pRsp, i } SRpcMsg rpcRsp = { - .msgType = TDMT_VND_FETCH_RSP, + .msgType = TDMT_SCH_FETCH_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp) + dataLength, .code = code, @@ -129,7 +129,7 @@ int32_t qwBuildAndSendCancelRsp(SRpcHandleInfo *pConn, int32_t code) { pRsp->code = code; SRpcMsg rpcRsp = { - .msgType = TDMT_VND_CANCEL_TASK_RSP, + .msgType = TDMT_SCH_CANCEL_TASK_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -145,7 +145,7 @@ int32_t qwBuildAndSendDropRsp(SRpcHandleInfo *pConn, int32_t code) { pRsp->code = code; SRpcMsg rpcRsp = { - .msgType = TDMT_VND_DROP_TASK_RSP, + .msgType = TDMT_SCH_DROP_TASK_RSP, .pCont = pRsp, .contLen = sizeof(*pRsp), .code = code, @@ -156,6 +156,41 @@ int32_t qwBuildAndSendDropRsp(SRpcHandleInfo *pConn, int32_t code) { return TSDB_CODE_SUCCESS; } +int32_t qwBuildAndSendDropMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { + STaskDropReq *req = (STaskDropReq *)rpcMallocCont(sizeof(STaskDropReq)); + if (NULL == req) { + QW_SCH_TASK_ELOG("rpcMallocCont %d failed", (int32_t)sizeof(STaskDropReq)); + QW_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + } + + req->header.vgId = mgmt->nodeId; + req->sId = sId; + req->queryId = qId; + req->taskId = tId; + req->refId = rId; + req->execId = eId; + + SRpcMsg pNewMsg = { + .msgType = TDMT_SCH_DROP_TASK, + .pCont = req, + .contLen = sizeof(STaskDropReq), + .code = 0, + .info = *pConn, + }; + + int32_t code = tmsgPutToQueue(&mgmt->msgCb, FETCH_QUEUE, &pNewMsg); + if (TSDB_CODE_SUCCESS != code) { + QW_SCH_TASK_ELOG("put drop task msg to queue failed, vgId:%d, code:%s", mgmt->nodeId, tstrerror(code)); + rpcFreeCont(req); + QW_ERR_RET(code); + } + + QW_SCH_TASK_DLOG("drop task msg put to queue, vgId:%d", mgmt->nodeId); + + return TSDB_CODE_SUCCESS; +} + + int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { SQueryContinueReq *req = (SQueryContinueReq *)rpcMallocCont(sizeof(SQueryContinueReq)); if (NULL == req) { @@ -167,9 +202,10 @@ int32_t qwBuildAndSendCQueryMsg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { req->sId = sId; req->queryId = qId; req->taskId = tId; + req->execId = eId; SRpcMsg pNewMsg = { - .msgType = TDMT_VND_QUERY_CONTINUE, + .msgType = TDMT_SCH_QUERY_CONTINUE, .pCont = req, .contLen = sizeof(SQueryContinueReq), .code = 0, @@ -202,10 +238,10 @@ int32_t qwRegisterQueryBrokenLinkArg(QW_FPARAMS_DEF, SRpcHandleInfo *pConn) { req->refId = htobe64(rId); SRpcMsg brokenMsg = { - .msgType = TDMT_VND_DROP_TASK, + .msgType = TDMT_SCH_DROP_TASK, .pCont = req, .contLen = sizeof(STaskDropReq), - .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, + .code = TSDB_CODE_RPC_BROKEN_LINK, .info = *pConn, }; @@ -236,10 +272,10 @@ int32_t qwRegisterHbBrokenLinkArg(SQWorker *mgmt, uint64_t sId, SRpcHandleInfo * } SRpcMsg brokenMsg = { - .msgType = TDMT_VND_QUERY_HEARTBEAT, + .msgType = TDMT_SCH_QUERY_HEARTBEAT, .pCont = msg, .contLen = msgSize, - .code = TSDB_CODE_RPC_NETWORK_UNAVAIL, + .code = TSDB_CODE_RPC_BROKEN_LINK, .info = *pConn, }; @@ -266,6 +302,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); msg->phyLen = ntohl(msg->phyLen); msg->sqlLen = ntohl(msg->sqlLen); @@ -273,6 +310,7 @@ int32_t qWorkerPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info}; @@ -295,6 +333,7 @@ int32_t qWorkerAbortPreprocessQueryMsg(void *qWorkerMgmt, SRpcMsg *pMsg) { uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; QW_SCH_TASK_DLOG("Abort prerocessQuery start, handle:%p", pMsg->info.handle); qwAbortPrerocessQuery(QW_FPARAMS()); @@ -324,10 +363,11 @@ int32_t qWorkerProcessQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; - SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info}; + SQWMsg qwMsg = {.node = node, .msg = msg->msg + msg->sqlLen, .msgLen = msg->phyLen, .connInfo = pMsg->info, .msgType = pMsg->msgType}; char * sql = strndup(msg->msg, msg->sqlLen); - QW_SCH_TASK_DLOG("processQuery start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, sql); + QW_SCH_TASK_DLOG("processQuery start, node:%p, type:%s, handle:%p, sql:%s", node, TMSG_INFO(pMsg->msgType), pMsg->info.handle, sql); QW_ERR_RET(qwProcessQuery(QW_FPARAMS(), &qwMsg, msg->taskType, msg->explain, sql)); QW_SCH_TASK_DLOG("processQuery end, node:%p", node); @@ -356,6 +396,7 @@ int32_t qWorkerProcessCQueryMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = 0; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -387,11 +428,13 @@ int32_t qWorkerProcessFetchMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int msg->sId = be64toh(msg->sId); msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = 0; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -437,11 +480,13 @@ int32_t qWorkerProcessCancelMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, in msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .connInfo = pMsg->info}; @@ -476,15 +521,17 @@ int32_t qWorkerProcessDropMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int6 msg->queryId = be64toh(msg->queryId); msg->taskId = be64toh(msg->taskId); msg->refId = be64toh(msg->refId); + msg->execId = ntohl(msg->execId); uint64_t sId = msg->sId; uint64_t qId = msg->queryId; uint64_t tId = msg->taskId; int64_t rId = msg->refId; + int32_t eId = msg->execId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info}; - if (TSDB_CODE_RPC_NETWORK_UNAVAIL == pMsg->code) { + if (TSDB_CODE_RPC_BROKEN_LINK == pMsg->code) { QW_SCH_TASK_DLOG("receive drop task due to network broken, error:%s", tstrerror(pMsg->code)); } @@ -522,7 +569,7 @@ int32_t qWorkerProcessHbMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, int64_ uint64_t sId = req.sId; SQWMsg qwMsg = {.node = node, .msg = NULL, .msgLen = 0, .code = pMsg->code, .connInfo = pMsg->info}; - if (TSDB_CODE_RPC_NETWORK_UNAVAIL == pMsg->code) { + if (TSDB_CODE_RPC_BROKEN_LINK == pMsg->code) { QW_SCH_DLOG("receive Hb msg due to network broken, error:%s", tstrerror(pMsg->code)); } @@ -553,6 +600,7 @@ int32_t qWorkerProcessDeleteMsg(void *node, void *qWorkerMgmt, SRpcMsg *pMsg, SR uint64_t qId = req.queryId; uint64_t tId = req.taskId; int64_t rId = 0; + int32_t eId = -1; SQWMsg qwMsg = {.node = node, .msg = req.msg, .msgLen = req.phyLen, .connInfo = pMsg->info}; QW_SCH_TASK_DLOG("processDelete start, node:%p, handle:%p, sql:%s", node, pMsg->info.handle, req.sql); diff --git a/source/libs/qworker/src/qwUtil.c b/source/libs/qworker/src/qwUtil.c index 0759cf360a..1fb0a34314 100644 --- a/source/libs/qworker/src/qwUtil.c +++ b/source/libs/qworker/src/qwUtil.c @@ -135,8 +135,8 @@ int32_t qwAcquireScheduler(SQWorker *mgmt, uint64_t sId, int32_t rwType, SQWSchS void qwReleaseScheduler(int32_t rwType, SQWorker *mgmt) { QW_UNLOCK(rwType, &mgmt->schLock); } int32_t qwAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch, SQWTaskStatus **task) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); QW_LOCK(rwType, &sch->tasksLock); *task = taosHashGet(sch->tasksHash, id, sizeof(id)); @@ -151,8 +151,8 @@ int32_t qwAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch, S int32_t qwAddTaskStatusImpl(QW_FPARAMS_DEF, SQWSchStatus *sch, int32_t rwType, int32_t status, SQWTaskStatus **task) { int32_t code = 0; - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskStatus ntask = {0}; ntask.status = status; @@ -207,8 +207,8 @@ int32_t qwAddAcquireTaskStatus(QW_FPARAMS_DEF, int32_t rwType, SQWSchStatus *sch void qwReleaseTaskStatus(int32_t rwType, SQWSchStatus *sch) { QW_UNLOCK(rwType, &sch->tasksLock); } int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); *ctx = taosHashAcquire(mgmt->ctxHash, id, sizeof(id)); if (NULL == (*ctx)) { @@ -220,8 +220,8 @@ int32_t qwAcquireTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { } int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); *ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id)); if (NULL == (*ctx)) { @@ -233,8 +233,8 @@ int32_t qwGetTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx **ctx) { } int32_t qwAddTaskCtxImpl(QW_FPARAMS_DEF, bool acquire, SQWTaskCtx **ctx) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskCtx nctx = {0}; @@ -314,8 +314,8 @@ void qwFreeTaskCtx(QW_FPARAMS_DEF, SQWTaskCtx *ctx) { } int32_t qwDropTaskCtx(QW_FPARAMS_DEF) { - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); SQWTaskCtx octx; SQWTaskCtx *ctx = taosHashGet(mgmt->ctxHash, id, sizeof(id)); @@ -348,8 +348,8 @@ int32_t qwDropTaskStatus(QW_FPARAMS_DEF) { SQWTaskStatus *task = NULL; int32_t code = 0; - char id[sizeof(qId) + sizeof(tId)] = {0}; - QW_SET_QTID(id, qId, tId); + char id[sizeof(qId) + sizeof(tId) + sizeof(eId)] = {0}; + QW_SET_QTID(id, qId, tId, eId); if (qwAcquireScheduler(mgmt, sId, QW_WRITE, &sch)) { QW_TASK_WLOG_E("scheduler does not exist"); diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index 4250785f7c..949b67249f 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -168,7 +168,7 @@ int32_t qwGenerateSchHbRsp(SQWorker *mgmt, SQWSchStatus *sch, SQWHbInfo *hbInfo) // TODO GET EXECUTOR API TO GET MORE INFO - QW_GET_QTID(key, status.queryId, status.taskId); + QW_GET_QTID(key, status.queryId, status.taskId, status.execId); status.status = taskStatus->status; status.refId = taskStatus->refId; @@ -417,17 +417,10 @@ int32_t qwHandlePostPhaseEvents(QW_FPARAMS_DEF, int8_t phase, SQWPhaseInput *inp } if (QW_PHASE_POST_QUERY == phase) { -#if 0 - if (QW_IS_EVENT_RECEIVED(ctx, QW_EVENT_READY)) { - readyConnection = &ctx->connInfo; - QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_READY); - } -#else connInfo = ctx->ctrlConnInfo; rspConnection = &connInfo; QW_SET_EVENT_PROCESSED(ctx, QW_EVENT_READY); -#endif } if (QW_IS_EVENT_RECEIVED(ctx, QW_EVENT_DROP)) { @@ -458,8 +451,8 @@ _return: } if (rspConnection) { - qwBuildAndSendQueryRsp(rspConnection, code, ctx ? &ctx->tbInfo : NULL); - QW_TASK_DLOG("ready msg rsped, handle:%p, code:%x - %s", rspConnection->handle, code, tstrerror(code)); + qwBuildAndSendQueryRsp(input->msgType + 1, rspConnection, code, ctx ? &ctx->tbInfo : NULL); + QW_TASK_DLOG("query msg rsped, handle:%p, code:%x - %s", rspConnection->handle, code, tstrerror(code)); } if (ctx) { @@ -500,7 +493,9 @@ int32_t qwPrerocessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg) { QW_ERR_JRET(qwRegisterQueryBrokenLinkArg(QW_FPARAMS(), &qwMsg->connInfo)); - QW_ERR_JRET(qwAddAcquireTaskCtx(QW_FPARAMS(), &ctx)); + QW_ERR_JRET(qwAddTaskCtx(QW_FPARAMS())); + + QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); ctx->ctrlConnInfo = qwMsg->connInfo; @@ -530,8 +525,9 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex QW_ERR_JRET(qwGetTaskCtx(QW_FPARAMS(), &ctx)); - atomic_store_8(&ctx->taskType, taskType); - atomic_store_8(&ctx->explain, explain); + ctx->taskType = taskType; + ctx->explain = explain; + ctx->queryType = qwMsg->msgType; QW_TASK_DLOGL("subplan json string, len:%d, %s", qwMsg->msgLen, qwMsg->msg); @@ -571,6 +567,7 @@ int32_t qwProcessQuery(QW_FPARAMS_DEF, SQWMsg *qwMsg, int8_t taskType, int8_t ex _return: input.code = code; + input.msgType = qwMsg->msgType; code = qwHandlePostPhaseEvents(QW_FPARAMS(), QW_PHASE_POST_QUERY, &input, NULL); // if (!queryRsped) { @@ -739,8 +736,6 @@ int32_t qwProcessDrop(QW_FPARAMS_DEF, SQWMsg *qwMsg) { SQWTaskCtx *ctx = NULL; bool locked = false; - // TODO : TASK ALREADY REMOVED AND A NEW DROP MSG RECEIVED - QW_ERR_JRET(qwAcquireTaskCtx(QW_FPARAMS(), &ctx)); QW_LOCK(QW_WRITE, &ctx->lock); diff --git a/source/libs/qworker/test/qworkerTests.cpp b/source/libs/qworker/test/qworkerTests.cpp index 5bb6acee60..bc37400249 100644 --- a/source/libs/qworker/test/qworkerTests.cpp +++ b/source/libs/qworker/test/qworkerTests.cpp @@ -122,7 +122,7 @@ void qwtBuildQueryReqMsg(SRpcMsg *queryRpc) { qwtqueryMsg.taskId = htobe64(1); qwtqueryMsg.phyLen = htonl(100); qwtqueryMsg.sqlLen = 0; - queryRpc->msgType = TDMT_VND_QUERY; + queryRpc->msgType = TDMT_SCH_QUERY; queryRpc->pCont = &qwtqueryMsg; queryRpc->contLen = sizeof(SSubQueryMsg) + 100; } @@ -131,7 +131,7 @@ void qwtBuildFetchReqMsg(SResFetchReq *fetchMsg, SRpcMsg *fetchRpc) { fetchMsg->sId = htobe64(1); fetchMsg->queryId = htobe64(atomic_load_64(&qwtTestQueryId)); fetchMsg->taskId = htobe64(1); - fetchRpc->msgType = TDMT_VND_FETCH; + fetchRpc->msgType = TDMT_SCH_FETCH; fetchRpc->pCont = fetchMsg; fetchRpc->contLen = sizeof(SResFetchReq); } @@ -140,7 +140,7 @@ void qwtBuildDropReqMsg(STaskDropReq *dropMsg, SRpcMsg *dropRpc) { dropMsg->sId = htobe64(1); dropMsg->queryId = htobe64(atomic_load_64(&qwtTestQueryId)); dropMsg->taskId = htobe64(1); - dropRpc->msgType = TDMT_VND_DROP_TASK; + dropRpc->msgType = TDMT_SCH_DROP_TASK; dropRpc->pCont = dropMsg; dropRpc->contLen = sizeof(STaskDropReq); } @@ -202,7 +202,8 @@ void qwtSendReqToDnode(void* pVnode, struct SEpSet* epSet, struct SRpcMsg* pReq) void qwtRpcSendResponse(const SRpcMsg *pRsp) { switch (pRsp->msgType) { - case TDMT_VND_QUERY_RSP: { + case TDMT_SCH_QUERY_RSP: + case TDMT_SCH_MERGE_QUERY_RSP: { SQueryTableRsp *rsp = (SQueryTableRsp *)pRsp->pCont; if (pRsp->code) { @@ -213,7 +214,7 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { rpcFreeCont(rsp); break; } - case TDMT_VND_FETCH_RSP: { + case TDMT_SCH_FETCH_RSP: { SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)pRsp->pCont; if (0 == pRsp->code && 0 == rsp->completed) { @@ -229,7 +230,7 @@ void qwtRpcSendResponse(const SRpcMsg *pRsp) { break; } - case TDMT_VND_DROP_TASK_RSP: { + case TDMT_SCH_DROP_TASK_RSP: { STaskDropRsp *rsp = (STaskDropRsp *)pRsp->pCont; rpcFreeCont(rsp); @@ -756,9 +757,9 @@ void *queryQueueThread(void *param) { } } - if (TDMT_VND_QUERY == queryRpc->msgType) { + if (TDMT_SCH_QUERY == queryRpc->msgType) { qWorkerProcessQueryMsg(mockPointer, mgmt, queryRpc, 0); - } else if (TDMT_VND_QUERY_CONTINUE == queryRpc->msgType) { + } else if (TDMT_SCH_QUERY_CONTINUE == queryRpc->msgType) { qWorkerProcessCQueryMsg(mockPointer, mgmt, queryRpc, 0); } else { printf("unknown msg in query queue, type:%d\n", queryRpc->msgType); @@ -813,13 +814,13 @@ void *fetchQueueThread(void *param) { } switch (fetchRpc->msgType) { - case TDMT_VND_FETCH: + case TDMT_SCH_FETCH: qWorkerProcessFetchMsg(mockPointer, mgmt, fetchRpc, 0); break; - case TDMT_VND_CANCEL_TASK: + case TDMT_SCH_CANCEL_TASK: qWorkerProcessCancelMsg(mockPointer, mgmt, fetchRpc, 0); break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: qWorkerProcessDropMsg(mockPointer, mgmt, fetchRpc, 0); break; default: diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index b8bcae161b..9897acfe1a 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -2059,7 +2059,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t } if (colIdxi > 1) { - qsort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); + taosSort(colIdx, colIdxi, sizeof(uint32_t), getComparFunc(TSDB_DATA_TYPE_USMALLINT, 0)); } for (uint32_t l = 0; l < colIdxi; ++l) { @@ -2294,7 +2294,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR return TSDB_CODE_SUCCESS; } - qsort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); + taosSort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); int32_t pEnd = 0, cStart = 0, cEnd = 0; uint32_t pColNum = 0, cColNum = 0; diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cef8ff7075..8e532df3b0 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -287,7 +287,7 @@ int32_t sclInitParamList(SScalarParam **pParams, SNodeList* pParamList, SScalarC int32_t code = 0; if (NULL == pParamList) { if (ctx->pBlockList) { - SSDataBlock *pBlock = taosArrayGet(ctx->pBlockList, 0); + SSDataBlock *pBlock = taosArrayGetP(ctx->pBlockList, 0); *rowNum = pBlock->info.rows; } else { *rowNum = 1; diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index dc4bf33a2b..76c0e48740 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1515,7 +1515,10 @@ int32_t timeDiffFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *p } int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - int64_t ts = taosGetTimestamp(TSDB_TIME_PRECISION_MILLI); + int64_t timePrec; + GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[0]), pInput[0].columnData->pData); + + int64_t ts = taosGetTimestamp(timePrec); for (int32_t i = 0; i < pInput->numOfRows; ++i) { colDataAppendInt64(pOutput->columnData, i, &ts); } @@ -1524,7 +1527,10 @@ int32_t nowFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutpu } int32_t todayFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) { - int64_t ts = taosGetTimestampToday(TSDB_TIME_PRECISION_MILLI); + int64_t timePrec; + GET_TYPED_DATA(timePrec, int64_t, GET_PARAM_TYPE(&pInput[0]), pInput[0].columnData->pData); + + int64_t ts = taosGetTimestampToday(timePrec); for (int32_t i = 0; i < pInput->numOfRows; ++i) { colDataAppendInt64(pOutput->columnData, i, &ts); } diff --git a/source/libs/scheduler/inc/schedulerInt.h b/source/libs/scheduler/inc/schedulerInt.h index 5998ab6965..94a1108710 100644 --- a/source/libs/scheduler/inc/schedulerInt.h +++ b/source/libs/scheduler/inc/schedulerInt.h @@ -125,7 +125,7 @@ typedef struct SSchTaskCallbackParam { uint64_t queryId; int64_t refId; uint64_t taskId; - int32_t execIdx; + int32_t execId; void *pTrans; } SSchTaskCallbackParam; @@ -171,7 +171,7 @@ typedef struct SSchTask { uint64_t taskId; // task id SRWLatch lock; // task lock int32_t maxExecTimes; // task may exec times - int32_t execIdx; // task current execute try index + int32_t execId; // task current execute try index SSchLevel *level; // level SRWLatch planLock; // task update plan lock SSubplan *plan; // subplan @@ -244,9 +244,9 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_START_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.execUseTime[idx] = us; \ - if (0 == (_task)->execIdx) { \ + if (0 == (_task)->execId) { \ (_task)->profile.startTs = us; \ } \ } while (0) @@ -254,7 +254,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_WAIT_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.waitTime += us - (_task)->profile.execUseTime[idx]; \ } while (0) @@ -262,12 +262,12 @@ extern SSchedulerMgmt schMgmt; #define SCH_LOG_TASK_END_TS(_task) \ do { \ int64_t us = taosGetTimestampUs(); \ - int32_t idx = (_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES; \ + int32_t idx = (_task)->execId % SCH_TASK_MAX_EXEC_TIMES; \ (_task)->profile.execUseTime[idx] = us - (_task)->profile.execUseTime[idx]; \ (_task)->profile.endTs = us; \ } while (0) -#define SCH_TASK_TIMEOUT(_task) ((taosGetTimestampUs() - (_task)->profile.execUseTime[(_task)->execIdx % SCH_TASK_MAX_EXEC_TIMES]) > (_task)->timeoutUsec) +#define SCH_TASK_TIMEOUT(_task) ((taosGetTimestampUs() - (_task)->profile.execUseTime[(_task)->execId % SCH_TASK_MAX_EXEC_TIMES]) > (_task)->timeoutUsec) #define SCH_TASK_READY_FOR_LAUNCH(readyNum, task) ((readyNum) >= taosArrayGetSize((task)->children)) @@ -275,6 +275,7 @@ extern SSchedulerMgmt schMgmt; #define SCH_UNLOCK_TASK(_task) SCH_UNLOCK(SCH_WRITE, &(_task)->lock) #define SCH_TASK_ID(_task) ((_task) ? (_task)->taskId : -1) +#define SCH_TASK_EID(_task) ((_task) ? (_task)->execId : -1) #define SCH_SET_TASK_LASTMSG_TYPE(_task, _type) do { if(_task) { atomic_store_32(&(_task)->lastMsgType, _type); } } while (0) #define SCH_GET_TASK_LASTMSG_TYPE(_task) ((_task) ? atomic_load_32(&(_task)->lastMsgType) : -1) @@ -307,6 +308,8 @@ extern SSchedulerMgmt schMgmt; #define SCH_IS_WAIT_ALL_JOB(_job) (!SCH_IS_QUERY_JOB(_job)) #define SCH_IS_NEED_DROP_JOB(_job) (SCH_IS_QUERY_JOB(_job)) #define SCH_IS_EXPLAIN_JOB(_job) (EXPLAIN_MODE_ANALYZE == (_job)->attr.explainMode) +#define SCH_NETWORK_ERR(_code) ((_code) == TSDB_CODE_RPC_BROKEN_LINK || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL) +#define SCH_SUB_TASK_NETWORK_ERR(_code, _len) (((_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL || (_code) == TSDB_CODE_RPC_BROKEN_LINK) && ((_len) > 0)) #define SCH_IS_LEVEL_UNFINISHED(_level) ((_level)->taskLaunchedNum < (_level)->taskNum) #define SCH_GET_CUR_EP(_addr) (&(_addr)->epSet.eps[(_addr)->epSet.inUse]) @@ -317,13 +320,13 @@ extern SSchedulerMgmt schMgmt; #define SCH_JOB_DLOG(param, ...) qDebug("QID:0x%" PRIx64 " " param, pJob->queryId, __VA_ARGS__) #define SCH_TASK_ELOG(param, ...) \ - qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qError("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_DLOG(param, ...) \ - qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_DLOGL(param, ...) \ - qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qDebugL("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_TASK_WLOG(param, ...) \ - qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " " param, pJob->queryId, SCH_TASK_ID(pTask), __VA_ARGS__) + qWarn("QID:0x%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d " param, pJob->queryId, SCH_TASK_ID(pTask), SCH_TASK_EID(pTask),__VA_ARGS__) #define SCH_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0) #define SCH_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0) @@ -354,7 +357,7 @@ void schFreeJobImpl(void *job); int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx); int32_t schEnsureHbConnection(SSchJob *pJob, SSchTask *pTask); int32_t schUpdateHbConnection(SQueryNodeEpId *epId, SSchTrans *trans); -int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code); +int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code); void schFreeRpcCtx(SRpcCtx *pCtx); int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp); bool schJobNeedToStop(SSchJob *pJob, int8_t *pStatus); @@ -365,7 +368,7 @@ void schProcessOnDataFetched(SSchJob *job); int32_t schGetTaskInJob(SSchJob *pJob, uint64_t taskId, SSchTask **pTask); void schFreeRpcCtxVal(const void *arg); int32_t schMakeBrokenLinkVal(SSchJob *pJob, SSchTask *pTask, SRpcBrokenlinkVal *brokenVal, bool isHb); -int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execIdx); +int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execId); int32_t schExecStaticExplainJob(SSchedulerReq *pReq, int64_t *job, bool sync); int32_t schExecJobImpl(SSchedulerReq *pReq, SSchJob *pJob, bool sync); int32_t schUpdateJobStatus(SSchJob *pJob, int8_t newStatus); @@ -377,13 +380,15 @@ int32_t schExecJob(SSchedulerReq *pReq, int64_t *pJob, SQueryResult *pRes); int32_t schAsyncExecJob(SSchedulerReq *pReq, int64_t *pJob); int32_t schFetchRows(SSchJob *pJob); int32_t schAsyncFetchRows(SSchJob *pJob); -int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execIdx); +int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execId); int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList); void schFreeSMsgSendInfo(SMsgSendInfo *msgSendInfo); char* schGetOpStr(SCH_OP_TYPE type); int32_t schBeginOperation(SSchJob *pJob, SCH_OP_TYPE type, bool sync); int32_t schInitJob(SSchedulerReq *pReq, SSchJob **pSchJob); int32_t schSetJobQueryRes(SSchJob* pJob, SQueryResult* pRes); +int32_t schUpdateTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask, SEpSet* pEpSet); +int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode); #ifdef __cplusplus diff --git a/source/libs/scheduler/src/schJob.c b/source/libs/scheduler/src/schJob.c index bd3a944c3f..425ea242fd 100644 --- a/source/libs/scheduler/src/schJob.c +++ b/source/libs/scheduler/src/schJob.c @@ -28,7 +28,7 @@ FORCE_INLINE int32_t schReleaseJob(int64_t refId) { qDebug("sch release jobId:0x int32_t schInitTask(SSchJob *pJob, SSchTask *pTask, SSubplan *pPlan, SSchLevel *pLevel) { pTask->plan = pPlan; pTask->level = pLevel; - pTask->execIdx = -1; + pTask->execId = -1; pTask->maxExecTimes = SCH_TASK_MAX_EXEC_TIMES; pTask->timeoutUsec = SCH_DEFAULT_TASK_TIMEOUT_USEC; SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); @@ -429,59 +429,59 @@ int32_t schRecordTaskSucceedNode(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } -int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execIdx) { +int32_t schAppendTaskExecNode(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, int32_t execId) { SSchNodeInfo nodeInfo = {.addr = *addr, .handle = NULL}; - if (taosHashPut(pTask->execNodes, &execIdx, sizeof(execIdx), &nodeInfo, sizeof(nodeInfo))) { + if (taosHashPut(pTask->execNodes, &execId, sizeof(execId), &nodeInfo, sizeof(nodeInfo))) { SCH_TASK_ELOG("taosHashPut nodeInfo to execNodes failed, errno:%d", errno); SCH_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - SCH_TASK_DLOG("task execNode added, execIdx:%d", execIdx); + SCH_TASK_DLOG("task execNode added, execId:%d", execId); return TSDB_CODE_SUCCESS; } -int32_t schDropTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execIdx) { +int32_t schDropTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execId) { if (NULL == pTask->execNodes) { return TSDB_CODE_SUCCESS; } - if (taosHashRemove(pTask->execNodes, &execIdx, sizeof(execIdx))) { - SCH_TASK_ELOG("fail to remove execIdx %d from execNodeList", execIdx); + if (taosHashRemove(pTask->execNodes, &execId, sizeof(execId))) { + SCH_TASK_ELOG("fail to remove execId %d from execNodeList", execId); } else { - SCH_TASK_DLOG("execIdx %d removed from execNodeList", execIdx); + SCH_TASK_DLOG("execId %d removed from execNodeList", execId); } - if (execIdx != pTask->execIdx) { // ignore it - SCH_TASK_DLOG("execIdx %d is not current execIdx %d", execIdx, pTask->execIdx); + if (execId != pTask->execId) { // ignore it + SCH_TASK_DLOG("execId %d is not current execId %d", execId, pTask->execId); SCH_RET(TSDB_CODE_SCH_IGNORE_ERROR); } return TSDB_CODE_SUCCESS; } -int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execIdx) { +int32_t schUpdateTaskExecNode(SSchJob *pJob, SSchTask *pTask, void *handle, int32_t execId) { if (taosHashGetSize(pTask->execNodes) <= 0) { return TSDB_CODE_SUCCESS; } - SSchNodeInfo *nodeInfo = taosHashGet(pTask->execNodes, &execIdx, sizeof(execIdx)); + SSchNodeInfo *nodeInfo = taosHashGet(pTask->execNodes, &execId, sizeof(execId)); nodeInfo->handle = handle; - SCH_TASK_DLOG("handle updated to %p for execIdx %d", handle, execIdx); + SCH_TASK_DLOG("handle updated to %p for execId %d", handle, execId); return TSDB_CODE_SUCCESS; } -int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execIdx) { +int32_t schUpdateTaskHandle(SSchJob *pJob, SSchTask *pTask, bool dropExecNode, void *handle, int32_t execId) { if (dropExecNode) { - SCH_RET(schDropTaskExecNode(pJob, pTask, handle, execIdx)); + SCH_RET(schDropTaskExecNode(pJob, pTask, handle, execId)); } SCH_SET_TASK_HANDLE(pTask, handle); - schUpdateTaskExecNode(pJob, pTask, handle, execIdx); + schUpdateTaskExecNode(pJob, pTask, handle, execId); return TSDB_CODE_SUCCESS; } @@ -683,6 +683,25 @@ int32_t schSetTaskCandidateAddrs(SSchJob *pJob, SSchTask *pTask) { return TSDB_CODE_SUCCESS; } +int32_t schUpdateTaskCandidateAddr(SSchJob *pJob, SSchTask *pTask, SEpSet* pEpSet) { + if (NULL == pTask->candidateAddrs || 1 != taosArrayGetSize(pTask->candidateAddrs)) { + SCH_TASK_ELOG("not able to update cndidate addr, addr num %d", (int32_t)(pTask->candidateAddrs ? taosArrayGetSize(pTask->candidateAddrs): 0)); + SCH_ERR_RET(TSDB_CODE_APP_ERROR); + } + + SQueryNodeAddr* pAddr = taosArrayGet(pTask->candidateAddrs, 0); + + SEp* pOld = &pAddr->epSet.eps[pAddr->epSet.inUse]; + SEp* pNew = &pEpSet->eps[pEpSet->inUse]; + + SCH_TASK_DLOG("update task ep from %s:%d to %s:%d", pOld->fqdn, pOld->port, pNew->fqdn, pNew->port); + + memcpy(&pAddr->epSet, pEpSet, sizeof(pAddr->epSet)); + + return TSDB_CODE_SUCCESS; +} + + int32_t schRemoveTaskFromExecList(SSchJob *pJob, SSchTask *pTask) { int32_t code = taosHashRemove(pJob->execTasks, &pTask->taskId, sizeof(pTask->taskId)); if (code) { @@ -810,9 +829,9 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo } } - if ((pTask->execIdx + 1) >= pTask->maxExecTimes) { + if ((pTask->execId + 1) >= pTask->maxExecTimes) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since reach max try times, execIdx:%d", pTask->execIdx); + SCH_TASK_DLOG("task no more retry since reach max try times, execId:%d", pTask->execId); return TSDB_CODE_SUCCESS; } @@ -822,11 +841,10 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo return TSDB_CODE_SUCCESS; } - // TODO CHECK epList/condidateList if (SCH_IS_DATA_SRC_TASK(pTask)) { - if ((pTask->execIdx + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { + if ((pTask->execId + 1) >= SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)) { *needRetry = false; - SCH_TASK_DLOG("task no more retry since all ep tried, execIdx:%d, epNum:%d", pTask->execIdx, + SCH_TASK_DLOG("task no more retry since all ep tried, execId:%d, epNum:%d", pTask->execId, SCH_TASK_NUM_OF_EPS(&pTask->plan->execNode)); return TSDB_CODE_SUCCESS; } @@ -842,7 +860,7 @@ int32_t schTaskCheckSetRetry(SSchJob *pJob, SSchTask *pTask, int32_t errCode, bo } *needRetry = true; - SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execIdx + 1, errCode, tstrerror(errCode)); + SCH_TASK_DLOG("task need the %dth retry, errCode:%x - %s", pTask->execId + 1, errCode, tstrerror(errCode)); return TSDB_CODE_SUCCESS; } @@ -854,7 +872,6 @@ int32_t schHandleTaskRetry(SSchJob *pJob, SSchTask *pTask) { SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); if (SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) { - SCH_ERR_RET(schDecTaskFlowQuota(pJob, pTask)); SCH_ERR_RET(schLaunchTasksInFlowCtrlList(pJob, pTask)); } @@ -1155,6 +1172,7 @@ int32_t schProcessOnTaskSuccess(SSchJob *pJob, SSchTask *pTask) { SDownstreamSourceNode source = {.type = QUERY_NODE_DOWNSTREAM_SOURCE, .taskId = pTask->taskId, .schedId = schMgmt.sId, + .execId = pTask->execId, .addr = pTask->succeedAddr}; qSetSubplanExecutionNode(parent->plan, pTask->plan->id.groupId, &source); SCH_UNLOCK(SCH_WRITE, &parent->lock); @@ -1184,7 +1202,7 @@ int32_t schFetchFromRemote(SSchJob *pJob) { return TSDB_CODE_SUCCESS; } - SCH_ERR_JRET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, TDMT_VND_FETCH)); + SCH_ERR_JRET(schBuildAndSendMsg(pJob, pJob->fetchTask, &pJob->resNode, TDMT_SCH_FETCH)); return TSDB_CODE_SUCCESS; @@ -1223,7 +1241,7 @@ void schDropTaskOnExecNode(SSchJob *pJob, SSchTask *pTask) { while (nodeInfo) { SCH_SET_TASK_HANDLE(pTask, nodeInfo->handle); - schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_VND_DROP_TASK); + schBuildAndSendMsg(pJob, pTask, &nodeInfo->addr, TDMT_SCH_DROP_TASK); nodeInfo = taosHashIterate(pTask->execNodes, nodeInfo); } @@ -1238,8 +1256,9 @@ int32_t schRescheduleTask(SSchJob *pJob, SSchTask *pTask) { } SCH_LOCK_TASK(pTask); - if (JOB_TASK_STATUS_EXECUTING == pTask->status && pJob->fetchTask != pTask && taosArrayGetSize(pTask->candidateAddrs) > 1) { - SCH_TASK_DLOG("task execIdx %d will be rescheduled now", pTask->execIdx); + if (SCH_TASK_TIMEOUT(pTask) && JOB_TASK_STATUS_EXECUTING == pTask->status && + pJob->fetchTask != pTask && taosArrayGetSize(pTask->candidateAddrs) > 1) { + SCH_TASK_DLOG("task execId %d will be rescheduled now", pTask->execId); schDropTaskOnExecNode(pJob, pTask); taosHashClear(pTask->execNodes); schProcessOnTaskFailure(pJob, pTask, TSDB_CODE_SCH_TIMEOUT_ERROR); @@ -1258,6 +1277,9 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { for (int32_t i = 0; i < taskNum; ++i) { STaskStatus *taskStatus = taosArrayGet(pStatusList, i); + qDebug("QID:%" PRIx64 ",TID:0x%" PRIx64 ",EID:%d task status in server: %s", + taskStatus->queryId, taskStatus->taskId, taskStatus->execId, jobTaskStatusStr(taskStatus->status)); + SSchJob *pJob = schAcquireJob(taskStatus->refId); if (NULL == pJob) { qWarn("job not found, refId:0x%" PRIx64 ",QID:0x%" PRIx64 ",TID:0x%" PRIx64, taskStatus->refId, @@ -1266,8 +1288,6 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { continue; } - SCH_JOB_DLOG("TID:0x%" PRIx64 " task status in server: %s", taskStatus->taskId, jobTaskStatusStr(taskStatus->status)); - pTask = NULL; schGetTaskInJob(pJob, taskStatus->taskId, &pTask); if (NULL == pTask) { @@ -1275,6 +1295,13 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { schReleaseJob(taskStatus->refId); continue; } + + if (taskStatus->execId != pTask->execId) { + // TODO DROP TASK FROM SERVER!!!! + SCH_TASK_DLOG("EID %d in hb rsp mis-match", taskStatus->execId); + schReleaseJob(taskStatus->refId); + continue; + } if (taskStatus->status == JOB_TASK_STATUS_FAILED) { // RECORD AND HANDLE ERROR!!!! @@ -1282,7 +1309,7 @@ int32_t schProcessOnTaskStatusRsp(SQueryNodeEpId* pEpId, SArray* pStatusList) { continue; } - if (taskStatus->status == JOB_TASK_STATUS_NOT_START && SCH_TASK_TIMEOUT(pTask)) { + if (taskStatus->status == JOB_TASK_STATUS_NOT_START) { schRescheduleTask(pJob, pTask); } @@ -1308,7 +1335,7 @@ int32_t schSaveJobQueryRes(SSchJob *pJob, SQueryTableRsp *rsp) { tbInfo.tversion = rsp->tversion; taosArrayPush((SArray *)pJob->execRes.res, &tbInfo); - pJob->execRes.msgType = TDMT_VND_QUERY; + pJob->execRes.msgType = TDMT_SCH_QUERY; } return TSDB_CODE_SUCCESS; @@ -1345,9 +1372,9 @@ int32_t schLaunchTaskImpl(SSchJob *pJob, SSchTask *pTask) { int32_t code = 0; atomic_add_fetch_32(&pTask->level->taskLaunchedNum, 1); - pTask->execIdx++; + pTask->execId++; - SCH_TASK_DLOG("start to launch task's %dth exec", pTask->execIdx); + SCH_TASK_DLOG("start to launch task's %dth exec", pTask->execId); SCH_LOG_TASK_START_TS(pTask); @@ -1658,5 +1685,94 @@ _return: SCH_RET(code); } +int32_t schDoTaskRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode) { + int32_t code = 0; + int8_t status = 0; + if (schJobNeedToStop(pJob, &status)) { + SCH_TASK_ELOG("redirect will no continue cause of job status %s", jobTaskStatusStr(status)); + SCH_RET(atomic_load_32(&pJob->errCode)); + } + + if ((pTask->execId + 1) >= pTask->maxExecTimes) { + SCH_TASK_DLOG("task no more retry since reach max try times, execId:%d", pTask->execId); + schProcessOnJobFailure(pJob, rspCode); + return TSDB_CODE_SUCCESS; + } + + SCH_TASK_DLOG("task will be redirected now, status:%s", SCH_GET_TASK_STATUS_STR(pTask)); + + schDropTaskOnExecNode(pJob, pTask); + taosHashClear(pTask->execNodes); + SCH_ERR_JRET(schRemoveTaskFromExecList(pJob, pTask)); + schDeregisterTaskHb(pJob, pTask); + atomic_sub_fetch_32(&pTask->level->taskLaunchedNum, 1); + taosMemoryFreeClear(pTask->msg); + pTask->msgLen = 0; + pTask->lastMsgType = 0; + memset(&pTask->succeedAddr, 0, sizeof(pTask->succeedAddr)); + + if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + if (pData) { + SCH_ERR_JRET(schUpdateTaskCandidateAddr(pJob, pTask, pData->pEpSet)); + } + + if (SCH_TASK_NEED_FLOW_CTRL(pJob, pTask)) { + if (JOB_TASK_STATUS_EXECUTING == SCH_GET_TASK_STATUS(pTask)) { + SCH_ERR_JRET(schLaunchTasksInFlowCtrlList(pJob, pTask)); + } + } + + SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); + + SCH_ERR_JRET(schLaunchTask(pJob, pTask)); + + return TSDB_CODE_SUCCESS; + } + + + // merge plan + + pTask->childReady = 0; + + qClearSubplanExecutionNode(pTask->plan); + + SCH_SET_TASK_STATUS(pTask, JOB_TASK_STATUS_NOT_START); + + int32_t childrenNum = taosArrayGetSize(pTask->children); + for (int32_t i = 0; i < childrenNum; ++i) { + SSchTask* pChild = taosArrayGetP(pTask->children, i); + SCH_LOCK_TASK(pChild); + schDoTaskRedirect(pJob, pChild, NULL, rspCode); + SCH_UNLOCK_TASK(pChild); + } + + return TSDB_CODE_SUCCESS; + +_return: + + code = schProcessOnTaskFailure(pJob, pTask, code); + + SCH_RET(code); +} + +int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf* pData, int32_t rspCode) { + int32_t code = 0; + + if (SCH_IS_DATA_SRC_QRY_TASK(pTask)) { + if (NULL == pData->pEpSet) { + SCH_TASK_ELOG("no epset updated while got error %s", tstrerror(rspCode)); + SCH_ERR_JRET(rspCode); + } + } + + SCH_RET(schDoTaskRedirect(pJob, pTask, pData, rspCode)); + +_return: + + schProcessOnTaskFailure(pJob, pTask, code); + + SCH_RET(code); +} + diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 0bd747785c..69e41d3111 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -28,9 +28,10 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy int32_t reqMsgType = msgType - 1; switch (msgType) { case TDMT_SCH_LINK_BROKEN: - case TDMT_VND_EXPLAIN_RSP: + case TDMT_SCH_EXPLAIN_RSP: return TSDB_CODE_SUCCESS; - case TDMT_VND_QUERY_RSP: // query_rsp may be processed later than ready_rsp + case TDMT_SCH_MERGE_QUERY_RSP: + case TDMT_SCH_QUERY_RSP: // query_rsp may be processed later than ready_rsp if (lastMsgType != reqMsgType && -1 != lastMsgType) { SCH_TASK_DLOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); @@ -43,7 +44,7 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy SCH_SET_TASK_LASTMSG_TYPE(pTask, -1); return TSDB_CODE_SUCCESS; - case TDMT_VND_FETCH_RSP: + case TDMT_SCH_FETCH_RSP: if (lastMsgType != reqMsgType && -1 != lastMsgType) { SCH_TASK_ELOG("rsp msg type mis-match, last sent msgType:%s, rspType:%s", TMSG_INFO(lastMsgType), TMSG_INFO(msgType)); @@ -90,15 +91,6 @@ int32_t schValidateReceivedMsgType(SSchJob *pJob, SSchTask *pTask, int32_t msgTy int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, char *msg, int32_t msgSize, int32_t rspCode) { int32_t code = 0; - int8_t status = 0; - - if (schJobNeedToStop(pJob, &status)) { - SCH_TASK_ELOG("rsp not processed cause of job status, job status:%s, rspCode:0x%x", jobTaskStatusStr(status), rspCode); - taosMemoryFreeClear(msg); - SCH_RET(atomic_load_32(&pJob->errCode)); - } - - SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); switch (msgType) { case TDMT_VND_CREATE_TABLE_RSP: { @@ -247,7 +239,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch break; } - case TDMT_VND_QUERY_RSP: { + case TDMT_SCH_QUERY_RSP: + case TDMT_SCH_MERGE_QUERY_RSP: { SQueryTableRsp *rsp = (SQueryTableRsp *)msg; SCH_ERR_JRET(rspCode); @@ -264,7 +257,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch break; } - case TDMT_VND_EXPLAIN_RSP: { + case TDMT_SCH_EXPLAIN_RSP: { SCH_ERR_JRET(rspCode); if (NULL == msg) { SCH_ERR_JRET(TSDB_CODE_QRY_INVALID_INPUT); @@ -294,7 +287,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch } break; } - case TDMT_VND_FETCH_RSP: { + case TDMT_SCH_FETCH_RSP: { SRetrieveTableRsp *rsp = (SRetrieveTableRsp *)msg; SCH_ERR_JRET(rspCode); @@ -342,8 +335,8 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t msgType, ch schProcessOnDataFetched(pJob); break; } - case TDMT_VND_DROP_TASK_RSP: { - // SHOULD NEVER REACH HERE + case TDMT_SCH_DROP_TASK_RSP: { + // NEVER REACH HERE SCH_TASK_ELOG("invalid status to handle drop task rsp, refId:0x%" PRIx64, pJob->refId); SCH_ERR_JRET(TSDB_CODE_SCH_INTERNAL_ERROR); break; @@ -367,8 +360,9 @@ _return: } -int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, int32_t rspCode) { +int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { int32_t code = 0; + int32_t msgType = pMsg->msgType; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; SSchTask *pTask = NULL; @@ -385,15 +379,30 @@ int32_t schHandleCallback(void *param, const SDataBuf *pMsg, int32_t msgType, in SCH_TASK_DLOG("rsp msg received, type:%s, handle:%p, code:%s", TMSG_INFO(msgType), pMsg->handle, tstrerror(rspCode)); - if (pParam->execIdx != pTask->execIdx) { - SCH_TASK_DLOG("execIdx %d mis-match current execIdx %d", pParam->execIdx, pTask->execIdx); + if (pParam->execId != pTask->execId) { + SCH_TASK_DLOG("execId %d mis-match current execId %d", pParam->execId, pTask->execId); goto _return; } - bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || rspCode == TSDB_CODE_RPC_NETWORK_UNAVAIL); - SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execIdx)); + bool dropExecNode = (msgType == TDMT_SCH_LINK_BROKEN || SCH_NETWORK_ERR(rspCode)); + SCH_ERR_JRET(schUpdateTaskHandle(pJob, pTask, dropExecNode, pMsg->handle, pParam->execId)); + + int8_t status = 0; + if (schJobNeedToStop(pJob, &status)) { + SCH_TASK_ELOG("rsp will not be processed cause of job status %s, rspCode:0x%x", jobTaskStatusStr(status), rspCode); + code = atomic_load_32(&pJob->errCode); + goto _return; + } + + SCH_ERR_JRET(schValidateReceivedMsgType(pJob, pTask, msgType)); + + if (NEED_SCHEDULER_REDIRECT_ERROR(rspCode) || SCH_SUB_TASK_NETWORK_ERR(rspCode, pMsg->len > 0)) { + code = schHandleRedirect(pJob, pTask, (SDataBuf *)pMsg, rspCode); + goto _return; + } - SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode)); + code = schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode); + pMsg->pData = NULL; _return: @@ -405,50 +414,19 @@ _return: schReleaseJob(pParam->refId); } + taosMemoryFreeClear(pMsg->pData); taosMemoryFreeClear(param); SCH_RET(code); } -int32_t schHandleSubmitCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_SUBMIT_RSP, code); -} - -int32_t schHandleCreateTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_CREATE_TABLE_RSP, code); -} - -int32_t schHandleDropTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_DROP_TABLE_RSP, code); -} - -int32_t schHandleAlterTbCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_ALTER_TABLE_RSP, code); -} - -int32_t schHandleQueryCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_QUERY_RSP, code); -} - -int32_t schHandleDeleteCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_DELETE_RSP, code); -} - -int32_t schHandleFetchCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_FETCH_RSP, code); -} - -int32_t schHandleExplainCallback(void *param, const SDataBuf *pMsg, int32_t code) { - return schHandleCallback(param, pMsg, TDMT_VND_EXPLAIN_RSP, code); -} - -int32_t schHandleDropCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); taosMemoryFreeClear(param); return TSDB_CODE_SUCCESS; } -int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleLinkBrokenCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchCallbackParamHeader *head = (SSchCallbackParamHeader *)param; rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); @@ -461,7 +439,7 @@ int32_t schHandleLinkBrokenCallback(void *param, const SDataBuf *pMsg, int32_t c SCH_ERR_RET(schBuildAndSendHbMsg(&hbParam->nodeEpId, NULL)); } else { - SCH_ERR_RET(schHandleCallback(param, pMsg, TDMT_SCH_LINK_BROKEN, code)); + SCH_ERR_RET(schHandleCallback(param, pMsg, code)); } return TSDB_CODE_SUCCESS; @@ -480,7 +458,7 @@ int32_t schMakeCallbackParam(SSchJob *pJob, SSchTask *pTask, int32_t msgType, bo param->refId = pJob->refId; param->taskId = SCH_TASK_ID(pTask); param->pTrans = pJob->conn.pTrans; - param->execIdx = pTask->execIdx; + param->execId = pTask->execId; *pParam = param; return TSDB_CODE_SUCCESS; @@ -557,33 +535,20 @@ _return: int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { switch (msgType) { case TDMT_VND_CREATE_TABLE: - *fp = schHandleCreateTbCallback; - break; case TDMT_VND_DROP_TABLE: - *fp = schHandleDropTbCallback; - break; case TDMT_VND_ALTER_TABLE: - *fp = schHandleAlterTbCallback; - break; case TDMT_VND_SUBMIT: - *fp = schHandleSubmitCallback; - break; - case TDMT_VND_QUERY: - *fp = schHandleQueryCallback; - break; + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: case TDMT_VND_DELETE: - *fp = schHandleDeleteCallback; + case TDMT_SCH_EXPLAIN: + case TDMT_SCH_FETCH: + *fp = schHandleCallback; break; - case TDMT_VND_EXPLAIN: - *fp = schHandleExplainCallback; - break; - case TDMT_VND_FETCH: - *fp = schHandleFetchCallback; - break; - case TDMT_VND_DROP_TASK: + case TDMT_SCH_DROP_TASK: *fp = schHandleDropCallback; break; - case TDMT_VND_QUERY_HEARTBEAT: + case TDMT_SCH_QUERY_HEARTBEAT: *fp = schHandleHbCallback; break; case TDMT_SCH_LINK_BROKEN: @@ -692,9 +657,9 @@ int32_t schMakeHbRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { SCH_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT_RSP; + int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT_RSP; __async_send_cb_fn_t fp = NULL; - SCH_ERR_JRET(schGetCallbackFp(TDMT_VND_QUERY_HEARTBEAT, &fp)); + SCH_ERR_JRET(schGetCallbackFp(TDMT_SCH_QUERY_HEARTBEAT, &fp)); param->nodeEpId = epId; param->pTrans = pJob->conn.pTrans; @@ -722,7 +687,7 @@ _return: SCH_RET(code); } -int32_t schHandleHbCallback(void *param, const SDataBuf *pMsg, int32_t code) { +int32_t schHandleHbCallback(void *param, SDataBuf *pMsg, int32_t code) { SSchedulerHbRsp rsp = {0}; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; @@ -784,9 +749,9 @@ int32_t schMakeQueryRpcCtx(SSchJob *pJob, SSchTask *pTask, SRpcCtx *pCtx) { } SSchTrans trans = {.pTrans = pJob->conn.pTrans, .pHandle = SCH_GET_TASK_HANDLE(pTask)}; - SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, NULL, 0, TDMT_VND_EXPLAIN, &trans, false, &pExplainMsgSendInfo)); + SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, NULL, 0, TDMT_SCH_EXPLAIN, &trans, false, &pExplainMsgSendInfo)); - int32_t msgType = TDMT_VND_EXPLAIN_RSP; + int32_t msgType = TDMT_SCH_EXPLAIN_RSP; SRpcCtxVal ctxVal = {.val = pExplainMsgSendInfo, .clone = schCloneSMsgSendInfo}; if (taosHashPut(pCtx->args, &msgType, sizeof(msgType), &ctxVal, sizeof(ctxVal))) { SCH_TASK_ELOG("taosHashPut msg %d to rpcCtx failed", msgType); @@ -882,7 +847,7 @@ int32_t schAsyncSendMsg(SSchJob *pJob, SSchTask *pTask, SSchTrans *trans, SQuery SEpSet *epSet = &addr->epSet; SMsgSendInfo *pMsgSendInfo = NULL; - bool isHb = (TDMT_VND_QUERY_HEARTBEAT == msgType); + bool isHb = (TDMT_SCH_QUERY_HEARTBEAT == msgType); SCH_ERR_JRET(schGenerateCallBackInfo(pJob, pTask, msg, msgSize, msgType, trans, isHb, &pMsgSendInfo)); SCH_ERR_JRET(schUpdateSendTargetInfo(pMsgSendInfo, addr, pTask)); @@ -926,7 +891,7 @@ int32_t schBuildAndSendHbMsg(SQueryNodeEpId *nodeEpId, SArray* taskAction) { int32_t code = 0; SRpcCtx rpcCtx = {0}; SSchTrans trans = {0}; - int32_t msgType = TDMT_VND_QUERY_HEARTBEAT; + int32_t msgType = TDMT_SCH_QUERY_HEARTBEAT; req.header.vgId = nodeEpId->nodeId; req.sId = schMgmt.sId; @@ -1032,7 +997,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, tSerializeSVDeleteReq(msg, msgSize, &req); break; } - case TDMT_VND_QUERY: { + case TDMT_SCH_QUERY: + case TDMT_SCH_MERGE_QUERY: { SCH_ERR_RET(schMakeQueryRpcCtx(pJob, pTask, &rpcCtx)); uint32_t len = strlen(pJob->sql); @@ -1049,6 +1015,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); pMsg->refId = htobe64(pJob->refId); + pMsg->execId = htonl(pTask->execId); pMsg->taskType = TASK_TYPE_TEMP; pMsg->explain = SCH_IS_EXPLAIN_JOB(pJob); pMsg->phyLen = htonl(pTask->msgLen); @@ -1060,7 +1027,7 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, persistHandle = true; break; } - case TDMT_VND_FETCH: { + case TDMT_SCH_FETCH: { msgSize = sizeof(SResFetchReq); msg = taosMemoryCalloc(1, msgSize); if (NULL == msg) { @@ -1075,10 +1042,11 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->sId = htobe64(schMgmt.sId); pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); + pMsg->execId = htonl(pTask->execId); break; } - case TDMT_VND_DROP_TASK: { + case TDMT_SCH_DROP_TASK: { msgSize = sizeof(STaskDropReq); msg = taosMemoryCalloc(1, msgSize); if (NULL == msg) { @@ -1094,9 +1062,10 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, pMsg->queryId = htobe64(pJob->queryId); pMsg->taskId = htobe64(pTask->taskId); pMsg->refId = htobe64(pJob->refId); + pMsg->execId = htonl(pTask->execId); break; } - case TDMT_VND_QUERY_HEARTBEAT: { + case TDMT_SCH_QUERY_HEARTBEAT: { SCH_ERR_RET(schMakeHbRpcCtx(pJob, pTask, &rpcCtx)); SSchedulerHbReq req = {0}; @@ -1135,8 +1104,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, SCH_ERR_JRET(schAsyncSendMsg(pJob, pTask, &trans, addr, msgType, msg, msgSize, persistHandle, (rpcCtx.args ? &rpcCtx : NULL))); - if (msgType == TDMT_VND_QUERY) { - SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execIdx)); + if (msgType == TDMT_SCH_QUERY || msgType == TDMT_SCH_MERGE_QUERY) { + SCH_ERR_RET(schAppendTaskExecNode(pJob, pTask, addr, pTask->execId)); } return TSDB_CODE_SUCCESS; diff --git a/source/libs/scheduler/test/schedulerTests.cpp b/source/libs/scheduler/test/schedulerTests.cpp index b372ee3ead..098699744d 100644 --- a/source/libs/scheduler/test/schedulerTests.cpp +++ b/source/libs/scheduler/test/schedulerTests.cpp @@ -118,7 +118,7 @@ void schtBuildQueryDag(SQueryPlan *dag) { scanPlan->level = 1; scanPlan->pParents = nodesMakeList(); scanPlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - scanPlan->msgType = TDMT_VND_QUERY; + scanPlan->msgType = TDMT_SCH_QUERY; mergePlan->id.queryId = qId; mergePlan->id.groupId = schtMergeTemplateId; @@ -130,7 +130,7 @@ void schtBuildQueryDag(SQueryPlan *dag) { mergePlan->pChildren = nodesMakeList(); mergePlan->pParents = NULL; mergePlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - mergePlan->msgType = TDMT_VND_QUERY; + mergePlan->msgType = TDMT_SCH_QUERY; merge->pNodeList = nodesMakeList(); scan->pNodeList = nodesMakeList(); @@ -181,7 +181,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { scanPlan[i].level = 1; scanPlan[i].pParents = nodesMakeList(); scanPlan[i].pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - scanPlan[i].msgType = TDMT_VND_QUERY; + scanPlan[i].msgType = TDMT_SCH_QUERY; nodesListAppend(scanPlan[i].pParents, (SNode*)mergePlan); nodesListAppend(mergePlan->pChildren, (SNode*)(scanPlan + i)); @@ -198,7 +198,7 @@ void schtBuildQueryFlowCtrlDag(SQueryPlan *dag) { mergePlan->pParents = NULL; mergePlan->pNode = (SPhysiNode*)taosMemoryCalloc(1, sizeof(SPhysiNode)); - mergePlan->msgType = TDMT_VND_QUERY; + mergePlan->msgType = TDMT_SCH_QUERY; nodesListAppend(merge->pNodeList, (SNode*)mergePlan); @@ -412,7 +412,7 @@ void *schtCreateFetchRspThread(void *param) { rsp->completed = 1; rsp->numOfRows = 10; - code = schHandleResponseMsg(pJob, pJob->fetchTask, TDMT_VND_FETCH_RSP, (char *)rsp, sizeof(*rsp), 0); + code = schHandleResponseMsg(pJob, pJob->fetchTask, TDMT_SCH_FETCH_RSP, (char *)rsp, sizeof(*rsp), 0); schReleaseJob(job); @@ -445,7 +445,7 @@ void *schtFetchRspThread(void *aa) { dataBuf.pData = rsp; dataBuf.len = sizeof(*rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_FETCH_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_FETCH_RSP, 0); assert(code == 0 || code); } @@ -547,7 +547,7 @@ void* schtRunJobThread(void *aa) { dataBuf.pData = &rsp; dataBuf.len = sizeof(rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_QUERY_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0); assert(code == 0 || code); pIter = taosHashIterate(execTasks, pIter); @@ -566,7 +566,7 @@ void* schtRunJobThread(void *aa) { dataBuf.pData = &rsp; dataBuf.len = sizeof(rsp); - code = schHandleCallback(param, &dataBuf, TDMT_VND_QUERY_RSP, 0); + code = schHandleCallback(param, &dataBuf, TDMT_SCH_QUERY_RSP, 0); assert(code == 0 || code); pIter = taosHashIterate(execTasks, pIter); @@ -677,7 +677,7 @@ TEST(queryTest, normalCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -688,7 +688,7 @@ TEST(queryTest, normalCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -780,7 +780,7 @@ TEST(queryTest, readyFirstCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -791,7 +791,7 @@ TEST(queryTest, readyFirstCase) { SSchTask *task = *(SSchTask **)pIter; SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); pIter = taosHashIterate(pJob->execTasks, pIter); @@ -896,9 +896,9 @@ TEST(queryTest, flowCtrlCase) { taosHashCancelIterate(pJob->execTasks, pIter); - if (task->lastMsgType == TDMT_VND_QUERY) { + if (task->lastMsgType == TDMT_SCH_QUERY) { SQueryTableRsp rsp = {0}; - code = schHandleResponseMsg(pJob, task, TDMT_VND_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); + code = schHandleResponseMsg(pJob, task, TDMT_SCH_QUERY_RSP, (char *)&rsp, sizeof(rsp), 0); ASSERT_EQ(code, 0); } else { diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2836bc2949..a239e6bbcb 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -329,7 +329,7 @@ void cliHandleResp(SCliConn* conn) { tDebug("%s conn %p construct ahandle %p by %s, persist: 1", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle, TMSG_INFO(transMsg.msgType)); if (!CONN_RELEASE_BY_SERVER(conn) && transMsg.info.ahandle == NULL) { - transMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + transMsg.code = TSDB_CODE_RPC_BROKEN_LINK; transMsg.info.ahandle = transCtxDumpBrokenlinkVal(&conn->ctx, (int32_t*)&(transMsg.msgType)); tDebug("%s conn %p construct ahandle %p due brokenlink, persist: 1", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle); @@ -400,7 +400,7 @@ void cliHandleExcept(SCliConn* pConn) { STransConnCtx* pCtx = pMsg ? pMsg->ctx : NULL; STransMsg transMsg = {0}; - transMsg.code = TSDB_CODE_RPC_NETWORK_UNAVAIL; + transMsg.code = pConn->broken ? TSDB_CODE_RPC_BROKEN_LINK : TSDB_CODE_RPC_NETWORK_UNAVAIL; transMsg.msgType = pMsg ? pMsg->msg.msgType + 1 : 0; transMsg.info.ahandle = NULL; @@ -607,9 +607,10 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { if (clear) { if (!uv_is_closing((uv_handle_t*)conn->stream)) { uv_close((uv_handle_t*)conn->stream, cliDestroy); - } else { - cliDestroy((uv_handle_t*)conn->stream); } + //} else { + // cliDestroy((uv_handle_t*)conn->stream); + //} } } static void cliDestroy(uv_handle_t* handle) { @@ -1023,19 +1024,28 @@ void cliCompareAndSwap(int8_t* val, int8_t exp, int8_t newVal) { } bool cliTryToExtractEpSet(STransMsg* pResp, SEpSet* dst) { - if (pResp == NULL || pResp->info.hasEpSet == 0) { + if ((pResp == NULL || pResp->info.hasEpSet == 0)) { + return false; + } + // rebuild resp msg + SEpSet epset; + if (tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epset) < 0) { return false; } - tDeserializeSEpSet(pResp->pCont, pResp->contLen, dst); int32_t tlen = tSerializeSEpSet(NULL, 0, dst); - int32_t bufLen = pResp->contLen - tlen; - char* buf = rpcMallocCont(bufLen); - - memcpy(buf, (char*)pResp->pCont + tlen, bufLen); + char* buf = NULL; + int32_t len = pResp->contLen - tlen; + if (len != 0) { + buf = rpcMallocCont(len); + memcpy(buf, (char*)pResp->pCont + tlen, len); + } + rpcFreeCont(pResp->pCont); pResp->pCont = buf; - pResp->contLen = bufLen; + pResp->contLen = len; + + *dst = epset; return true; } int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { @@ -1054,7 +1064,8 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { */ STransConnCtx* pCtx = pMsg->ctx; int32_t code = pResp->code; - if (pTransInst->retry != NULL && pTransInst->retry(code, pResp->msgType - 1)) { + bool retry = (pTransInst->retry != NULL && pTransInst->retry(code, pResp->msgType - 1)) ? true : false; + if (retry) { pMsg->sent = 0; pCtx->retryCnt += 1; if (code == TSDB_CODE_RPC_NETWORK_UNAVAIL) { @@ -1083,11 +1094,13 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { STraceId* trace = &pResp->info.traceId; - if (cliTryToExtractEpSet(pResp, &pCtx->epSet)) { + bool hasEpSet = cliTryToExtractEpSet(pResp, &pCtx->epSet); + if (hasEpSet) { char tbuf[256] = {0}; EPSET_DEBUG_STR(&pCtx->epSet, tbuf); tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn); } + if (pCtx->pSem != NULL) { tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn); if (pCtx->pRsp == NULL) { @@ -1099,10 +1112,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) { pCtx->pRsp = NULL; } else { tGTrace("%s conn %p handle resp", CONN_GET_INST_LABEL(pConn), pConn); - if (!cliIsEpsetUpdated(code, pCtx)) { - pTransInst->cfp(pTransInst->parent, pResp, NULL); - } else { + if (retry == false && hasEpSet == true) { pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet); + } else { + if (!cliIsEpsetUpdated(code, pCtx)) { + pTransInst->cfp(pTransInst->parent, pResp, NULL); + } else { + pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet); + } } } return 0; diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index dfc6de6442..d32156dd0d 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -140,7 +140,6 @@ static void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd); static void (*transAsyncHandle[])(SSvrMsg* msg, SWorkThrd* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease, uvHandleRegister, NULL}; - static void uvDestroyConn(uv_handle_t* handle); // server and worker thread @@ -777,9 +776,10 @@ static void destroyConn(SSvrConn* conn, bool clear) { if (!uv_is_closing((uv_handle_t*)conn->pTcp)) { tTrace("conn %p to be destroyed", conn); uv_close((uv_handle_t*)conn->pTcp, uvDestroyConn); - } else { - uvDestroyConn((uv_handle_t*)conn->pTcp); } + //} else { + // uvDestroyConn((uv_handle_t*)conn->pTcp); + //} } } static void destroyConnRegArg(SSvrConn* conn) { @@ -1116,4 +1116,6 @@ _return2: rpcFreeCont(msg->pCont); } +int transGetConnInfo(void* thandle, STransHandleInfo* pConnInfo) { return -1; } + #endif diff --git a/source/os/src/osMath.c b/source/os/src/osMath.c new file mode 100644 index 0000000000..98cd63a831 --- /dev/null +++ b/source/os/src/osMath.c @@ -0,0 +1,47 @@ +/* + * 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 . + */ + +#define ALLOW_FORBID_FUNC +#define _DEFAULT_SOURCE +#include "os.h" + +#ifdef WINDOWS +void swapStr(char* j, char* J, int width) { + int i; + char tmp; + for (i = 0; i < width; i++) { + tmp = *j; + *j = *J; + *J = tmp; + j++; + J++; + } +} +#endif + +void taosSort(void* arr, int64_t sz, int64_t width, __compar_fn_t compar) { +#ifdef WINDOWS + int64_t i, j; + for (i = 0; i < sz - 1; i++) { + for (j = 0; j < sz - 1 - i; j++) { + if (compar((char*)arr + j * width, (char*)arr + (j + 1) * width) > 0.00) { + swapStr((char*)arr + j * width, (char*)arr + (j + 1) * width, width); + } + } + } +#else + qsort(arr, sz, width, compar); +#endif +} diff --git a/source/util/src/tarray.c b/source/util/src/tarray.c index 257c1800f2..d16d0e610a 100644 --- a/source/util/src/tarray.c +++ b/source/util/src/tarray.c @@ -373,7 +373,7 @@ void taosArraySort(SArray* pArray, __compar_fn_t compar) { assert(pArray != NULL); assert(compar != NULL); - qsort(pArray->pData, pArray->size, pArray->elemSize, compar); + taosSort(pArray->pData, pArray->size, pArray->elemSize, compar); } void* taosArraySearch(const SArray* pArray, const void* key, __compar_fn_t comparFn, int32_t flags) { @@ -390,7 +390,7 @@ int32_t taosArraySearchIdx(const SArray* pArray, const void* key, __compar_fn_t void taosArraySortString(SArray* pArray, __compar_fn_t comparFn) { assert(pArray != NULL); - qsort(pArray->pData, pArray->size, pArray->elemSize, comparFn); + taosSort(pArray->pData, pArray->size, pArray->elemSize, comparFn); } char* taosArraySearchString(const SArray* pArray, const char* key, __compar_fn_t comparFn, int32_t flags) { diff --git a/source/util/src/tdigest.c b/source/util/src/tdigest.c index 56b113fd8f..a722cfeee2 100644 --- a/source/util/src/tdigest.c +++ b/source/util/src/tdigest.c @@ -124,7 +124,7 @@ void tdigestCompress(TDigest *t) { t->num_buffered_pts = 0; t->total_weight += unmerged_weight; - qsort(unmerged_centroids, num_unmerged, sizeof(SCentroid), cmpCentroid); + taosSort(unmerged_centroids, num_unmerged, sizeof(SCentroid), cmpCentroid); memset(&args, 0, sizeof(SMergeArgs)); args.centroids = (SCentroid*)taosMemoryMalloc((size_t)(sizeof(SCentroid) * t->size)); memset(args.centroids, 0, (size_t)(sizeof(SCentroid) * t->size)); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 96f0fb21ca..58de4970a0 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -89,8 +89,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_REF_NOT_EXIST, "Ref is not there") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_REDIRECT, "Redirect") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_AUTH_FAILURE, "Authentication failure") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_UNAVAIL, "Unable to establish connection") -TAOS_DEFINE_ERROR(TSDB_CODE_RPC_FQDN_ERROR, "Unable to resolve FQDN") TAOS_DEFINE_ERROR(TSDB_CODE_RPC_PORT_EADDRINUSE, "Port already in use") +TAOS_DEFINE_ERROR(TSDB_CODE_RPC_BROKEN_LINK, "Conn is broken") //client TAOS_DEFINE_ERROR(TSDB_CODE_TSC_INVALID_OPERATION, "Invalid operation") @@ -614,7 +614,7 @@ static int32_t taosCompareTaosError(const void* a, const void* b) { static TdThreadOnce tsErrorInit = PTHREAD_ONCE_INIT; static void tsSortError(void) { - qsort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError); + taosSort(errors, sizeof(errors) / sizeof(errors[0]), sizeof(errors[0]), taosCompareTaosError); } const char* tstrerror(int32_t err) { diff --git a/source/util/src/tlrucache.c b/source/util/src/tlrucache.c index b034a6e73e..28e15dc9a3 100644 --- a/source/util/src/tlrucache.c +++ b/source/util/src/tlrucache.c @@ -16,24 +16,24 @@ #define _DEFAULT_SOURCE #include "tlrucache.h" #include "os.h" -#include "tdef.h" #include "taoserror.h" -#include "tlog.h" #include "tarray.h" +#include "tdef.h" +#include "tlog.h" -typedef struct SLRUEntry SLRUEntry; +typedef struct SLRUEntry SLRUEntry; typedef struct SLRUEntryTable SLRUEntryTable; typedef struct SLRUCacheShard SLRUCacheShard; -typedef struct SShardedCache SShardedCache; +typedef struct SShardedCache SShardedCache; enum { - TAOS_LRU_IN_CACHE = (1 << 0), // Whether this entry is referenced by the hash table. + TAOS_LRU_IN_CACHE = (1 << 0), // Whether this entry is referenced by the hash table. - TAOS_LRU_IS_HIGH_PRI = (1 << 1), // Whether this entry is high priority entry. + TAOS_LRU_IS_HIGH_PRI = (1 << 1), // Whether this entry is high priority entry. - TAOS_LRU_IN_HIGH_PRI_POOL = (1 << 2), // Whether this entry is in high-pri pool. + TAOS_LRU_IN_HIGH_PRI_POOL = (1 << 2), // Whether this entry is in high-pri pool. - TAOS_LRU_HAS_HIT = (1 << 3), // Whether this entry has had any lookups (hits). + TAOS_LRU_HAS_HIT = (1 << 3), // Whether this entry has had any lookups (hits). }; struct SLRUEntry { @@ -50,18 +50,39 @@ struct SLRUEntry { char keyData[1]; }; -#define TAOS_LRU_ENTRY_IN_CACHE(h) ((h)->flags & TAOS_LRU_IN_CACHE) +#define TAOS_LRU_ENTRY_IN_CACHE(h) ((h)->flags & TAOS_LRU_IN_CACHE) #define TAOS_LRU_ENTRY_IN_HIGH_POOL(h) ((h)->flags & TAOS_LRU_IN_HIGH_PRI_POOL) -#define TAOS_LRU_ENTRY_IS_HIGH_PRI(h) ((h)->flags & TAOS_LRU_IS_HIGH_PRI) -#define TAOS_LRU_ENTRY_HAS_HIT(h) ((h)->flags & TAOS_LRU_HAS_HIT) +#define TAOS_LRU_ENTRY_IS_HIGH_PRI(h) ((h)->flags & TAOS_LRU_IS_HIGH_PRI) +#define TAOS_LRU_ENTRY_HAS_HIT(h) ((h)->flags & TAOS_LRU_HAS_HIT) -#define TAOS_LRU_ENTRY_SET_IN_CACHE(h, inCache) do { if(inCache) {(h)->flags |= TAOS_LRU_IN_CACHE;} else {(h)->flags &= ~TAOS_LRU_IN_CACHE;} } while(0) -#define TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(h, inHigh) do { if(inHigh) {(h)->flags |= TAOS_LRU_IN_HIGH_PRI_POOL;} else {(h)->flags &= ~TAOS_LRU_IN_HIGH_PRI_POOL;} } while(0) -#define TAOS_LRU_ENTRY_SET_PRIORITY(h, priority) do { if(priority == TAOS_LRU_PRIORITY_HIGH) {(h)->flags |= TAOS_LRU_IS_HIGH_PRI;} else {(h)->flags &= ~TAOS_LRU_IS_HIGH_PRI;} } while(0) +#define TAOS_LRU_ENTRY_SET_IN_CACHE(h, inCache) \ + do { \ + if (inCache) { \ + (h)->flags |= TAOS_LRU_IN_CACHE; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IN_CACHE; \ + } \ + } while (0) +#define TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(h, inHigh) \ + do { \ + if (inHigh) { \ + (h)->flags |= TAOS_LRU_IN_HIGH_PRI_POOL; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IN_HIGH_PRI_POOL; \ + } \ + } while (0) +#define TAOS_LRU_ENTRY_SET_PRIORITY(h, priority) \ + do { \ + if (priority == TAOS_LRU_PRIORITY_HIGH) { \ + (h)->flags |= TAOS_LRU_IS_HIGH_PRI; \ + } else { \ + (h)->flags &= ~TAOS_LRU_IS_HIGH_PRI; \ + } \ + } while (0) #define TAOS_LRU_ENTRY_SET_HIT(h) ((h)->flags |= TAOS_LRU_HAS_HIT) #define TAOS_LRU_ENTRY_HAS_REFS(h) ((h)->refs > 0) -#define TAOS_LRU_ENTRY_REF(h) (++(h)->refs) +#define TAOS_LRU_ENTRY_REF(h) (++(h)->refs) static bool taosLRUEntryUnref(SLRUEntry *entry) { assert(entry->refs > 0); @@ -90,7 +111,7 @@ struct SLRUEntryTable { static int taosLRUEntryTableInit(SLRUEntryTable *table, int maxUpperHashBits) { table->lengthBits = 4; - table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry*)); + table->list = taosMemoryCalloc(1 << table->lengthBits, sizeof(SLRUEntry *)); if (!table->list) { return -1; } @@ -125,7 +146,7 @@ static void taosLRUEntryTableCleanup(SLRUEntryTable *table) { taosMemoryFree(table->list); } -static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { SLRUEntry **entry = &table->list[hash >> (32 - table->lengthBits)]; while (*entry && ((*entry)->hash != hash || memcmp(key, (*entry)->keyData, keyLen) != 0)) { entry = &(*entry)->nextHash; @@ -134,7 +155,7 @@ static SLRUEntry **taosLRUEntryTableFindPtr(SLRUEntryTable * table, const void * return entry; } -static void taosLRUEntryTableResize(SLRUEntryTable * table) { +static void taosLRUEntryTableResize(SLRUEntryTable *table) { int lengthBits = table->lengthBits; if (lengthBits >= table->maxLengthBits) { return; @@ -144,9 +165,9 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { return; } - uint32_t oldLength = 1 << lengthBits; - int newLengthBits = lengthBits + 1; - SLRUEntry **newList = taosMemoryCalloc(1 << newLengthBits, sizeof(SLRUEntry*)); + uint32_t oldLength = 1 << lengthBits; + int newLengthBits = lengthBits + 1; + SLRUEntry **newList = taosMemoryCalloc(1 << newLengthBits, sizeof(SLRUEntry *)); if (!newList) { return; } @@ -154,8 +175,8 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { for (uint32_t i = 0; i < oldLength; ++i) { SLRUEntry *entry = table->list[i]; while (entry) { - SLRUEntry *next = entry->nextHash; - uint32_t hash = entry->hash; + SLRUEntry *next = entry->nextHash; + uint32_t hash = entry->hash; SLRUEntry **ptr = &newList[hash >> (32 - newLengthBits)]; entry->nextHash = *ptr; *ptr = entry; @@ -170,13 +191,13 @@ static void taosLRUEntryTableResize(SLRUEntryTable * table) { table->lengthBits = newLengthBits; } -static SLRUEntry *taosLRUEntryTableLookup(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry *taosLRUEntryTableLookup(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { return *taosLRUEntryTableFindPtr(table, key, keyLen, hash); } -static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable * table, SLRUEntry *entry) { +static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable *table, SLRUEntry *entry) { SLRUEntry **ptr = taosLRUEntryTableFindPtr(table, entry->keyData, entry->keyLength, entry->hash); - SLRUEntry *old = *ptr; + SLRUEntry *old = *ptr; entry->nextHash = (old == NULL) ? NULL : old->nextHash; *ptr = entry; if (old == NULL) { @@ -189,9 +210,9 @@ static SLRUEntry *taosLRUEntryTableInsert(SLRUEntryTable * table, SLRUEntry *ent return old; } -static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable * table, const void *key, size_t keyLen, uint32_t hash) { +static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable *table, const void *key, size_t keyLen, uint32_t hash) { SLRUEntry **entry = taosLRUEntryTableFindPtr(table, key, keyLen, hash); - SLRUEntry *result = *entry; + SLRUEntry *result = *entry; if (result) { *entry = result->nextHash; --table->elems; @@ -201,17 +222,17 @@ static SLRUEntry *taosLRUEntryTableRemove(SLRUEntryTable * table, const void *ke } struct SLRUCacheShard { - size_t capacity; - size_t highPriPoolUsage; - bool strictCapacity; - double highPriPoolRatio; - double highPriPoolCapacity; - SLRUEntry lru; - SLRUEntry *lruLowPri; - 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. - TdThreadMutex mutex; + size_t capacity; + size_t highPriPoolUsage; + bool strictCapacity; + double highPriPoolRatio; + double highPriPoolCapacity; + SLRUEntry lru; + SLRUEntry *lruLowPri; + 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. + TdThreadMutex mutex; }; #define TAOS_LRU_CACHE_SHARD_HASH32(key, len) (MurmurHash3_32((key), (len))) @@ -231,8 +252,7 @@ static void taosLRUCacheShardLRUInsert(SLRUCacheShard *shard, SLRUEntry *e) { assert(e->next == NULL); assert(e->prev == NULL); - if (shard->highPriPoolRatio > 0 - && (TAOS_LRU_ENTRY_IS_HIGH_PRI(e) || TAOS_LRU_ENTRY_HAS_HIT(e))) { + if (shard->highPriPoolRatio > 0 && (TAOS_LRU_ENTRY_IS_HIGH_PRI(e) || TAOS_LRU_ENTRY_HAS_HIT(e))) { e->next = &shard->lru; e->prev = shard->lru.prev; @@ -248,7 +268,7 @@ static void taosLRUCacheShardLRUInsert(SLRUCacheShard *shard, SLRUEntry *e) { e->prev->next = e; e->next->prev = e; - + TAOS_LRU_ENTRY_SET_IN_HIGH_POOL(e, false); shard->lruLowPri = e; } @@ -304,13 +324,13 @@ static void taosLRUCacheShardSetCapacity(SLRUCacheShard *shard, size_t capacity) for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); } -static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool strict, - double highPriPoolRatio, int maxUpperHashBits) { +static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool strict, double highPriPoolRatio, + int maxUpperHashBits) { if (taosLRUEntryTableInit(&shard->table, maxUpperHashBits) < 0) { return -1; } @@ -341,23 +361,24 @@ static void taosLRUCacheShardCleanup(SLRUCacheShard *shard) { taosLRUEntryTableCleanup(&shard->table); } -static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, bool freeOnFail) { +static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry *e, LRUHandle **handle, + bool freeOnFail) { LRUStatus status = TAOS_LRU_STATUS_OK; - SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); + SArray *lastReferenceList = taosArrayInit(16, POINTER_BYTES); taosThreadMutexLock(&shard->mutex); 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) { taosArrayPush(lastReferenceList, &e); } else { if (freeOnFail) { - taosMemoryFree(e); + taosMemoryFree(e); - *handle = NULL; + *handle = NULL; } status = TAOS_LRU_STATUS_INCOMPLETE; @@ -371,21 +392,21 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * assert(TAOS_LRU_ENTRY_IN_CACHE(old)); TAOS_LRU_ENTRY_SET_IN_CACHE(old, false); if (!TAOS_LRU_ENTRY_HAS_REFS(e)) { - taosLRUCacheShardLRURemove(shard, old); - assert(shard->usage >= old->totalCharge); - shard->usage -= old->totalCharge; + taosLRUCacheShardLRURemove(shard, old); + assert(shard->usage >= old->totalCharge); + shard->usage -= old->totalCharge; - taosArrayPush(lastReferenceList, &old); + taosArrayPush(lastReferenceList, &old); } } if (handle == NULL) { taosLRUCacheShardLRUInsert(shard, e); } else { if (!TAOS_LRU_ENTRY_HAS_REFS(e)) { - TAOS_LRU_ENTRY_REF(e); + TAOS_LRU_ENTRY_REF(e); } - *handle = (LRUHandle*) e; + *handle = (LRUHandle *)e; } } @@ -394,7 +415,7 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); @@ -402,8 +423,8 @@ static LRUStatus taosLRUCacheShardInsertEntry(SLRUCacheShard *shard, SLRUEntry * } static LRUStatus taosLRUCacheShardInsert(SLRUCacheShard *shard, const void *key, size_t keyLen, uint32_t hash, - void *value, size_t charge, _taos_lru_deleter_t deleter, - LRUHandle **handle, LRUPriority priority) { + void *value, size_t charge, _taos_lru_deleter_t deleter, LRUHandle **handle, + LRUPriority priority) { SLRUEntry *e = taosMemoryCalloc(1, sizeof(SLRUEntry) - 1 + keyLen); if (!e) { return TAOS_LRU_STATUS_FAIL; @@ -442,7 +463,7 @@ static LRUHandle *taosLRUCacheShardLookup(SLRUCacheShard *shard, const void *key taosThreadMutexUnlock(&shard->mutex); - return (LRUHandle *) e; + return (LRUHandle *)e; } static void taosLRUCacheShardErase(SLRUCacheShard *shard, const void *key, size_t keyLen, uint32_t hash) { @@ -482,7 +503,7 @@ static void taosLRUCacheShardEraseUnrefEntries(SLRUCacheShard *shard) { TAOS_LRU_ENTRY_SET_IN_CACHE(old, false); assert(shard->usage >= old->totalCharge); shard->usage -= old->totalCharge; - + taosArrayPush(lastReferenceList, &old); } @@ -491,14 +512,14 @@ static void taosLRUCacheShardEraseUnrefEntries(SLRUCacheShard *shard) { for (int i = 0; i < taosArrayGetSize(lastReferenceList); ++i) { SLRUEntry *entry = taosArrayGetP(lastReferenceList, i); - taosLRUEntryFree(entry); + taosLRUEntryFree(entry); } taosArrayDestroy(lastReferenceList); } static bool taosLRUCacheShardRef(SLRUCacheShard *shard, LRUHandle *handle) { - SLRUEntry *e = (SLRUEntry *) handle; + SLRUEntry *e = (SLRUEntry *)handle; taosThreadMutexLock(&shard->mutex); assert(TAOS_LRU_ENTRY_HAS_REFS(e)); @@ -514,8 +535,8 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b return false; } - SLRUEntry *e = (SLRUEntry *) handle; - bool lastReference = false; + SLRUEntry *e = (SLRUEntry *)handle; + bool lastReference = false; taosThreadMutexLock(&shard->mutex); @@ -537,7 +558,7 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b assert(shard->usage >= e->totalCharge); shard->usage -= e->totalCharge; } - + taosThreadMutexUnlock(&shard->mutex); if (lastReference) { @@ -549,7 +570,7 @@ static bool taosLRUCacheShardRelease(SLRUCacheShard *shard, LRUHandle *handle, b static size_t taosLRUCacheShardGetUsage(SLRUCacheShard *shard) { size_t usage = 0; - + taosThreadMutexLock(&shard->mutex); usage = shard->usage; taosThreadMutexUnlock(&shard->mutex); @@ -559,7 +580,7 @@ static size_t taosLRUCacheShardGetUsage(SLRUCacheShard *shard) { static size_t taosLRUCacheShardGetPinnedUsage(SLRUCacheShard *shard) { size_t usage = 0; - + taosThreadMutexLock(&shard->mutex); assert(shard->usage >= shard->lruUsage); @@ -579,11 +600,11 @@ static void taosLRUCacheShardSetStrictCapacity(SLRUCacheShard *shard, bool stric } struct SShardedCache { - uint32_t shardMask; - TdThreadMutex capacityMutex; - size_t capacity; - bool strictCapacity; - uint64_t lastId; // atomic var for last id + uint32_t shardMask; + TdThreadMutex capacityMutex; + size_t capacity; + bool strictCapacity; + uint64_t lastId; // atomic var for last id }; struct SLRUCache { @@ -593,7 +614,7 @@ struct SLRUCache { }; static int getDefaultCacheShardBits(size_t capacity) { - int numShardBits = 0; + int numShardBits = 0; size_t minShardSize = 512 * 1024; size_t numShards = capacity / minShardSize; while (numShards >>= 1) { @@ -621,7 +642,7 @@ SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoo numShardBits = getDefaultCacheShardBits(capacity); } - int numShards = 1 << numShardBits; + int numShards = 1 << numShardBits; cache->shards = taosMemoryCalloc(numShards, sizeof(SLRUCacheShard)); if (!cache->shards) { taosMemoryFree(cache); @@ -629,7 +650,7 @@ SLRUCache *taosLRUCacheInit(size_t capacity, int numShardBits, double highPriPoo return NULL; } - bool strictCapacity = 1; + bool strictCapacity = 1; size_t perShard = (capacity + (numShards - 1)) / numShards; for (int i = 0; i < numShards; ++i) { taosLRUCacheShardInit(&cache->shards[i], perShard, strictCapacity, highPriPoolRatio, 32 - numShardBits); @@ -653,7 +674,7 @@ void taosLRUCacheCleanup(SLRUCache *cache) { int numShards = cache->numShards; assert(numShards > 0); for (int i = 0; i < numShards; ++i) { - taosLRUCacheShardCleanup(&cache->shards[i]); + taosLRUCacheShardCleanup(&cache->shards[i]); } taosMemoryFree(cache->shards); cache->shards = 0; @@ -666,11 +687,12 @@ void taosLRUCacheCleanup(SLRUCache *cache) { } LRUStatus taosLRUCacheInsert(SLRUCache *cache, const void *key, size_t keyLen, void *value, size_t charge, - _taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority) { + _taos_lru_deleter_t deleter, LRUHandle **handle, LRUPriority priority) { uint32_t hash = TAOS_LRU_CACHE_SHARD_HASH32(key, keyLen); uint32_t shardIndex = hash & cache->shardedCache.shardMask; - return taosLRUCacheShardInsert(&cache->shards[shardIndex], key, keyLen, hash, value, charge, deleter, handle, priority); + return taosLRUCacheShardInsert(&cache->shards[shardIndex], key, keyLen, hash, value, charge, deleter, handle, + priority); } LRUHandle *taosLRUCacheLookup(SLRUCache *cache, const void *key, size_t keyLen) { @@ -699,7 +721,7 @@ bool taosLRUCacheRef(SLRUCache *cache, LRUHandle *handle) { return false; } - uint32_t hash = ((SLRUEntry *) handle)->hash; + uint32_t hash = ((SLRUEntry *)handle)->hash; uint32_t shardIndex = hash & cache->shardedCache.shardMask; return taosLRUCacheShardRef(&cache->shards[shardIndex], handle); @@ -710,15 +732,13 @@ bool taosLRUCacheRelease(SLRUCache *cache, LRUHandle *handle, bool eraseIfLastRe return false; } - uint32_t hash = ((SLRUEntry *) handle)->hash; + uint32_t hash = ((SLRUEntry *)handle)->hash; uint32_t shardIndex = hash & cache->shardedCache.shardMask; return taosLRUCacheShardRelease(&cache->shards[shardIndex], handle, eraseIfLastRef); } -void* taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle) { - return ((SLRUEntry*) handle)->value; -} +void *taosLRUCacheValue(SLRUCache *cache, LRUHandle *handle) { return ((SLRUEntry *)handle)->value; } size_t taosLRUCacheGetUsage(SLRUCache *cache) { size_t usage = 0; @@ -742,7 +762,7 @@ size_t taosLRUCacheGetPinnedUsage(SLRUCache *cache) { void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity) { uint32_t numShards = cache->numShards; - size_t perShard = (capacity + (numShards = 1)) / numShards; + size_t perShard = (capacity + (numShards - 1)) / numShards; taosThreadMutexLock(&cache->shardedCache.capacityMutex); @@ -751,7 +771,7 @@ void taosLRUCacheSetCapacity(SLRUCache *cache, size_t capacity) { } cache->shardedCache.capacity = capacity; - + taosThreadMutexUnlock(&cache->shardedCache.capacityMutex); } @@ -777,7 +797,7 @@ void taosLRUCacheSetStrictCapacity(SLRUCache *cache, bool strict) { } cache->shardedCache.strictCapacity = strict; - + taosThreadMutexUnlock(&cache->shardedCache.capacityMutex); } diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 6caf5624a4..6425e7acfa 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -17,6 +17,7 @@ import string import requests import time import socket +import json from .boundary import DataBoundary import taos from util.log import * @@ -25,7 +26,7 @@ from util.cases import * from util.dnodes import * from util.common import * -class TDCom: +class TDCom: def __init__(self): self.sml_type = None self.env_setting = None @@ -206,12 +207,12 @@ class TDCom: """ generate long name mode could be numbers/letters/letters_mixed/mixed - """ - if mode == "numbers": + """ + if mode == "numbers": chars = ''.join(random.choice(string.digits) for i in range(len)) - elif mode == "letters": + elif mode == "letters": chars = ''.join(random.choice(string.ascii_letters.lower()) for i in range(len)) - elif mode == "letters_mixed": + elif mode == "letters_mixed": chars = ''.join(random.choice(string.ascii_letters.upper() + string.ascii_letters.lower()) for i in range(len)) else: chars = ''.join(random.choice(string.ascii_letters.lower() + string.digits) for i in range(len)) @@ -276,7 +277,7 @@ class TDCom: vgroups replica precision strict wal fsync comp cachelast single_stable buffer pagesize pages minrows maxrows duration keep retentions ''' sqlString = f'create database if not exists {dbName} ' - + dbParams = "" if len(kwargs) > 0: for param, value in kwargs.items(): @@ -306,7 +307,7 @@ class TDCom: # return # def create_ctables(self,tsql, dbName,stbName,ctbNum,tagDict): - # tsql.execute("use %s" %dbName) + # tsql.execute("use %s" %dbName) # tagsValues = '' # for i in range(tagDict['int']): # if i > 0: @@ -323,7 +324,7 @@ class TDCom: # sql = pre_create # if sql != pre_create: # tsql.execute(sql) - + # tdLog.debug("complete to create %d child tables in %s.%s" %(ctbNum, dbName, stbName)) # return @@ -352,7 +353,7 @@ class TDCom: # tsql.execute(sql) # tdLog.debug("insert data ............ [OK]") # return - + def getBuildPath(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -367,7 +368,7 @@ class TDCom: if ("packaging" not in rootRealPath): buildPath = root[:len(root) - len("/build/bin")] break - return buildPath + return buildPath def getClientCfgPath(self): buildPath = self.getBuildPath() @@ -398,7 +399,7 @@ class TDCom: return newTdSql ################################################################################################################ - # port from the common.py of new test frame + # port from the common.py of new test frame ################################################################################################################ def gen_default_tag_str(self): default_tag_str = "" @@ -527,13 +528,14 @@ class TDCom: tag_value_list.append(self.gen_random_type_value(tag_elm["type"], "", "", "", "")) else: continue - return tag_value_list + return tag_value_list - def gen_column_value_list(self, column_elm_list, ts_value=None): + def gen_column_value_list(self, column_elm_list, ts_value=None): if ts_value is None: ts_value = self.genTs()[0] column_value_list = list() + column_value_list.append(ts_value) if column_elm_list is None: column_value_list = list(map(lambda i: self.gen_random_type_value(i, self.default_varchar_length, self.default_varchar_datatype, self.default_nchar_length, self.default_nchar_datatype), self.full_type_list)) else: @@ -550,11 +552,11 @@ class TDCom: column_value_list.append(self.gen_random_type_value(column_elm["type"], "", "", "", "")) else: continue - column_value_list = [self.ts_value] + self.column_value_list + # column_value_list = [self.ts_value] + self.column_value_list return column_value_list def create_stable(self, tsql, dbname=None, stbname="stb", column_elm_list=None, tag_elm_list=None, - count=1, default_stbname_prefix="stb", **kwargs): + count=1, default_stbname_prefix="stb", **kwargs): colname_prefix = 'c' tagname_prefix = 't' stbname_index_start_num = 1 @@ -589,20 +591,20 @@ class TDCom: tag_value_str += f'"{tag_value}", ' else: tag_value_str += f'{tag_value}, ' - tag_value_str = tag_value_str.rstrip()[:-1] - + tag_value_str = tag_value_str.rstrip()[:-1] + if int(count) <= 1: create_ctable_sql = f'create table {dbname}.{default_ctbname_prefix}{ctbname_index_start_num} using {dbname}.{stbname} tags ({tag_value_str}) {ctb_params};' tsql.execute(create_ctable_sql) else: for _ in range(count): create_ctable_sql = f'create table {dbname}.{default_ctbname_prefix}{ctbname_index_start_num} using {dbname}.{stbname} tags ({tag_value_str}) {ctb_params};' - ctbname_index_start_num += 1 + ctbname_index_start_num += 1 tdLog.info("create ctb sql: %s"%create_ctable_sql) tsql.execute(create_ctable_sql) - + def create_table(self, tsql, dbname=None, tbname="ntb", column_elm_list=None, count=1, **kwargs): - tbname_index_start_num = 1 + tbname_index_start_num = 1 tbname_prefix="ntb" tb_params = "" @@ -632,14 +634,23 @@ class TDCom: column_value_str += f'"{column_value}", ' else: column_value_str += f'{column_value}, ' - column_value_str = column_value_str.rstrip()[:-1] + column_value_str = column_value_str.rstrip()[:-1] if int(count) <= 1: insert_sql = f'insert into {self.tb_name} values ({column_value_str});' tsql.execute(insert_sql) else: for num in range(count): column_value_list = self.gen_column_value_list(column_ele_list, f'{start_ts_value}+{num}s') - column_value_str = ", ".join(str(v) for v in column_value_list) + # column_value_str = ", ".join(str(v) for v in column_value_list) + column_value_str = '' + idx = 0 + for column_value in column_value_list: + if isinstance(column_value, str) and idx != 0: + column_value_str += f'"{column_value}", ' + else: + column_value_str += f'{column_value}, ' + idx += 1 + column_value_str = column_value_str.rstrip()[:-1] insert_sql = f'insert into {dbname}.{tbname} values ({column_value_str});' tsql.execute(insert_sql) def getOneRow(self, location, containElm): @@ -651,4 +662,16 @@ class TDCom: return res_list else: tdLog.exit(f"getOneRow out of range: row_index={location} row_count={self.query_row}") + + +def is_json(msg): + if isinstance(msg, str): + try: + json.loads(msg) + return True + except: + return False + else: + return False + tdCom = TDCom() diff --git a/tests/pytest/util/constant.py b/tests/pytest/util/constant.py index 807398f70f..83487da023 100644 --- a/tests/pytest/util/constant.py +++ b/tests/pytest/util/constant.py @@ -71,6 +71,34 @@ TAOS_KEYWORDS = [ "COPY", "IF", "NOW", "STABLES", "WHERE", ] +NUM_FUNC = [ + "ABS", "ACOS", "ASIN", "ATAN", "CEIL", "COS", "FLOOR", "LOG", "POW", "ROUND", "SIN", "SQRT", "TAN", +] + +STR_FUNC = [ + "CHAR_LENGTH", "CONCAT", "CONCAT_WS", "LENGTH", "LOWER","LTRIM", "RTRIM", "SUBSTR", "UPPER", +] + +CONVER_FUNC = ["CASR", "TO_ISO8601", "TO_JSON", "TP_UNIXTIMESTAMP"] + +SELECT_FUNC = [ + "APERCENTILE", "BOTTOM", "FIRST", "INTERP", "LAST", "MAX", "MIN", "PERCENTILE", "TAIL", "TOP", "UNIQUE", +] + +AGG_FUNC = [ + "AVG", "COUNT", "ELAPSED", "LEASTSQUARES", "MODE", "SPREAD", "STDDEV", "SUM", "HYPERLOGLOG", "HISTOGRAM", +] + +TS_FUNC = [ + "CSUM", "DERIVATIVE", "DIFF", "IRATE", "MAVG", "SAMPLE", "STATECOUNT", "STATEDURATION", "TWA" +] + +SYSINFO_FUCN = [ + "DATABASE", "CLIENT_VERSION", "SERVER_VERSION", "SERVER_STATUS", "CURRENT_USER", "USER" +] + + + # basic data type boundary TINYINT_MAX = 127 TINYINT_MIN = -128 @@ -84,16 +112,16 @@ SMALLINT_MIN = -32768 SMALLINT_UN_MAX = 65535 SMALLINT_UN_MIN = 0 -INT_MAX = 2147483647 -INT_MIN = -2147483648 +INT_MAX = 2_147_483_647 +INT_MIN = -2_147_483_648 -INT_UN_MAX = 4294967295 +INT_UN_MAX = 4_294_967_295 INT_UN_MIN = 0 -BIGINT_MAX = 9223372036854775807 -BIGINT_MIN = -9223372036854775808 +BIGINT_MAX = 9_223_372_036_854_775_807 +BIGINT_MIN = -9_223_372_036_854_775_808 -BIGINT_UN_MAX = 18446744073709551615 +BIGINT_UN_MAX = 18_446_744_073_709_551_615 BIGINT_UN_MIN = 0 FLOAT_MAX = 3.40E+38 @@ -131,13 +159,13 @@ COL_COUNT_MIN = 2 TAG_COL_COUNT_MAX = 4096 TAG_COL_COUNT_MIN = 3 -MNODE_SHM_SIZE_MAX = 2147483647 -MNODE_SHM_SIZE_MIN = 6292480 -MNODE_SHM_SIZE_DEFAULT = 6292480 +MNODE_SHM_SIZE_MAX = 2_147_483_647 +MNODE_SHM_SIZE_MIN = 6_292_480 +MNODE_SHM_SIZE_DEFAULT = 6_292_480 -VNODE_SHM_SIZE_MAX = 2147483647 -VNODE_SHM_SIZE_MIN = 6292480 -VNODE_SHM_SIZE_DEFAULT = 31458304 +VNODE_SHM_SIZE_MAX = 2_147_483_647 +VNODE_SHM_SIZE_MIN = 6_292_480 +VNODE_SHM_SIZE_DEFAULT = 31_458_304 # time_init TIME_MS = 1 @@ -160,6 +188,7 @@ INTERVAL_MIN = 1 * TIME_MS if PRECISION == PRECISION_DEFAULT else 1 * TIME_US # streams and related agg-function SMA_INDEX_FUNCTIONS = ["MIN", "MAX"] ROLLUP_FUNCTIONS = ["AVG", "SUM", "MIN", "MAX", "LAST", "FIRST"] +BLOCK_FUNCTIONS = ["SUM", "MIN", "MAX"] SMA_WATMARK_MAXDELAY_INIT = ['a', "s", "m"] WATERMARK_MAX = 900000 WATERMARK_MIN = 0 diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index fe802dd9a3..585594e035 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -96,6 +96,15 @@ class TDSql: return self.queryResult return self.queryRows + def is_err_sql(self, sql): + err_flag = True + try: + self.cursor.execute(sql) + except BaseException: + err_flag = False + + return False if err_flag else True + def getVariable(self, search_attr): ''' get variable of search_attr access "show variables" @@ -249,7 +258,6 @@ class TDSql: raise Exception(repr(e)) return self.queryResult - def executeTimes(self, sql, times): for i in range(times): try: @@ -336,6 +344,38 @@ class TDSql: elif precision == "ns": return int(times*1000*1000) + def get_type(self, col): + if self.cursor.istype(col, "BOOL"): + return "BOOL" + if self.cursor.istype(col, "INT"): + return "INT" + if self.cursor.istype(col, "BIGINT"): + return "BIGINT" + if self.cursor.istype(col, "TINYINT"): + return "TINYINT" + if self.cursor.istype(col, "SMALLINT"): + return "SMALLINT" + if self.cursor.istype(col, "FLOAT"): + return "FLOAT" + if self.cursor.istype(col, "DOUBLE"): + return "DOUBLE" + if self.cursor.istype(col, "BINARY"): + return "BINARY" + if self.cursor.istype(col, "NCHAR"): + return "NCHAR" + if self.cursor.istype(col, "TIMESTAMP"): + return "TIMESTAMP" + if self.cursor.istype(col, "JSON"): + return "JSON" + if self.cursor.istype(col, "TINYINT UNSIGNED"): + return "TINYINT UNSIGNED" + if self.cursor.istype(col, "SMALLINT UNSIGNED"): + return "SMALLINT UNSIGNED" + if self.cursor.istype(col, "INT UNSIGNED"): + return "INT UNSIGNED" + if self.cursor.istype(col, "BIGINT UNSIGNED"): + return "BIGINT UNSIGNED" + def taosdStatus(self, state): tdLog.sleep(5) pstate = 0 diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 375b7a6272..40f803432a 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -32,7 +32,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -58,7 +58,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -68,7 +68,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -150,7 +150,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -175,14 +175,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -256,7 +256,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -281,7 +281,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -302,23 +302,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -328,9 +330,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -340,9 +342,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -350,7 +354,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -382,8 +386,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -401,7 +405,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -429,7 +433,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -452,7 +456,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -481,7 +485,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -525,7 +529,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -551,7 +555,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -575,8 +579,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -585,7 +589,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -596,19 +600,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -643,11 +647,11 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() @@ -659,7 +663,7 @@ class TDTestCase: time.sleep(2) self.basic_udf_query() self.test_function_name() - + def stop(self): tdSql.close() diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 5f3ab2e863..63650d6edc 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -34,7 +34,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -60,7 +60,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -70,7 +70,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -152,7 +152,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -177,14 +177,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -258,7 +258,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -283,7 +283,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -304,23 +304,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -330,9 +332,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -342,9 +344,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -352,7 +356,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -384,8 +388,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -403,7 +407,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -431,7 +435,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -454,7 +458,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -483,7 +487,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -527,7 +531,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -563,7 +567,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -587,8 +591,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -597,7 +601,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -608,19 +612,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -655,17 +659,17 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() self.basic_udf_query() self.unexpected_create() - + def stop(self): tdSql.close() diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index 857921e32c..c318980b67 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -31,7 +31,7 @@ class TDTestCase: buildPath = root[:len(root) - len("/build/bin")] break return buildPath - + def prepare_udf_so(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -57,7 +57,7 @@ class TDTestCase: def prepare_data(self): - + tdSql.execute("drop database if exists db ") tdSql.execute("create database if not exists db duration 300") tdSql.execute("use db") @@ -67,7 +67,7 @@ class TDTestCase: tags (t1 int) ''' ) - + tdSql.execute( ''' create table t1 @@ -149,7 +149,7 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: @@ -174,14 +174,14 @@ class TDTestCase: # create aggregate functions tdSql.execute("create aggregate function udf2 as '%s' outputtype double bufSize 8;"%self.libudf2) - + functions = tdSql.getResult("show functions") function_nums = len(functions) if function_nums == 2: tdLog.info("create two udf functions success ") - + def basic_udf_query(self): - + # scalar functions tdSql.execute("use db ") @@ -255,7 +255,7 @@ class TDTestCase: tdSql.checkData(0,1,165.247614504) tdSql.checkData(0,2,2551.470164435) tdSql.checkData(0,3,2.652476145) - + # # bug for crash when query sub table tdSql.query("select udf2(c1+100) ,udf2(c6-100) ,udf2(c1*100) ,udf2(c6/100) from ct1") tdSql.checkData(0,0,378.215547010) @@ -280,7 +280,7 @@ class TDTestCase: tdSql.error("select udf1(num1) , stddev(num1) from tb;") tdSql.error("select udf1(num1) , mode(num1) from tb;") tdSql.error("select udf1(num1) , HYPERLOGLOG(num1) from tb;") - # stable + # stable tdSql.error("select udf1(c1) , count(c1) from stb1;") tdSql.error("select udf1(c1) , avg(c1) from stb1;") tdSql.error("select udf1(c1) , twa(c1) from stb1;") @@ -301,23 +301,25 @@ class TDTestCase: tdSql.query("select ceil(num1) , min(num1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , first(num1) from tb;") - + tdSql.query("select abs(num1) , first(num1) from tb;") - + tdSql.query("select udf1(num1) , last(num1) from tb;") - + tdSql.query("select round(num1) , last(num1) from tb;") - + tdSql.query("select udf1(num1) , top(num1,1) from tb;") tdSql.checkRows(1) tdSql.query("select udf1(num1) , bottom(num1,1) from tb;") tdSql.checkRows(1) - tdSql.error("select udf1(num1) , last_row(num1) from tb;") - - tdSql.error("select round(num1) , last_row(num1) from tb;") - - - # stable + tdSql.query("select udf1(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + tdSql.query("select round(num1) , last_row(num1) from tb;") + tdSql.checkRows(1) + + + # stable tdSql.query("select udf1(c1) , max(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , max(c1) from stb1;") @@ -327,9 +329,9 @@ class TDTestCase: tdSql.query("select floor(c1) , min(c1) from stb1;") tdSql.checkRows(1) tdSql.query("select udf1(c1) , first(c1) from stb1;") - + tdSql.query("select udf1(c1) , last(c1) from stb1;") - + tdSql.query("select udf1(c1) , top(c1 ,1) from stb1;") tdSql.checkRows(1) tdSql.query("select abs(c1) , top(c1 ,1) from stb1;") @@ -339,9 +341,11 @@ class TDTestCase: tdSql.query("select ceil(c1) , bottom(c1,1) from stb1;") tdSql.checkRows(1) - tdSql.error("select udf1(c1) , last_row(c1) from stb1;") - tdSql.error("select ceil(c1) , last_row(c1) from stb1;") - + tdSql.query("select udf1(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + tdSql.query("select ceil(c1) , last_row(c1) from stb1;") + tdSql.checkRows(1) + # regular table with compute functions tdSql.query("select udf1(num1) , abs(num1) from tb;") @@ -349,7 +353,7 @@ class TDTestCase: tdSql.query("select floor(num1) , abs(num1) from tb;") tdSql.checkRows(12) - # # bug need fix + # # bug need fix #tdSql.query("select udf1(num1) , csum(num1) from tb;") #tdSql.checkRows(9) @@ -381,8 +385,8 @@ class TDTestCase: tdSql.checkData(1,0,88) tdSql.checkData(1,1,7) - # bug fix for crash - # order by udf function result + # bug fix for crash + # order by udf function result for _ in range(50): tdSql.query("select udf2(c1) from stb1 group by 1-udf1(c1)") print(tdSql.queryResult) @@ -400,7 +404,7 @@ class TDTestCase: tdSql.checkData(0,1,88) tdSql.checkData(0,2,-99.990000000) tdSql.checkData(0,3,88) - + tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) @@ -428,7 +432,7 @@ class TDTestCase: tdSql.checkData(0,1,168.819430161) tdSql.error("select sub1.c1 , udf2(sub1.c1), sub2.c2 ,udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - # udf functions with group by + # udf functions with group by tdSql.query("select udf1(c1) from ct1 group by c1") tdSql.checkRows(10) tdSql.query("select udf1(c1) from stb1 group by c1") @@ -451,7 +455,7 @@ class TDTestCase: tdSql.query("select udf2(c1) from stb1 group by floor(c1)") tdSql.checkRows(11) - # udf mix with order by + # udf mix with order by tdSql.query("select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)") tdSql.checkRows(11) @@ -480,7 +484,7 @@ class TDTestCase: tdSql.checkData(0,1,169.661427555) def try_query_sql(self): - udf1_sqls = [ + udf1_sqls = [ "select num1 , udf1(num1) ,num2 ,udf1(num2),num3 ,udf1(num3),num4 ,udf1(num4) from tb" , "select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1" , "select udf1(num1) , max(num1) from tb;" , @@ -507,7 +511,7 @@ class TDTestCase: "select c1,c2, udf1(c1,c2) from stb1 group by c1,c2" , "select num1,num2,num3,udf1(num1,num2,num3) from tb" , "select c1,c6,udf1(c1,c6) from stb1 order by ts" , - "select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;" + "select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;" ] udf2_sqls = ["select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(c1) from stb1 group by 1-udf1(c1)" , @@ -524,7 +528,7 @@ class TDTestCase: "select udf2(c1) from stb1 group by udf1(c1)" , "select udf2(c1) from stb1 group by floor(c1)" , "select udf2(c1) from stb1 group by floor(c1) order by udf2(c1)" , - + "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , "select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null" , @@ -550,7 +554,7 @@ class TDTestCase: for aggregate_sql in udf2_sqls: tdSql.error(aggregate_sql) - # create function without aggregate + # create function without aggregate tdLog.info(" create function with out aggregate ") tdSql.query("drop function udf1 ") @@ -574,8 +578,8 @@ class TDTestCase: tdSql.error(" select test(c1) from stb1 ") tdSql.error(" select test(c1,c6), test(c6) from stb1 ") tdSql.error(" select test(num1,num2), test(num1) from tb ") - - + + def loop_kill_udfd(self): @@ -584,7 +588,7 @@ class TDTestCase: tdLog.exit("taosd not found!") else: tdLog.info("taosd found in %s" % buildPath) - + cfgPath = buildPath + "/../sim/dnode1/cfg" udfdPath = buildPath +'/build/bin/udfd' @@ -595,19 +599,19 @@ class TDTestCase: tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # stop udfd cmds + # stop udfd cmds get_processID = "ps -ef | grep -w udfd | grep -v grep| grep -v defunct | awk '{print $2}'" processID = subprocess.check_output(get_processID, shell=True).decode("utf-8") stop_udfd = " kill -9 %s" % processID os.system(stop_udfd) time.sleep(2) - + tdSql.query("select udf2(sub1.c1 ,sub1.c2), udf2(sub2.c2 ,sub2.c1) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,169.661427555) tdSql.checkData(0,1,169.661427555) - # # start udfd cmds + # # start udfd cmds # start_udfd = "nohup " + udfdPath +'-c' +cfgPath +" > /dev/null 2>&1 &" # tdLog.info("start udfd : %s " % start_udfd) @@ -640,19 +644,19 @@ class TDTestCase: tdDnodes.stop(1) tdDnodes.start(1) time.sleep(2) - - + + def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring - - print(" env is ok for all ") + + print(" env is ok for all ") self.prepare_udf_so() self.prepare_data() self.create_udf_function() self.basic_udf_query() self.multi_cols_udf() self.restart_taosd_query_udf() - - + + def stop(self): tdSql.close() diff --git a/tests/system-test/1-insert/test_stmt_insert_query_ex.py b/tests/system-test/1-insert/test_stmt_insert_query_ex.py index 6d49f6065a..2a66df866d 100644 --- a/tests/system-test/1-insert/test_stmt_insert_query_ex.py +++ b/tests/system-test/1-insert/test_stmt_insert_query_ex.py @@ -184,17 +184,17 @@ class TDTestCase: #query: string Functions - querystmt3=conn.statement("select CHAR_LENGTH(?) from log ") - queryparam3=new_bind_params(1) - print(type(queryparam3)) - queryparam3[0].binary('中文字符') - querystmt3.bind_param(queryparam3) - querystmt3.execute() - result3=querystmt3.use_result() - rows3=result3.fetch_all() - print("4",rows3) - assert rows3[0][0] == 12, 'fourth case is failed' - assert rows3[1][0] == 12, 'fourth case is failed' + querystmt9=conn.statement("select CHAR_LENGTH(?) from log ") + queryparam9=new_bind_params(1) + print(type(queryparam9)) + queryparam9[0].binary('中文字符') + querystmt9.bind_param(queryparam9) + querystmt9.execute() + result9=querystmt9.use_result() + rows9=result9.fetch_all() + print("9",rows9) + assert rows9[0][0] == 12, 'fourth case is failed' + assert rows9[1][0] == 12, 'fourth case is failed' # #query: conversion Functions @@ -259,4 +259,4 @@ class TDTestCase: # add case with filename # tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/2-query/explain.py b/tests/system-test/2-query/explain.py index d440144841..f2c6cb7771 100644 --- a/tests/system-test/2-query/explain.py +++ b/tests/system-test/2-query/explain.py @@ -163,38 +163,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def explain_check(self): sqls = self.sql_list() tdLog.printNoPrefix("===step 1: curent case, must return query OK") diff --git a/tests/system-test/2-query/hyperloglog.py b/tests/system-test/2-query/hyperloglog.py index 8dd6bd2dda..6ab971173a 100644 --- a/tests/system-test/2-query/hyperloglog.py +++ b/tests/system-test/2-query/hyperloglog.py @@ -116,37 +116,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" def hyperloglog_check(self): sqls = self.sql_list() @@ -228,10 +197,10 @@ class TDTestCase: tag_sql += f"{k} {v}," tdSql.execute(f'create table if not exists {stbname} ({column_sql[:-1]}) tags({tag_sql[:-1]})') - def __insert_data(self): + def __insert_data(self): pass - + def __hyperloglog_check_distribute(self): dbname = "dbtest" stbname = "stb" @@ -286,7 +255,7 @@ class TDTestCase: tdSql.query(f"select hyperloglog({k}) from {stbname} group by {k}") tdSql.execute(f'drop database {dbname}') - + def __insert_data(self, rows): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) diff --git a/tests/system-test/2-query/leastsquares.py b/tests/system-test/2-query/leastsquares.py index e8fa32e8b3..3bab509942 100644 --- a/tests/system-test/2-query/leastsquares.py +++ b/tests/system-test/2-query/leastsquares.py @@ -195,38 +195,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, current_sqls)), list(filter(None, err_sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def leastsquares_check(self): current_sqls, err_sqls = self.sql_list() for i in range(len(err_sqls)): diff --git a/tests/system-test/2-query/spread.py b/tests/system-test/2-query/spread.py index d2dbbd03ed..51c569e565 100644 --- a/tests/system-test/2-query/spread.py +++ b/tests/system-test/2-query/spread.py @@ -159,38 +159,6 @@ class TDTestCase: # return filter(None, sqls) return list(filter(None, sqls)) - def __get_type(self, col): - if tdSql.cursor.istype(col, "BOOL"): - return "BOOL" - if tdSql.cursor.istype(col, "INT"): - return "INT" - if tdSql.cursor.istype(col, "BIGINT"): - return "BIGINT" - if tdSql.cursor.istype(col, "TINYINT"): - return "TINYINT" - if tdSql.cursor.istype(col, "SMALLINT"): - return "SMALLINT" - if tdSql.cursor.istype(col, "FLOAT"): - return "FLOAT" - if tdSql.cursor.istype(col, "DOUBLE"): - return "DOUBLE" - if tdSql.cursor.istype(col, "BINARY"): - return "BINARY" - if tdSql.cursor.istype(col, "NCHAR"): - return "NCHAR" - if tdSql.cursor.istype(col, "TIMESTAMP"): - return "TIMESTAMP" - if tdSql.cursor.istype(col, "JSON"): - return "JSON" - if tdSql.cursor.istype(col, "TINYINT UNSIGNED"): - return "TINYINT UNSIGNED" - if tdSql.cursor.istype(col, "SMALLINT UNSIGNED"): - return "SMALLINT UNSIGNED" - if tdSql.cursor.istype(col, "INT UNSIGNED"): - return "INT UNSIGNED" - if tdSql.cursor.istype(col, "BIGINT UNSIGNED"): - return "BIGINT UNSIGNED" - def spread_check(self): sqls = self.sql_list() tdLog.printNoPrefix("===step 1: curent case, must return query OK") diff --git a/tests/system-test/2-query/stateduration.py b/tests/system-test/2-query/stateduration.py index fa71009ef2..23169553dc 100644 --- a/tests/system-test/2-query/stateduration.py +++ b/tests/system-test/2-query/stateduration.py @@ -38,15 +38,15 @@ class TDTestCase: tdSql.query(f"select stateduration(col{i},'{j}',5) from test") tdSql.checkRows(10) if j in ['LT' ,'lt','Lt','lT']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in ['GT','gt', 'Gt','gT']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)]) elif j in ['LE','le','Le','lE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in [ 'GE','ge','Ge','gE']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,), (0,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)]) elif j in ['NE','ne','Ne','nE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (-1,), (0,), (0,), (0,), (0,), (0,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)]) elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: @@ -54,11 +54,11 @@ class TDTestCase: tdSql.query(f"select stateduration(col{i},'{j}',5) from test") tdSql.checkRows(10) if j in ['LT','lt','Lt','lT','LE','le','Le','lE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (0,), (0,), (0,), (0,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)]) elif j in ['NE','ne','Ne','nE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,), (0,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)]) elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) @@ -66,34 +66,34 @@ class TDTestCase: for i in error_column_list: for j in self.param_list: tdSql.error(f"select stateduration({i},{j},5) from test") - + error_param_list = ['a',1] for i in error_param_list: tdSql.error(f"select stateduration(col1,{i},5) from test") - + # timestamp = 1s, time_unit =1s tdSql.execute('''create table test1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') for i in range(self.row_num): tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - + for i in integer_list: for j in self.param_list: tdSql.query(f"select stateduration(col{i},'{j}',5) from test1") tdSql.checkRows(10) # print(tdSql.queryResult) if j in ['LT' ,'lt','Lt','lT']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1000,), (2000,), (3000,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in ['GT','gt', 'Gt','gT']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1000,), (2000,), (3000,), (4000,)]) elif j in ['LE','le','Le','lE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1000,), (2000,), (3000,), (4000,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in [ 'GE','ge','Ge','gE']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1000,), (2000,), (3000,), (4000,), (5000,)]) elif j in ['NE','ne','Ne','nE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)]) - elif j in ['EQ','eq','Eq','eQ']: + tdSql.checkEqual(tdSql.queryResult,[(0,), (1000,), (2000,), (3000,), (-1,), (0,), (1000,), (2000,), (3000,), (4000,)]) + elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: for j in self.param_list: @@ -101,22 +101,22 @@ class TDTestCase: tdSql.checkRows(10) print(tdSql.queryResult) if j in ['LT','lt','Lt','lT','LE','le','Le','lE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (-1,), (-1,), (-1,), (-1,), (-1,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1000,), (2000,), (3000,), (4000,), (-1,), (-1,), (-1,), (-1,), (-1,)]) elif j in ['GE','ge','Ge','gE','GT','gt','Gt','gT']: - tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,)]) + tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (0,), (1000,), (2000,), (3000,), (4000,)]) elif j in ['NE','ne','Ne','nE']: - tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)]) + tdSql.checkEqual(tdSql.queryResult,[(0,), (1000,), (2000,), (3000,), (4000,), (5000,), (6000,), (7000,), (8000,), (9000,)]) elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) # timestamp = 1m, time_unit =1m - tdSql.execute('''create table test2(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + tdSql.execute('''create table test2(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') for i in range(self.row_num): - tdSql.execute("insert into test2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute("insert into test2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i*1000*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - + for i in integer_list: for j in self.param_list: tdSql.query(f"select stateduration(col{i},'{j}',5,1m) from test2") @@ -132,7 +132,7 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)]) elif j in ['NE','ne','Ne','nE']: tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)]) - elif j in ['EQ','eq','Eq','eQ']: + elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: for j in self.param_list: @@ -147,14 +147,14 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)]) elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) - + # timestamp = 1h, time_unit =1h - tdSql.execute('''create table test3(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + tdSql.execute('''create table test3(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned)''') for i in range(self.row_num): - tdSql.execute("insert into test3 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute("insert into test3 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i*1000*60*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - + for i in integer_list: for j in self.param_list: tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from test3") @@ -170,7 +170,7 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)]) elif j in ['NE','ne','Ne','nE']: tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)]) - elif j in ['EQ','eq','Eq','eQ']: + elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: for j in self.param_list: @@ -202,7 +202,7 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (60,), (120,), (180,), (240,), (300,)]) elif j in ['NE','ne','Ne','nE']: tdSql.checkEqual(tdSql.queryResult,[(0,), (60,), (120,), (180,), (-1,), (0,), (60,), (120,), (180,), (240,)]) - elif j in ['EQ','eq','Eq','eQ']: + elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: for j in self.param_list: @@ -219,13 +219,13 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) # for stb - tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(t0 int)''') tdSql.execute('create table stb_1 using stb tags(1)') for i in range(self.row_num): - tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i*1000*60*60, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1)) - + for i in integer_list: for j in self.param_list: tdSql.query(f"select stateduration(col{i},'{j}',5,1h) from stb") @@ -241,7 +241,7 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (1,), (2,), (3,), (4,), (5,)]) elif j in ['NE','ne','Ne','nE']: tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (-1,), (0,), (1,), (2,), (3,), (4,)]) - elif j in ['EQ','eq','Eq','eQ']: + elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (0,), (-1,), (-1,), (-1,), (-1,), (-1,)]) for i in float_list: for j in self.param_list: @@ -256,10 +256,10 @@ class TDTestCase: tdSql.checkEqual(tdSql.queryResult,[(0,), (1,), (2,), (3,), (4,), (5,), (6,), (7,), (8,), (9,)]) elif j in ['EQ','eq','Eq','eQ']: tdSql.checkEqual(tdSql.queryResult,[(-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,), (-1,)]) - + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) tdCases.addWindows(__file__, TDTestCase()) -tdCases.addLinux(__file__, TDTestCase()) \ No newline at end of file +tdCases.addLinux(__file__, TDTestCase()) diff --git a/tests/system-test/6-cluster/5dnode2mnode.py b/tests/system-test/6-cluster/5dnode2mnode.py index e08e738be6..509e535f01 100644 --- a/tests/system-test/6-cluster/5dnode2mnode.py +++ b/tests/system-test/6-cluster/5dnode2mnode.py @@ -9,28 +9,22 @@ from util.sql import * from util.cases import * from util.dnodes import TDDnodes from util.dnodes import TDDnode +from util.cluster import * + import time import socket import subprocess +sys.path.append("./6-cluster") -class MyDnodes(TDDnodes): - def __init__(self ,dnodes_lists): - super(MyDnodes,self).__init__() - self.dnodes = dnodes_lists # dnode must be TDDnode instance - self.simDeployed = False - +from clusterCommonCreate import * +from clusterCommonCheck import * + class TDTestCase: - noConn = True - def init(self,conn ,logSql): tdLog.debug(f"start to excute {__file__}") - self.TDDnodes = None - self.depoly_cluster(5) - self.master_dnode = self.TDDnodes.dnodes[0] - self.host=self.master_dnode.cfgDict["fqdn"] - conn1 = taos.connect(self.master_dnode.cfgDict["fqdn"] , config=self.master_dnode.cfgDir) - tdSql.init(conn1.cursor()) - + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + def getBuildPath(self): selfPath = os.path.dirname(os.path.realpath(__file__)) @@ -41,90 +35,12 @@ class TDTestCase: projPath = selfPath[:selfPath.find("tests")] for root, dirs, files in os.walk(projPath): - if ("taosd" in files or "taosd.exe" in files): + if ("taosd" in files): rootRealPath = os.path.dirname(os.path.realpath(root)) if ("packaging" not in rootRealPath): buildPath = root[:len(root) - len("/build/bin")] break return buildPath - - - def depoly_cluster(self ,dnodes_nums): - - testCluster = False - valgrind = 0 - hostname = socket.gethostname() - dnodes = [] - start_port = 6030 - start_port_sec = 6130 - - for num in range(1, dnodes_nums+1): - dnode = TDDnode(num) - dnode.addExtraCfg("firstEp", f"{hostname}:{start_port}") - dnode.addExtraCfg("fqdn", f"{hostname}") - dnode.addExtraCfg("serverPort", f"{start_port + (num-1)*100}") - dnode.addExtraCfg("monitorFqdn", hostname) - dnode.addExtraCfg("monitorPort", 7043) - dnode.addExtraCfg("secondEp", f"{hostname}:{start_port_sec}") - - dnodes.append(dnode) - - self.TDDnodes = MyDnodes(dnodes) - self.TDDnodes.init("") - self.TDDnodes.setTestCluster(testCluster) - self.TDDnodes.setValgrind(valgrind) - self.TDDnodes.stopAll() - for dnode in self.TDDnodes.dnodes: - self.TDDnodes.deploy(dnode.index,{}) - - for dnode in self.TDDnodes.dnodes: - self.TDDnodes.starttaosd(dnode.index) - - # create cluster - for dnode in self.TDDnodes.dnodes[1:]: - # print(dnode.cfgDict) - dnode_id = dnode.cfgDict["fqdn"] + ":" +dnode.cfgDict["serverPort"] - dnode_first_host = dnode.cfgDict["firstEp"].split(":")[0] - dnode_first_port = dnode.cfgDict["firstEp"].split(":")[-1] - cmd = f"{self.getBuildPath()}/build/bin/taos -h {dnode_first_host} -P {dnode_first_port} -s \"create dnode \\\"{dnode_id}\\\"\"" - print(cmd) - os.system(cmd) - - time.sleep(2) - tdLog.info(" create cluster done! ") - - def five_dnode_one_mnode(self): - tdSql.query("show dnodes;") - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(4,1,'%s:6430'%self.host) - tdSql.checkData(0,4,'ready') - tdSql.checkData(4,4,'ready') - tdSql.query("show mnodes;") - tdSql.checkData(0,1,'%s:6030'%self.host) - tdSql.checkData(0,2,'leader') - tdSql.checkData(0,3,'ready') - - - tdSql.error("create mnode on dnode 1;") - 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("use db") - tdSql.execute( - '''create table stb1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - tags (t1 int) - ''' - ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) - for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') def five_dnode_two_mnode(self): tdSql.query("show dnodes;") @@ -187,6 +103,34 @@ class TDTestCase: tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") print(tdSql.queryResult) + clusterComCheck.checkDnodes(5) + # restart all taosd + tdDnodes=cluster.dnodes + + # stop follower + tdLog.info("stop follower") + tdDnodes[1].stoptaosd() + if cluster.checkConnectStatus(0) : + print("cluster also work") + + # start follower + tdLog.info("start follower") + tdDnodes[1].starttaosd() + if clusterComCheck.checkMnodeStatus(2) : + print("both mnodes are ready") + + # stop leader + tdLog.info("stop leader") + tdDnodes[0].stoptaosd() + try: + cluster.checkConnectStatus(2) + tdLog.exit(" The election still succeeds when leader of both mnodes are killed ") + except Exception: + pass + tdLog.info("start leader") + tdDnodes[0].starttaosd() + if clusterComCheck.checkMnodeStatus(2) : + print("both mnodes are ready") # # fisrt drop follower of mnode # BUG @@ -229,8 +173,6 @@ class TDTestCase: def run(self): - print(self.master_dnode.cfgDict) - self.five_dnode_one_mnode() self.five_dnode_two_mnode() diff --git a/tests/system-test/6-cluster/5dnode3mnodeStop.py b/tests/system-test/6-cluster/5dnode3mnodeStop.py index 1b55176e1d..f932e5537e 100644 --- a/tests/system-test/6-cluster/5dnode3mnodeStop.py +++ b/tests/system-test/6-cluster/5dnode3mnodeStop.py @@ -88,7 +88,7 @@ class TDTestCase: tdLog.info("Confirm the status of the dnode again") tdSql.error("create mnode on dnode 2") tdSql.query("show dnodes;") - print(tdSql.queryResult) + # print(tdSql.queryResult) clusterComCheck.checkDnodes(dnodenumbers) # restart all taosd tdDnodes=cluster.dnodes @@ -108,18 +108,6 @@ class TDTestCase: tdDnodes[0].starttaosd() clusterComCheck.checkMnodeStatus(3) - tdLog.info("Take turns stopping all dnodes ") - # seperate vnode and mnode in different dnodes. - # create database and stable - stopcount =0 - while stopcount <= 2: - tdLog.info("first restart loop") - for i in range(dnodenumbers): - tdDnodes[i].stoptaosd() - tdDnodes[i].starttaosd() - stopcount+=1 - clusterComCheck.checkDnodes(dnodenumbers) - clusterComCheck.checkMnodeStatus(3) def run(self): # print(self.master_dnode.cfgDict) diff --git a/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py b/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py new file mode 100644 index 0000000000..e0c91e5ac4 --- /dev/null +++ b/tests/system-test/6-cluster/5dnode3mnodeStopLoop.py @@ -0,0 +1,118 @@ +from ssl import ALERT_DESCRIPTION_CERTIFICATE_UNOBTAINABLE +import taos +import sys +import time +import os + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.dnodes import TDDnodes +from util.dnodes import TDDnode +from util.cluster import * +from test import tdDnodes +sys.path.append("./6-cluster") + +from clusterCommonCreate import * +from clusterCommonCheck import * +import time +import socket +import subprocess +from multiprocessing import Process + + +class TDTestCase: + + def init(self,conn ,logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + self.host = socket.gethostname() + + + def getBuildPath(self): + selfPath = os.path.dirname(os.path.realpath(__file__)) + + if ("community" in selfPath): + projPath = selfPath[:selfPath.find("community")] + else: + projPath = selfPath[:selfPath.find("tests")] + + for root, dirs, files in os.walk(projPath): + if ("taosd" in files): + rootRealPath = os.path.dirname(os.path.realpath(root)) + if ("packaging" not in rootRealPath): + buildPath = root[:len(root) - len("/build/bin")] + break + return buildPath + + def fiveDnodeThreeMnode(self,dnodenumbers,mnodeNums,restartNumber): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'db', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'replica': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + dnodenumbers=int(dnodenumbers) + mnodeNums=int(mnodeNums) + dbNumbers = int(dnodenumbers * restartNumber) + + tdLog.info("first check dnode and mnode") + tdSql.query("show dnodes;") + tdSql.checkData(0,1,'%s:6030'%self.host) + tdSql.checkData(4,1,'%s:6430'%self.host) + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(1) + + # fisr add three mnodes; + tdLog.info("fisr add three mnodes and check mnode status") + tdSql.execute("create mnode on dnode 2") + clusterComCheck.checkMnodeStatus(2) + tdSql.execute("create mnode on dnode 3") + clusterComCheck.checkMnodeStatus(3) + + # add some error operations and + tdLog.info("Confirm the status of the dnode again") + tdSql.error("create mnode on dnode 2") + tdSql.query("show dnodes;") + # print(tdSql.queryResult) + clusterComCheck.checkDnodes(dnodenumbers) + # restart all taosd + tdDnodes=cluster.dnodes + + tdLog.info("Take turns stopping all dnodes ") + # seperate vnode and mnode in different dnodes. + # create database and stable + stopcount =0 + while stopcount <= 2: + tdLog.info(" restart loop: %d"%stopcount ) + for i in range(dnodenumbers): + tdDnodes[i].stoptaosd() + tdDnodes[i].starttaosd() + stopcount+=1 + clusterComCheck.checkDnodes(dnodenumbers) + clusterComCheck.checkMnodeStatus(3) + + def run(self): + # print(self.master_dnode.cfgDict) + self.fiveDnodeThreeMnode(5,3,1) + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/subscribeDb4.py b/tests/system-test/7-tmq/subscribeDb4.py index de475803fe..b99704b602 100644 --- a/tests/system-test/7-tmq/subscribeDb4.py +++ b/tests/system-test/7-tmq/subscribeDb4.py @@ -14,19 +14,24 @@ sys.path.append("./7-tmq") from tmqCommon import * class TDTestCase: - paraDict = {'dbName': 'db12', - 'dropFlag':1, - 'vgroups': 4, - 'precision': 'ms', - 'stbName': 'stb0', - 'ctbNum': 10, + paraDict = {'dbName': 'db12', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb0', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':16, 'count':1}, {'type': 'timestamp','count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 10, 'rowsPerTbl': 10000, - 'batchNum': 10, - 'startTs': 0, # 1640966400000 ----> 2022-01-01 00:00:00.000 - 'event':'', - 'columnDict': {'int':2}, - 'tagDict': {'int':1} - } + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 20, + 'showMsg': 1, + 'showRow': 1} cdbName = 'cdb' # some parameter to consumer processor @@ -57,17 +62,18 @@ class TDTestCase: tmqCom.initConsumerTable(self.cdbName) - tdCom.create_database(tdSql,self.paraDict["dbName"],self.paraDict["dropFlag"], self.paraDict['precision']) + tdCom.create_database(tdSql,self.paraDict["dbName"],self.paraDict["dropFlag"]) self.paraDict["stbName"] = 'stb1' - tdCom.create_stable(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["columnDict"],self.paraDict["tagDict"]) - tdCom.create_ctables(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["ctbNum"],self.paraDict["tagDict"]) - tdCom.insert_data(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"]) + tdCom.create_stable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],column_elm_list=self.paraDict["colSchema"],tag_elm_list=self.paraDict["tagSchema"],count=1, default_stbname_prefix=self.paraDict["stbName"]) + tdCom.create_ctable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],tag_elm_list=self.paraDict['tagSchema'],count=self.paraDict["ctbNum"],default_ctbname_prefix=self.paraDict["ctbPrefix"]) + tmqCom.insert_data_2(tdSql,self.paraDict["dbName"],self.paraDict["ctbPrefix"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"],self.paraDict["startTs"],self.paraDict["ctbStartIdx"]) self.paraDict["stbName"] = 'stb2' - tdCom.create_stable(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["columnDict"],self.paraDict["tagDict"]) - tdCom.create_ctables(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["ctbNum"],self.paraDict["tagDict"]) - tdCom.insert_data(tdSql,self.paraDict["dbName"],self.paraDict["stbName"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"]) + self.paraDict["ctbPrefix"] = 'newctb' + tdCom.create_stable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],column_elm_list=self.paraDict["colSchema"],tag_elm_list=self.paraDict["tagSchema"],count=1, default_stbname_prefix=self.paraDict["stbName"]) + tdCom.create_ctable(tdSql,dbname=self.paraDict["dbName"],stbname=self.paraDict["stbName"],tag_elm_list=self.paraDict['tagSchema'],count=self.paraDict["ctbNum"],default_ctbname_prefix=self.paraDict["ctbPrefix"]) + tmqCom.insert_data_2(tdSql,self.paraDict["dbName"],self.paraDict["ctbPrefix"],self.paraDict["ctbNum"],self.paraDict["rowsPerTbl"],self.paraDict["batchNum"],self.paraDict["startTs"],self.paraDict["ctbStartIdx"]) tdLog.info("create topics from db") topicName1 = 'topic_%s'%(self.paraDict['dbName']) @@ -97,7 +103,7 @@ class TDTestCase: tdLog.info("act consume rows: %d, expect consume rows: between %d and %d"%(totalConsumeRows, self.expectrowcnt/2, self.expectrowcnt)) tdLog.exit("tmq consume rows error!") - time.sleep(15) + time.sleep(10) tdSql.query("drop topic %s"%topicName1) tdLog.printNoPrefix("======== test case 12 end ...... ") diff --git a/tests/system-test/7-tmq/tmqAlterSchema.py b/tests/system-test/7-tmq/tmqAlterSchema.py new file mode 100644 index 0000000000..a2e20990d9 --- /dev/null +++ b/tests/system-test/7-tmq/tmqAlterSchema.py @@ -0,0 +1,259 @@ + +from ntpath import join +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +from util.cluster import * + +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def __init__(self): + self.dnodes = 5 + self.mnodes = 3 + self.idIndex = 0 + self.roleIndex = 2 + self.mnodeStatusIndex = 3 + self.mnodeEpIndex = 1 + self.dnodeStatusIndex = 4 + self.mnodeCheckCnt = 10 + self.host = socket.gethostname() + self.startPort = 6030 + self.portStep = 100 + self.dnodeOfLeader = 0 + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: topic: select * from stb, while consume, add column int-A/bianry-B/float-C, and then modify B, drop C") + tdLog.printNoPrefix("add tag int-A/bianry-B/float-C, and then rename A, modify B, drop C, set t2") + paraDict = {'dbName': 'db1', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':20, 'count':1}, {'type': 'TIMESTAMP', 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + queryStringList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ctb") + tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("async insert data") + # pThread = tmqCom.asyncInsertData(paraDict) + tmqCom.insert_data_2(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"],paraDict["ctbStartIdx"]) + + tdLog.info("create topics from stb with filter") + queryStringList.append("select * from %s.%s" %(paraDict['dbName'], paraDict['stbName'])) + sqlString = "create topic %s as %s" %(topicNameList[0], queryStringList[0]) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + dstFile = tmqCom.getResultFileByTaosShell(consumerId, queryStringList[0]) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + + tdLog.info("wait the notify info of start consume, then alter schema") + tmqCom.getStartConsumeNotifyFromTmqsim() + + # add column double-A/bianry-B/double-C, and then modify B, drop C + sqlString = "alter table %s.%s add column newc1 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc2 binary(16)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc3 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify column newc2 binary(32)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop column newc3"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + # add tag double-A/bianry-B/double-C, and then rename A, modify B, drop C, set t1 + sqlString = "alter table %s.%s add tag newt1 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add tag newt2 binary(16)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add tag newt3 double"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s rename tag newt1 newt1n"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify tag newt2 binary(32)"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop tag newt3"%(paraDict["dbName"],paraDict['stbName']) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s0 set tag newt2='new tag'"%(paraDict["dbName"],paraDict['ctbPrefix']) + tdSql.execute(sqlString) + + tdLog.info("check the consume result") + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d"%(expectRowsList[0])) + tdLog.info("act consume rows: %d"%(resultList[0])) + + if expectRowsList[0] != resultList[0]: + tdLog.exit("0 tmq consume rows error!") + + tmqCom.checkTmqConsumeFileContent(consumerId, dstFile) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: topic: select * from ntb, while consume, add column int-A/bianry-B/float-C, and then rename A, modify B, drop C") + paraDict = {'dbName': 'db1', + 'dropFlag': 1, + 'event': '', + 'vgroups': 4, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':2}, {'type': 'binary', 'len':20, 'count':2}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbStartIdx': 0, + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 10, + 'showMsg': 1, + 'showRow': 1} + + ntbName = 'ntb' + + topicNameList = ['topic1'] + expectRowsList = [] + queryStringList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=4,replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ntb") + tdCom.create_table(tdSql, dbname=paraDict["dbName"],tbname=ntbName,column_elm_list=paraDict['colSchema'],count=1) + tdLog.info("start insert data ....") + # pThread = tmqCom.asyncInsertData(paraDict) + tdCom.insert_rows(tdSql, dbname=paraDict["dbName"], tbname=ntbName, column_ele_list=paraDict['colSchema'], start_ts_value=paraDict["startTs"], count=paraDict["rowsPerTbl"]) + tdLog.info("insert data end") + + tdLog.info("create topics from ntb with filter") + queryStringList.append("select * from %s.%s" %(paraDict['dbName'], ntbName)) + sqlString = "create topic %s as %s" %(topicNameList[0], queryStringList[0]) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:6000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + dstFile = tmqCom.getResultFileByTaosShell(consumerId, queryStringList[0]) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(paraDict['pollDelay'],paraDict["dbName"],paraDict['showMsg'], paraDict['showRow']) + + tdLog.info("wait the notify info of start consume, then alter schema") + tmqCom.getStartConsumeNotifyFromTmqsim() + + # add column double-A/bianry-B/double-C, and then rename A, modify B, drop C + sqlString = "alter table %s.%s add column newc1 double"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc2 binary(16)"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s add column newc3 double"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s rename column newc1 newc1n"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s modify column newc2 binary(32)"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + sqlString = "alter table %s.%s drop column newc3"%(paraDict["dbName"],ntbName) + tdSql.execute(sqlString) + + tdLog.info("check the consume result") + tdSql.query(queryStringList[0]) + expectRowsList.append(tdSql.getRows()) + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + tdLog.info("expect consume rows: %d"%(expectRowsList[0])) + tdLog.info("act consume rows: %d"%(resultList[0])) + + if expectRowsList[0] != resultList[0]: + tdLog.exit("0 tmq consume rows error!") + + tmqCom.checkTmqConsumeFileContent(consumerId, dstFile) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def run(self): + self.tmqCase1() + self.tmqCase2() + + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 9254f57c40..f8488aee49 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -76,8 +76,24 @@ class TMQCom: resultList.append(tdSql.getData(i , 3)) return resultList + + def selectConsumeMsgResult(self,expectRows,cdbName='cdb'): + resultList=[] + while 1: + tdSql.query("select * from %s.consumeresult"%cdbName) + #tdLog.info("row: %d, %l64d, %l64d"%(tdSql.getData(0, 1),tdSql.getData(0, 2),tdSql.getData(0, 3)) + if tdSql.getRows() == expectRows: + break + else: + time.sleep(5) + + for i in range(expectRows): + tdLog.info ("consume id: %d, consume msgs: %d, consume rows: %d"%(tdSql.getData(i , 1), tdSql.getData(i , 2), tdSql.getData(i , 3))) + resultList.append(tdSql.getData(i , 2)) + + return resultList - def startTmqSimProcess(self,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0,alias=0): + def startTmqSimProcess(self,pollDelay,dbName,showMsg=1,showRow=1,cdbName='cdb',valgrind=0,alias=0,snapshot=0): buildPath = tdCom.getBuildPath() cfgPath = tdCom.getClientCfgPath() if valgrind == 1: @@ -93,7 +109,7 @@ class TMQCom: os.system(shellCmd) processorName = processorNameNew shellCmd = 'mintty -h never ' + processorName + ' -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s -e %d "%(pollDelay, dbName, showMsg, showRow, cdbName, snapshot) shellCmd += "> nul 2>&1 &" else: processorName = buildPath + '/build/bin/tmq_sim' @@ -103,7 +119,7 @@ class TMQCom: os.system(shellCmd) processorName = processorNameNew shellCmd = 'nohup ' + processorName + ' -c ' + cfgPath - shellCmd += " -y %d -d %s -g %d -r %d -w %s "%(pollDelay, dbName, showMsg, showRow, cdbName) + shellCmd += " -y %d -d %s -g %d -r %d -w %s -e %d "%(pollDelay, dbName, showMsg, showRow, cdbName, snapshot) shellCmd += "> /dev/null 2>&1 &" tdLog.info(shellCmd) os.system(shellCmd) @@ -367,6 +383,69 @@ class TMQCom: pThread.start() return pThread + def checkFileContent(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + lines = 0 + while True: + dst = queryFile.readline() + src = consumeFile.readline() + lines += 1 + if dst: + if dst != src: + tdLog.info("src row: %s"%src) + tdLog.info("dst row: %s"%dst) + tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines)) + else: + break + return + + def getResultFileByTaosShell(self, consumerId, queryString): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) + cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) + tdLog.info(cmdStr) + os.system(cmdStr) + return dstFile + + def checkTmqConsumeFileContent(self, consumerId, dstFile): + cfgPath = tdCom.getClientCfgPath() + consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) + tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) + + consumeFile = open(consumeRowsFile, mode='r') + queryFile = open(dstFile, mode='r') + + # skip first line for it is schema + queryFile.readline() + lines = 0 + while True: + dst = queryFile.readline() + src = consumeFile.readline() + lines += 1 + if dst: + if dst != src: + tdLog.info("src row: %s"%src) + tdLog.info("dst row: %s"%dst) + tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines)) + else: + break + return + def close(self): self.cursor.close() diff --git a/tests/system-test/7-tmq/tmqConsFromTsdb.py b/tests/system-test/7-tmq/tmqConsFromTsdb.py new file mode 100644 index 0000000000..9cd62feee6 --- /dev/null +++ b/tests/system-test/7-tmq/tmqConsFromTsdb.py @@ -0,0 +1,294 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + + def tmqCase1(self): + tdLog.printNoPrefix("======== test case 1: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + tdLog.info("create stb") + tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + tdLog.info("create ctb") + tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + tdLog.info("insert data") + tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + tdDnodes.stop(1) + tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 0 + expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if expectRowsList[0] != resultList[0]: + tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + tmqCom.checkFileContent(consumerId, queryString) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 1 end ...... ") + + def tmqCase2(self): + tdLog.printNoPrefix("======== test case 2: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 1, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + # tdDnodes.stop(1) + # tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + totalRowsInserted = expectRowsList[0] + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 1 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 0") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + firstConsumeRows = resultList[0] + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 2 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 1") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + actConsumeTotalRows = firstConsumeRows + resultList[0] + + if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): + tdLog.info("act consume rows: %d, expect consume rows <= %d "%(resultList[0], expectrowcnt)) + tdLog.info("and sum of two consume rows: %d , total inserted rows: %d"%(actConsumeTotalRows, totalRowsInserted)) + tdLog.exit("%d tmq consume rows error!"%consumerId) + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 2 end ...... ") + + def tmqCase3(self): + tdLog.printNoPrefix("======== test case 3: ") + paraDict = {'dbName': 'dbt', + 'dropFlag': 1, + 'event': '', + 'vgroups': 1, + 'stbName': 'stb', + 'colPrefix': 'c', + 'tagPrefix': 't', + 'colSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'tagSchema': [{'type': 'INT', 'count':1}, {'type': 'binary', 'len':20, 'count':1}], + 'ctbPrefix': 'ctb', + 'ctbNum': 10, + 'rowsPerTbl': 10000, + 'batchNum': 10, + 'startTs': 1640966400000, # 2022-01-01 00:00:00.000 + 'pollDelay': 3, + 'showMsg': 1, + 'showRow': 1, + 'snapshot': 1} + + topicNameList = ['topic1'] + expectRowsList = [] + tmqCom.initConsumerTable() + # tdCom.create_database(tdSql, paraDict["dbName"],paraDict["dropFlag"], vgroups=paraDict["vgroups"],replica=1) + # tdLog.info("create stb") + # tdCom.create_stable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"], column_elm_list=paraDict['colSchema'], tag_elm_list=paraDict['tagSchema']) + # tdLog.info("create ctb") + # tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) + # tdLog.info("insert data") + # tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) + + # tdDnodes.stop(1) + # tdDnodes.start(1) + + tdLog.info("create topics from stb with filter") + queryString = "select * from %s.%s"%(paraDict['dbName'], paraDict['stbName']) + # sqlString = "create topic %s as stable %s" %(topicNameList[0], paraDict['stbName']) + sqlString = "create topic %s as %s" %(topicNameList[0], queryString) + tdLog.info("create topic sql: %s"%sqlString) + tdSql.execute(sqlString) + tdSql.query(queryString) + expectRowsList.append(tdSql.getRows()) + totalRowsInserted = expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] + + # init consume info, and start tmq_sim, then check consume result + tdLog.info("insert consume info to consume processor") + consumerId = 3 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 7) + topicList = topicNameList[0] + ifcheckdata = 1 + ifManualCommit = 1 + keyList = 'group.id:cgrp1, enable.auto.commit:true, auto.commit.interval.ms:1000, auto.offset.reset:earliest' + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 0") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + if not (expectrowcnt <= resultList[0] and totalRowsInserted >= resultList[0]): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("0 tmq consume rows error!") + + firstConsumeRows = resultList[0] + + # reinit consume info, and start tmq_sim, then check consume result + tmqCom.initConsumerTable() + consumerId = 4 + expectrowcnt = paraDict["rowsPerTbl"] * (paraDict["ctbNum"] - 3) + tmqCom.insertConsumerInfo(consumerId, expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) + + tdLog.info("start consume processor 1") + tmqCom.startTmqSimProcess(pollDelay=paraDict['pollDelay'],dbName=paraDict["dbName"],showMsg=paraDict['showMsg'], showRow=paraDict['showRow'],snapshot=paraDict['snapshot']) + tdLog.info("wait the consume result") + + expectRows = 1 + resultList = tmqCom.selectConsumeResult(expectRows) + + actConsumeTotalRows = firstConsumeRows + resultList[0] + + if not (expectrowcnt >= resultList[0] and totalRowsInserted == actConsumeTotalRows): + tdLog.info("act consume rows: %d, expect consume rows between %d and %d"%(resultList[0], expectrowcnt, totalRowsInserted)) + tdLog.exit("0 tmq consume rows error!") + + time.sleep(10) + for i in range(len(topicNameList)): + tdSql.query("drop topic %s"%topicNameList[i]) + + tdLog.printNoPrefix("======== test case 3 end ...... ") + + def run(self): + tdSql.prepare() + self.tmqCase1() + self.tmqCase2() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index d0fee5c49c..a4e191b36a 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -116,17 +116,18 @@ python3 ./test.py -f 2-query/function_null.py python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 6-cluster/5dnode1mnode.py -python3 ./test.py -f 6-cluster/5dnode2mnode.py +python3 ./test.py -f 6-cluster/5dnode2mnode.py -N 5 -M 3 python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 +# python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -N 5 -M 3 # python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -N 5 -M 3 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py # python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 -python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 +# python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 python3 ./test.py -f 7-tmq/basic5.py @@ -135,6 +136,7 @@ python3 ./test.py -f 7-tmq/subscribeDb0.py python3 ./test.py -f 7-tmq/subscribeDb1.py python3 ./test.py -f 7-tmq/subscribeDb2.py python3 ./test.py -f 7-tmq/subscribeDb3.py +#python3 ./test.py -f 7-tmq/subscribeDb4.py python3 ./test.py -f 7-tmq/subscribeStb.py python3 ./test.py -f 7-tmq/subscribeStb0.py python3 ./test.py -f 7-tmq/subscribeStb1.py @@ -151,3 +153,4 @@ python3 ./test.py -f 7-tmq/tmqUdf.py #python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -N 5 python3 ./test.py -f 7-tmq/tmqConsumerGroup.py python3 ./test.py -f 7-tmq/tmqShow.py +python3 ./test.py -f 7-tmq/tmqAlterSchema.py diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 5cf38f1e5b..3f2a81197b 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -435,7 +435,7 @@ static void dumpToFileForCheck(TdFilePtr pFile, TAOS_ROW row, TAOS_FIELD* fields int32_t precision) { for (int32_t i = 0; i < num_fields; i++) { if (i > 0) { - taosFprintfFile(pFile, "\n"); + taosFprintfFile(pFile, ","); } shellDumpFieldToFile(pFile, (const char*)row[i], fields + i, length[i], precision); } @@ -525,15 +525,15 @@ int32_t notifyMainScript(SThreadInfo* pInfo, int32_t cmdId) { static int32_t g_once_commit_flag = 0; static void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) { - pError("tmq_commit_cb_print() commit %d\n", code); + pError("tmq_commit_cb_print() commit %d\n", code); - if (0 == g_once_commit_flag) { - g_once_commit_flag = 1; - notifyMainScript((SThreadInfo*)param, (int32_t)NOTIFY_CMD_START_COMMIT); + if (0 == g_once_commit_flag) { + g_once_commit_flag = 1; + notifyMainScript((SThreadInfo*)param, (int32_t)NOTIFY_CMD_START_COMMIT); } - char tmpString[128]; - taosFprintfFile(g_fp, "%s tmq_commit_cb_print() be called\n", getCurrentTimeString(tmpString)); + char tmpString[128]; + taosFprintfFile(g_fp, "%s tmq_commit_cb_print() be called\n", getCurrentTimeString(tmpString)); } void build_consumer(SThreadInfo* pInfo) { @@ -637,6 +637,10 @@ void loop_consume(SThreadInfo* pInfo) { } } + int64_t lastTotalMsgs = 0; + uint64_t lastPrintTime = taosGetTimestampMs(); + uint64_t startTs = taosGetTimestampMs(); + int32_t consumeDelay = g_stConfInfo.consumeDelay == -1 ? -1 : (g_stConfInfo.consumeDelay * 1000); while (running) { TAOS_RES* tmqMsg = tmq_consumer_poll(pInfo->tmq, consumeDelay); @@ -648,13 +652,22 @@ void loop_consume(SThreadInfo* pInfo) { taos_free_result(tmqMsg); totalMsgs++; - + + int64_t currentPrintTime = taosGetTimestampMs(); + if (currentPrintTime - lastPrintTime > 10 * 1000) { + taosFprintfFile(g_fp, + "consumer id %d has currently poll total msgs: %" PRId64 ", period rate: %.3f msgs/second\n", + pInfo->consumerId, totalMsgs, (totalMsgs - lastTotalMsgs) * 1000.0/(currentPrintTime - lastPrintTime)); + lastPrintTime = currentPrintTime; + lastTotalMsgs = totalMsgs; + } + if (0 == once_flag) { once_flag = 1; notifyMainScript(pInfo, NOTIFY_CMD_START_CONSUM); } - if (totalRows >= pInfo->expectMsgCnt) { + if ((totalRows >= pInfo->expectMsgCnt) || (totalMsgs >= pInfo->expectMsgCnt)) { char tmpString[128]; taosFprintfFile(g_fp, "%s over than expect rows, so break consume\n", getCurrentTimeString(tmpString)); break; @@ -665,7 +678,7 @@ void loop_consume(SThreadInfo* pInfo) { break; } } - + if (0 == running) { taosFprintfFile(g_fp, "receive stop signal and not continue consume\n"); } @@ -678,8 +691,6 @@ void loop_consume(SThreadInfo* pInfo) { } void* consumeThreadFunc(void* param) { - int32_t totalMsgs = 0; - SThreadInfo* pInfo = (SThreadInfo*)param; pInfo->taos = taos_connect(NULL, "root", "taosdata", NULL, 0); @@ -861,16 +872,30 @@ int main(int32_t argc, char* argv[]) { (void*)(&(g_stConfInfo.stThreads[i]))); } + int64_t start = taosGetTimestampUs(); + for (int32_t i = 0; i < g_stConfInfo.numOfThread; i++) { taosThreadJoin(g_stConfInfo.stThreads[i].thread, NULL); taosThreadClear(&g_stConfInfo.stThreads[i].thread); } - // printf("consumer: %d, cosumer1: %d\n", totalMsgs, pInfo->consumeMsgCnt); + int64_t end = taosGetTimestampUs(); + + int64_t totalMsgs = 0; + for (int32_t i = 0; i < g_stConfInfo.numOfThread; i++) { + totalMsgs += g_stConfInfo.stThreads[i].consumeMsgCnt; + } + + int64_t t = end - start; + if (0 == t) t = 1; + + double tInMs = (double)t / 1000000.0; + taosFprintfFile(g_fp, + "Spent %.3f seconds to poll msgs: %" PRIu64 " with %d thread(s), throughput: %.3f msgs/second\n\n", + tInMs, totalMsgs, g_stConfInfo.numOfThread, (double)(totalMsgs / tInMs)); taosFprintfFile(g_fp, "==== close tmqlog ====\n"); taosCloseFile(&g_fp); return 0; } - diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 7b275c5a15..96d017ec7a 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -364,7 +364,7 @@ int32_t shellDumpResultToFile(const char *fname, TAOS_RES *tres) { int32_t *length = taos_fetch_lengths(tres); for (int32_t i = 0; i < num_fields; i++) { if (i > 0) { - taosFprintfFile(pFile, "\n"); + taosFprintfFile(pFile, ","); } shellDumpFieldToFile(pFile, (const char *)row[i], fields + i, length[i], precision); } @@ -394,9 +394,9 @@ void shellPrintNChar(const char *str, int32_t length, int32_t width) { break; } int w = 0; - if(*(str + pos) == '\t' || *(str + pos) == '\n' || *(str + pos) == '\r'){ + if (*(str + pos) == '\t' || *(str + pos) == '\n' || *(str + pos) == '\r') { w = bytes; - }else{ + } else { w = taosWcharWidth(wc); } pos += bytes; @@ -513,7 +513,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t } bool shellIsLimitQuery(const char *sql) { - //todo refactor + // todo refactor if (taosStrCaseStr(sql, " limit ") != NULL) { return true; } @@ -522,7 +522,7 @@ bool shellIsLimitQuery(const char *sql) { } bool shellIsShowQuery(const char *sql) { - //todo refactor + // todo refactor if (taosStrCaseStr(sql, "show ") != NULL) { return true; } @@ -530,7 +530,6 @@ bool shellIsShowQuery(const char *sql) { return false; } - int32_t shellVerticalPrintResult(TAOS_RES *tres, const char *sql) { TAOS_ROW row = taos_fetch_row(tres); if (row == NULL) {