diff --git a/include/common/tmsg.h b/include/common/tmsg.h index a8361582bac41278e958106977cbb3f6bf6ef9f0..61da9cb213b8501a7a2444e826193190659b32d7 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -273,11 +273,11 @@ typedef struct { char name[TSDB_COL_NAME_LEN]; } SSchemaEx; -#define SSCHMEA_TYPE(s) ((s)->type) -#define SSCHMEA_SMA(s) ((s)->sma) +#define SSCHMEA_TYPE(s) ((s)->type) +#define SSCHMEA_SMA(s) ((s)->sma) #define SSCHMEA_COLID(s) ((s)->colId) #define SSCHMEA_BYTES(s) ((s)->bytes) -#define SSCHMEA_NAME(s) ((s)->name) +#define SSCHMEA_NAME(s) ((s)->name) typedef struct { char name[TSDB_TABLE_FNAME_LEN]; @@ -483,7 +483,8 @@ typedef struct { int32_t tz; // query client timezone char intervalUnit; char slidingUnit; - char offsetUnit; // TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration. + char + offsetUnit; // TODO Remove it, the offset is the number of precision tickle, and it must be a immutable duration. int8_t precision; int64_t interval; int64_t sliding; @@ -934,12 +935,12 @@ typedef struct SExplainExecInfo { uint64_t startupCost; uint64_t totalCost; uint64_t numOfRows; - void *verboseInfo; + void* verboseInfo; } SExplainExecInfo; typedef struct { int32_t numOfPlans; - SExplainExecInfo *subplanInfo; + SExplainExecInfo* subplanInfo; } SExplainRsp; int32_t tSerializeSExplainRsp(void* buf, int32_t bufLen, SExplainRsp* pRsp); @@ -1432,12 +1433,12 @@ typedef struct SVCreateTbReq { }; union { struct { - tb_uid_t suid; - col_id_t nCols; - col_id_t nBSmaCols; - SSchemaEx* pSchema; - col_id_t nTagCols; - SSchema* pTagSchema; + tb_uid_t suid; + col_id_t nCols; + col_id_t nBSmaCols; + SSchemaEx* pSchema; + col_id_t nTagCols; + SSchema* pTagSchema; SRSmaParam* pRSmaParam; } stbCfg; struct { @@ -1445,9 +1446,9 @@ typedef struct SVCreateTbReq { SKVRow pTag; } ctbCfg; struct { - col_id_t nCols; - col_id_t nBSmaCols; - SSchemaEx* pSchema; + col_id_t nCols; + col_id_t nBSmaCols; + SSchemaEx* pSchema; SRSmaParam* pRSmaParam; } ntbCfg; }; @@ -1866,6 +1867,37 @@ static FORCE_INLINE void* tDecodeSMqSetCVgReq(void* buf, SMqSetCVgReq* pReq) { return buf; } +typedef struct { + int64_t leftForVer; + int32_t vgId; + int32_t epoch; + int64_t consumerId; + char topicName[TSDB_TOPIC_FNAME_LEN]; +} SMqCancelConnReq; + +static FORCE_INLINE int32_t tEncodeSMqCancelConnReq(void** buf, const SMqCancelConnReq* pReq) { + int32_t tlen = 0; + tlen += taosEncodeFixedI64(buf, pReq->leftForVer); + tlen += taosEncodeFixedI32(buf, pReq->vgId); + tlen += taosEncodeFixedI32(buf, pReq->epoch); + tlen += taosEncodeFixedI64(buf, pReq->consumerId); + tlen += taosEncodeString(buf, pReq->topicName); + return tlen; +} + +static FORCE_INLINE void* tDecodeSMqCancelConnReq(void* buf, SMqCancelConnReq* pReq) { + buf = taosDecodeFixedI64(buf, &pReq->leftForVer); + buf = taosDecodeFixedI32(buf, &pReq->vgId); + buf = taosDecodeFixedI32(buf, &pReq->epoch); + buf = taosDecodeFixedI64(buf, &pReq->consumerId); + buf = taosDecodeStringTo(buf, pReq->topicName); + return buf; +} + +typedef struct { + int8_t reserved; +} SMqCancelConnRsp; + typedef struct { int64_t leftForVer; int32_t vgId; diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 1d4667cda0dfff9aeaf3cae92fd75d0180ef031a..31ca2ac215d64bed0e5a0d58abab004bf88872b6 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -176,6 +176,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_MQ_DISCONNECT, "vnode-mq-disconnect", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_MQ_SET_CONN, "vnode-mq-set-conn", SMqSetCVgReq, SMqSetCVgRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_REB, "vnode-mq-mv-rebalance", SMqMVRebReq, SMqMVRebRsp) + TD_DEF_MSG_TYPE(TDMT_VND_MQ_CANCEL_CONN, "vnode-mq-mv-cancel-conn", SMqCancelConnReq, SMqCancelConnRsp) TD_DEF_MSG_TYPE(TDMT_VND_MQ_SET_CUR, "vnode-mq-set-cur", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_RES_READY, "vnode-res-ready", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_TASKS_STATUS, "vnode-tasks-status", NULL, NULL) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index afd2a01540d000c789dc3f02cde8ff63611e38c9..92f4f0a4fb0aedd1a543cb86657f2d4841bb721d 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -69,153 +69,154 @@ #define TK_CACHELAST 51 #define TK_COMP 52 #define TK_DAYS 53 -#define TK_FSYNC 54 -#define TK_MAXROWS 55 -#define TK_MINROWS 56 -#define TK_KEEP 57 -#define TK_PRECISION 58 -#define TK_QUORUM 59 -#define TK_REPLICA 60 -#define TK_TTL 61 -#define TK_WAL 62 -#define TK_VGROUPS 63 -#define TK_SINGLE_STABLE 64 -#define TK_STREAM_MODE 65 -#define TK_RETENTIONS 66 -#define TK_NK_COMMA 67 -#define TK_TABLE 68 -#define TK_NK_LP 69 -#define TK_NK_RP 70 -#define TK_STABLE 71 -#define TK_ADD 72 -#define TK_COLUMN 73 -#define TK_MODIFY 74 -#define TK_RENAME 75 -#define TK_TAG 76 -#define TK_SET 77 -#define TK_NK_EQ 78 -#define TK_USING 79 -#define TK_TAGS 80 -#define TK_NK_DOT 81 -#define TK_COMMENT 82 -#define TK_BOOL 83 -#define TK_TINYINT 84 -#define TK_SMALLINT 85 -#define TK_INT 86 -#define TK_INTEGER 87 -#define TK_BIGINT 88 -#define TK_FLOAT 89 -#define TK_DOUBLE 90 -#define TK_BINARY 91 -#define TK_TIMESTAMP 92 -#define TK_NCHAR 93 -#define TK_UNSIGNED 94 -#define TK_JSON 95 -#define TK_VARCHAR 96 -#define TK_MEDIUMBLOB 97 -#define TK_BLOB 98 -#define TK_VARBINARY 99 -#define TK_DECIMAL 100 -#define TK_SMA 101 -#define TK_ROLLUP 102 -#define TK_FILE_FACTOR 103 -#define TK_NK_FLOAT 104 -#define TK_DELAY 105 -#define TK_SHOW 106 -#define TK_DATABASES 107 -#define TK_TABLES 108 -#define TK_STABLES 109 -#define TK_MNODES 110 -#define TK_MODULES 111 -#define TK_QNODES 112 -#define TK_FUNCTIONS 113 -#define TK_INDEXES 114 -#define TK_FROM 115 -#define TK_ACCOUNTS 116 -#define TK_APPS 117 -#define TK_CONNECTIONS 118 -#define TK_LICENCE 119 -#define TK_QUERIES 120 -#define TK_SCORES 121 -#define TK_TOPICS 122 -#define TK_VARIABLES 123 -#define TK_LIKE 124 -#define TK_INDEX 125 -#define TK_FULLTEXT 126 -#define TK_FUNCTION 127 -#define TK_INTERVAL 128 -#define TK_TOPIC 129 -#define TK_AS 130 -#define TK_DESC 131 -#define TK_DESCRIBE 132 -#define TK_RESET 133 -#define TK_QUERY 134 -#define TK_EXPLAIN 135 -#define TK_ANALYZE 136 -#define TK_VERBOSE 137 -#define TK_NK_BOOL 138 -#define TK_RATIO 139 -#define TK_COMPACT 140 -#define TK_VNODES 141 -#define TK_IN 142 -#define TK_OUTPUTTYPE 143 -#define TK_AGGREGATE 144 -#define TK_BUFSIZE 145 -#define TK_STREAM 146 -#define TK_INTO 147 -#define TK_KILL 148 -#define TK_CONNECTION 149 -#define TK_MERGE 150 -#define TK_VGROUP 151 -#define TK_REDISTRIBUTE 152 -#define TK_SPLIT 153 -#define TK_SYNCDB 154 -#define TK_NULL 155 -#define TK_NK_VARIABLE 156 -#define TK_NOW 157 -#define TK_ROWTS 158 -#define TK_TBNAME 159 -#define TK_QSTARTTS 160 -#define TK_QENDTS 161 -#define TK_WSTARTTS 162 -#define TK_WENDTS 163 -#define TK_WDURATION 164 -#define TK_BETWEEN 165 -#define TK_IS 166 -#define TK_NK_LT 167 -#define TK_NK_GT 168 -#define TK_NK_LE 169 -#define TK_NK_GE 170 -#define TK_NK_NE 171 -#define TK_MATCH 172 -#define TK_NMATCH 173 -#define TK_JOIN 174 -#define TK_INNER 175 -#define TK_SELECT 176 -#define TK_DISTINCT 177 -#define TK_WHERE 178 -#define TK_PARTITION 179 -#define TK_BY 180 -#define TK_SESSION 181 -#define TK_STATE_WINDOW 182 -#define TK_SLIDING 183 -#define TK_FILL 184 -#define TK_VALUE 185 -#define TK_NONE 186 -#define TK_PREV 187 -#define TK_LINEAR 188 -#define TK_NEXT 189 -#define TK_GROUP 190 -#define TK_HAVING 191 -#define TK_ORDER 192 -#define TK_SLIMIT 193 -#define TK_SOFFSET 194 -#define TK_LIMIT 195 -#define TK_OFFSET 196 -#define TK_ASC 197 -#define TK_NULLS 198 -#define TK_FIRST 199 -#define TK_LAST 200 +#define TK_NK_VARIABLE 54 +#define TK_FSYNC 55 +#define TK_MAXROWS 56 +#define TK_MINROWS 57 +#define TK_KEEP 58 +#define TK_PRECISION 59 +#define TK_QUORUM 60 +#define TK_REPLICA 61 +#define TK_TTL 62 +#define TK_WAL 63 +#define TK_VGROUPS 64 +#define TK_SINGLE_STABLE 65 +#define TK_STREAM_MODE 66 +#define TK_RETENTIONS 67 +#define TK_NK_COMMA 68 +#define TK_NK_COLON 69 +#define TK_TABLE 70 +#define TK_NK_LP 71 +#define TK_NK_RP 72 +#define TK_STABLE 73 +#define TK_ADD 74 +#define TK_COLUMN 75 +#define TK_MODIFY 76 +#define TK_RENAME 77 +#define TK_TAG 78 +#define TK_SET 79 +#define TK_NK_EQ 80 +#define TK_USING 81 +#define TK_TAGS 82 +#define TK_NK_DOT 83 +#define TK_COMMENT 84 +#define TK_BOOL 85 +#define TK_TINYINT 86 +#define TK_SMALLINT 87 +#define TK_INT 88 +#define TK_INTEGER 89 +#define TK_BIGINT 90 +#define TK_FLOAT 91 +#define TK_DOUBLE 92 +#define TK_BINARY 93 +#define TK_TIMESTAMP 94 +#define TK_NCHAR 95 +#define TK_UNSIGNED 96 +#define TK_JSON 97 +#define TK_VARCHAR 98 +#define TK_MEDIUMBLOB 99 +#define TK_BLOB 100 +#define TK_VARBINARY 101 +#define TK_DECIMAL 102 +#define TK_SMA 103 +#define TK_ROLLUP 104 +#define TK_FILE_FACTOR 105 +#define TK_NK_FLOAT 106 +#define TK_DELAY 107 +#define TK_SHOW 108 +#define TK_DATABASES 109 +#define TK_TABLES 110 +#define TK_STABLES 111 +#define TK_MNODES 112 +#define TK_MODULES 113 +#define TK_QNODES 114 +#define TK_FUNCTIONS 115 +#define TK_INDEXES 116 +#define TK_FROM 117 +#define TK_ACCOUNTS 118 +#define TK_APPS 119 +#define TK_CONNECTIONS 120 +#define TK_LICENCE 121 +#define TK_QUERIES 122 +#define TK_SCORES 123 +#define TK_TOPICS 124 +#define TK_VARIABLES 125 +#define TK_LIKE 126 +#define TK_INDEX 127 +#define TK_FULLTEXT 128 +#define TK_FUNCTION 129 +#define TK_INTERVAL 130 +#define TK_TOPIC 131 +#define TK_AS 132 +#define TK_DESC 133 +#define TK_DESCRIBE 134 +#define TK_RESET 135 +#define TK_QUERY 136 +#define TK_EXPLAIN 137 +#define TK_ANALYZE 138 +#define TK_VERBOSE 139 +#define TK_NK_BOOL 140 +#define TK_RATIO 141 +#define TK_COMPACT 142 +#define TK_VNODES 143 +#define TK_IN 144 +#define TK_OUTPUTTYPE 145 +#define TK_AGGREGATE 146 +#define TK_BUFSIZE 147 +#define TK_STREAM 148 +#define TK_INTO 149 +#define TK_KILL 150 +#define TK_CONNECTION 151 +#define TK_MERGE 152 +#define TK_VGROUP 153 +#define TK_REDISTRIBUTE 154 +#define TK_SPLIT 155 +#define TK_SYNCDB 156 +#define TK_NULL 157 +#define TK_FIRST 158 +#define TK_LAST 159 +#define TK_NOW 160 +#define TK_ROWTS 161 +#define TK_TBNAME 162 +#define TK_QSTARTTS 163 +#define TK_QENDTS 164 +#define TK_WSTARTTS 165 +#define TK_WENDTS 166 +#define TK_WDURATION 167 +#define TK_BETWEEN 168 +#define TK_IS 169 +#define TK_NK_LT 170 +#define TK_NK_GT 171 +#define TK_NK_LE 172 +#define TK_NK_GE 173 +#define TK_NK_NE 174 +#define TK_MATCH 175 +#define TK_NMATCH 176 +#define TK_JOIN 177 +#define TK_INNER 178 +#define TK_SELECT 179 +#define TK_DISTINCT 180 +#define TK_WHERE 181 +#define TK_PARTITION 182 +#define TK_BY 183 +#define TK_SESSION 184 +#define TK_STATE_WINDOW 185 +#define TK_SLIDING 186 +#define TK_FILL 187 +#define TK_VALUE 188 +#define TK_NONE 189 +#define TK_PREV 190 +#define TK_LINEAR 191 +#define TK_NEXT 192 +#define TK_GROUP 193 +#define TK_HAVING 194 +#define TK_ORDER 195 +#define TK_SLIMIT 196 +#define TK_SOFFSET 197 +#define TK_LIMIT 198 +#define TK_OFFSET 199 +#define TK_ASC 200 +#define TK_NULLS 201 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -226,7 +227,6 @@ #define TK_NK_FILE 306 #define TK_NK_QUESTION 307 // denoting the placeholder of "?",when invoking statement bind query -#define TK_NK_COLON 500 #define TK_NK_BITNOT 501 #define TK_INSERT 502 #define TK_VALUES 507 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index 921d3cc07bfa647328a82ec0e14b92ac7f593cd1..5acb11fc4ff2a83aff3aa2d27bb13e5665be2246 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -30,25 +30,23 @@ extern "C" { typedef struct SDatabaseOptions { ENodeType type; - int32_t numOfBlocks; - int32_t cacheBlockSize; - int8_t cachelast; - int32_t compressionLevel; - int32_t daysPerFile; - int32_t fsyncPeriod; - int32_t maxRowsPerBlock; - int32_t minRowsPerBlock; - int32_t keep0; - int32_t keep1; - int32_t keep2; - int32_t precision; - int32_t quorum; - int32_t replica; - int32_t ttl; - int32_t walLevel; - int32_t numOfVgroups; - int8_t singleStable; - int8_t streamMode; + SValueNode* pNumOfBlocks; + SValueNode* pCacheBlockSize; + SValueNode* pCachelast; + SValueNode* pCompressionLevel; + SValueNode* pDaysPerFile; + SValueNode* pFsyncPeriod; + SValueNode* pMaxRowsPerBlock; + SValueNode* pMinRowsPerBlock; + SNodeList* pKeep; + SValueNode* pPrecision; + SValueNode* pQuorum; + SValueNode* pReplica; + SValueNode* pTtl; + SValueNode* pWalLevel; + SValueNode* pNumOfVgroups; + SValueNode* pSingleStable; + SValueNode* pStreamMode; SNodeList* pRetentions; } SDatabaseOptions; @@ -78,15 +76,13 @@ typedef struct SAlterDatabaseStmt { typedef struct STableOptions { ENodeType type; - int32_t keep0; - int32_t keep1; - int32_t keep2; - int32_t ttl; - char comments[TSDB_STB_COMMENT_LEN]; + SNodeList* pKeep; + SValueNode* pTtl; + SValueNode* pComments; SNodeList* pSma; SNodeList* pFuncs; - float filesFactor; - int32_t delay; + SValueNode* pFilesFactor; + SValueNode* pDelay; } STableOptions; typedef struct SColumnDefNode { diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index 65f7e1ceb823d1de6dc07b4c38e84dcf18bee9c7..7cb96104bdec83857fd669e2cb644c0f12fa26c9 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -286,12 +286,14 @@ typedef struct SSortPhysiNode { SPhysiNode node; SNodeList* pExprs; // these are expression list of order_by_clause and parameter expression of aggregate function SNodeList* pSortKeys; // element is SOrderByExprNode, and SOrderByExprNode::pExpr is SColumnNode + SNodeList* pTargets; } SSortPhysiNode; typedef struct SPartitionPhysiNode { SPhysiNode node; SNodeList* pExprs; // these are expression list of partition_by_clause SNodeList* pPartitionKeys; + SNodeList* pTargets; } SPartitionPhysiNode; typedef struct SDataSinkNode { diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index f811b42f2f9737360b1b34eb620d223ae2bda6ac..f987afd878f4a6e276b8031508bc5a58f92d3c75 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -258,6 +258,7 @@ typedef enum ESqlClause { SQL_CLAUSE_WINDOW, SQL_CLAUSE_GROUP_BY, SQL_CLAUSE_HAVING, + SQL_CLAUSE_DISTINCT, SQL_CLAUSE_SELECT, SQL_CLAUSE_ORDER_BY } ESqlClause; diff --git a/include/util/taoserror.h b/include/util/taoserror.h index e7f440e26f18c54b651f9e683d4b99577b3c1a34..ed90628bda4ee2a0e1c6982e37a0a5c32855c72c 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -482,6 +482,17 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_DB_NOT_SPECIFIED TAOS_DEF_ERROR_CODE(0, 0x2616) #define TSDB_CODE_PAR_INVALID_IDENTIFIER_NAME TAOS_DEF_ERROR_CODE(0, 0x2617) #define TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR TAOS_DEF_ERROR_CODE(0, 0x2618) +#define TSDB_CODE_PAR_INVALID_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2619) +#define TSDB_CODE_PAR_INVALID_STR_OPTION TAOS_DEF_ERROR_CODE(0, 0x2620) +#define TSDB_CODE_PAR_INVALID_ENUM_OPTION TAOS_DEF_ERROR_CODE(0, 0x2621) +#define TSDB_CODE_PAR_INVALID_TTL_OPTION TAOS_DEF_ERROR_CODE(0, 0x2622) +#define TSDB_CODE_PAR_INVALID_KEEP_NUM TAOS_DEF_ERROR_CODE(0, 0x2623) +#define TSDB_CODE_PAR_INVALID_KEEP_ORDER TAOS_DEF_ERROR_CODE(0, 0x2624) +#define TSDB_CODE_PAR_INVALID_KEEP_VALUE TAOS_DEF_ERROR_CODE(0, 0x2625) +#define TSDB_CODE_PAR_INVALID_COMMENT_OPTION TAOS_DEF_ERROR_CODE(0, 0x2626) +#define TSDB_CODE_PAR_INVALID_F_RANGE_OPTION TAOS_DEF_ERROR_CODE(0, 0x2627) +#define TSDB_CODE_PAR_INVALID_ROLLUP_OPTION TAOS_DEF_ERROR_CODE(0, 0x2628) +#define TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION TAOS_DEF_ERROR_CODE(0, 0x2629) //planner #define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700) diff --git a/packaging/install.sh b/packaging/install.sh new file mode 100755 index 0000000000000000000000000000000000000000..3aae074af55ada32ecee1a8033b71217c706d301 --- /dev/null +++ b/packaging/install.sh @@ -0,0 +1,536 @@ +#!/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")) +# Dynamic directory +data_dir="/var/lib/taos" +log_dir="/var/log/taos" + +data_link_dir="/usr/local/taos/data" +log_link_dir="/usr/local/taos/log" + +cfg_install_dir="/etc/taos" + +bin_link_dir="/usr/bin" +lib_link_dir="/usr/lib" +lib64_link_dir="/usr/lib64" +inc_link_dir="/usr/include" + +#install main path +install_main_dir="/usr/local/taos" + +# old bin dir +bin_dir="/usr/local/taos/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 +prompt_force=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 +elif echo $osinfo | grep -qwi "Linx" ; then +# echo "This is Linx system" + os_type=1 + service_mod=0 + initd_mod=0 + service_config_dir="/etc/systemd/system" +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 + + +# ============================= get input parameters ================================================= + +# install.sh -v [server | client] -e [yes | no] -i [systemd | service | ...] + +# set parameters by default value +interactiveFqdn=yes # [yes | no] +verType=server # [server | client] +initType=systemd # [systemd | service | ...] + +while getopts "hv:e:i:" arg +do + case $arg in + e) + #echo "interactiveFqdn=$OPTARG" + interactiveFqdn=$( echo $OPTARG ) + ;; + v) + #echo "verType=$OPTARG" + verType=$(echo $OPTARG) + ;; + i) + #echo "initType=$OPTARG" + initType=$(echo $OPTARG) + ;; + h) + echo "Usage: `basename $0` -v [server | client] -e [yes | no]" + exit 0 + ;; + ?) #unknow option + echo "unkonw argument" + exit 1 + ;; + esac +done + +#echo "verType=${verType} interactiveFqdn=${interactiveFqdn}" + +function kill_process() { + pid=$(ps -ef | grep "$1" | 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}/cfg + ${csudo} mkdir -p ${install_main_dir}/bin + ${csudo} mkdir -p ${install_main_dir}/connector + ${csudo} mkdir -p ${install_main_dir}/driver + ${csudo} mkdir -p ${install_main_dir}/examples + ${csudo} mkdir -p ${install_main_dir}/include + ${csudo} mkdir -p ${install_main_dir}/init.d + if [ "$verMode" == "cluster" ]; then + ${csudo} mkdir -p ${nginx_dir} + fi + + if [[ -e ${script_dir}/email ]]; then + ${csudo} cp ${script_dir}/email ${install_main_dir}/ ||: + fi +} + +function install_bin() { + # Remove links + ${csudo} rm -f ${bin_link_dir}/taos || : + ${csudo} rm -f ${bin_link_dir}/taosd || : + ${csudo} rm -f ${bin_link_dir}/taosadapter || : + ${csudo} rm -f ${bin_link_dir}/create_table || : + ${csudo} rm -f ${bin_link_dir}/tmq_sim || : + ${csudo} rm -f ${bin_link_dir}/taosdump || : + ${csudo} rm -f ${bin_link_dir}/rmtaos || : + #${csudo} rm -f ${bin_link_dir}/set_core || : + + ${csudo} cp -r ${script_dir}/bin/* ${install_main_dir}/bin && ${csudo} chmod 0555 ${install_main_dir}/bin/* + + #Make link + [ -x ${install_main_dir}/bin/taos ] && ${csudo} ln -s ${install_main_dir}/bin/taos ${bin_link_dir}/taos || : + [ -x ${install_main_dir}/bin/taosd ] && ${csudo} ln -s ${install_main_dir}/bin/taosd ${bin_link_dir}/taosd || : + [ -x ${install_main_dir}/bin/create_table ] && ${csudo} ln -s ${install_main_dir}/bin/create_table ${bin_link_dir}/create_table || : + [ -x ${install_main_dir}/bin/tmq_sim ] && ${csudo} ln -s ${install_main_dir}/bin/tmq_sim ${bin_link_dir}/tmq_sim || : +# [ -x ${install_main_dir}/bin/taosdemo ] && ${csudo} ln -s ${install_main_dir}/bin/taosdemo ${bin_link_dir}/taosdemo || : +# [ -x ${install_main_dir}/bin/taosdump ] && ${csudo} ln -s ${install_main_dir}/bin/taosdump ${bin_link_dir}/taosdump || : + [ -x ${install_main_dir}/bin/remove.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove.sh ${bin_link_dir}/rmtaos || : +# [ -x ${install_main_dir}/bin/set_core.sh ] && ${csudo} ln -s ${install_main_dir}/bin/set_core.sh ${bin_link_dir}/set_core || : +} + +function install_lib() { + # Remove links + ${csudo} rm -f ${lib_link_dir}/libtaos.* || : + ${csudo} rm -f ${lib64_link_dir}/libtaos.* || : + + ${csudo} ln -s ${install_main_dir}/lib/libtaos.* ${lib_link_dir}/libtaos.so.1 + ${csudo} ln -s ${lib_link_dir}/libtaos.so.1 ${lib_link_dir}/libtaos.so + + ${csudo} ln -s ${install_main_dir}/lib/libtdb.* ${lib_link_dir}/libtdb.so.1 + ${csudo} ln -s ${lib_link_dir}/libtdb.so.1 ${lib_link_dir}/libtdb.so + + if [[ -d ${lib64_link_dir} && ! -e ${lib64_link_dir}/libtaos.so ]]; then + ${csudo} ln -s ${install_main_dir}/lib/libtaos.* ${lib64_link_dir}/libtaos.so.1 || : + ${csudo} ln -s ${lib64_link_dir}/libtaos.so.1 ${lib64_link_dir}/libtaos.so || : + + ${csudo} ln -s ${install_main_dir}/lib/libtdb.* ${lib64_link_dir}/libtdb.so.1 || : + ${csudo} ln -s ${lib64_link_dir}/libtdb.so.1 ${lib64_link_dir}/libtdb.so || : + fi + + ${csudo} ldconfig +} + +function install_header() { + ${csudo} rm -f ${inc_link_dir}/taos.h ${inc_link_dir}/taosdef.h ${inc_link_dir}/taoserror.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 +} + +function add_newHostname_to_hosts() { + localIp="127.0.0.1" + OLD_IFS="$IFS" + IFS=" " + iphost=$(cat /etc/hosts | grep $1 | awk '{print $1}') + arr=($iphost) + IFS="$OLD_IFS" + for s in "${arr[@]}" + do + if [[ "$s" == "$localIp" ]]; then + return + fi + done + ${csudo} echo "127.0.0.1 $1" >> /etc/hosts ||: +} + +function set_hostname() { + echo -e -n "${GREEN}Please enter one hostname(must not be 'localhost')${NC}:" + read newHostname + while true; do + if [[ ! -z "$newHostname" && "$newHostname" != "localhost" ]]; then + break + else + read -p "Please enter one hostname(must not be 'localhost'):" newHostname + fi + done + + ${csudo} hostname $newHostname ||: + retval=`echo $?` + if [[ $retval != 0 ]]; then + echo + echo "set hostname fail!" + return + fi + #echo -e -n "$(hostnamectl status --static)" + #echo -e -n "$(hostnamectl status --transient)" + #echo -e -n "$(hostnamectl status --pretty)" + + #ubuntu/centos /etc/hostname + if [[ -e /etc/hostname ]]; then + ${csudo} echo $newHostname > /etc/hostname ||: + fi + + #debian: #HOSTNAME=yourname + if [[ -e /etc/sysconfig/network ]]; then + ${csudo} sed -i -r "s/#*\s*(HOSTNAME=\s*).*/\1$newHostname/" /etc/sysconfig/network ||: + fi + + ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$newHostname/" ${cfg_install_dir}/taos.cfg + serverFqdn=$newHostname + + if [[ -e /etc/hosts ]]; then + add_newHostname_to_hosts $newHostname + fi +} + +function is_correct_ipaddr() { + newIp=$1 + OLD_IFS="$IFS" + IFS=" " + arr=($iplist) + IFS="$OLD_IFS" + for s in "${arr[@]}" + do + if [[ "$s" == "$newIp" ]]; then + return 0 + fi + done + + return 1 +} + +function set_ipAsFqdn() { + iplist=$(ip address |grep inet |grep -v inet6 |grep -v 127.0.0.1 |awk '{print $2}' |awk -F "/" '{print $1}') ||: + if [ -z "$iplist" ]; then + iplist=$(ifconfig |grep inet |grep -v inet6 |grep -v 127.0.0.1 |awk '{print $2}' |awk -F ":" '{print $2}') ||: + fi + + if [ -z "$iplist" ]; then + echo + echo -e -n "${GREEN}Unable to get local ip, use 127.0.0.1${NC}" + localFqdn="127.0.0.1" + # Write the local FQDN to configuration file + ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg + serverFqdn=$localFqdn + echo + return + fi + + echo -e -n "${GREEN}Please choose an IP from local IP list${NC}:" + echo + echo -e -n "${GREEN}$iplist${NC}" + echo + echo + echo -e -n "${GREEN}Notes: if IP is used as the node name, data can NOT be migrated to other machine directly${NC}:" + read localFqdn + while true; do + if [ ! -z "$localFqdn" ]; then + # Check if correct ip address + is_correct_ipaddr $localFqdn + retval=`echo $?` + if [[ $retval != 0 ]]; then + read -p "Please choose an IP from local IP list:" localFqdn + else + # Write the local FQDN to configuration file + ${csudo} sed -i -r "s/#*\s*(fqdn\s*).*/\1$localFqdn/" ${cfg_install_dir}/taos.cfg + serverFqdn=$localFqdn + break + fi + else + read -p "Please choose an IP from local IP list:" localFqdn + fi + done +} + +function local_fqdn_check() { + #serverFqdn=$(hostname) + echo + echo -e -n "System hostname is: ${GREEN}$serverFqdn${NC}" + echo + if [[ "$serverFqdn" == "" ]] || [[ "$serverFqdn" == "localhost" ]]; then + echo -e -n "${GREEN}It is strongly recommended to configure a hostname for this machine ${NC}" + echo + + while true + do + read -r -p "Set hostname now? [Y/n] " input + if [ ! -n "$input" ]; then + set_hostname + break + else + case $input in + [yY][eE][sS]|[yY]) + set_hostname + break + ;; + + [nN][oO]|[nN]) + set_ipAsFqdn + break + ;; + + *) + echo "Invalid input..." + ;; + esac + fi + done + fi +} + +function install_log() { + ${csudo} rm -rf ${log_dir} || : + ${csudo} mkdir -p ${log_dir} && ${csudo} chmod 777 ${log_dir} + + ${csudo} ln -s ${log_dir} ${install_main_dir}/log +} + +function install_data() { + ${csudo} mkdir -p ${data_dir} + + ${csudo} ln -s ${data_dir} ${install_main_dir}/data +} + +function clean_service_on_systemd() { + taosd_service_config="${service_config_dir}/taosd.service" + if systemctl is-active --quiet taosd; then + echo "TDengine is running, stopping it..." + ${csudo} systemctl stop taosd &> /dev/null || echo &> /dev/null + fi + ${csudo} systemctl disable taosd &> /dev/null || echo &> /dev/null + ${csudo} rm -f ${taosd_service_config} + + 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} + + if [ "$verMode" == "cluster" ]; then + nginx_service_config="${service_config_dir}/nginxd.service" + if systemctl is-active --quiet nginxd; then + echo "Nginx for TDengine is running, stopping it..." + ${csudo} systemctl stop nginxd &> /dev/null || echo &> /dev/null + fi + ${csudo} systemctl disable nginxd &> /dev/null || echo &> /dev/null + ${csudo} rm -f ${nginx_service_config} + fi +} + +# taos:2345:respawn:/etc/init.d/taosd start + +function install_service_on_systemd() { + clean_service_on_systemd + + taosd_service_config="${service_config_dir}/taosd.service" + ${csudo} bash -c "echo '[Unit]' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'Description=TDengine server service' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'After=network-online.target taosadapter.service' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'Wants=network-online.target taosadapter.service' >> ${taosd_service_config}" + ${csudo} bash -c "echo >> ${taosd_service_config}" + ${csudo} bash -c "echo '[Service]' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'Type=simple' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'ExecStart=/usr/bin/taosd' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'ExecStartPre=/usr/local/taos/bin/startPre.sh' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'TimeoutStopSec=1000000s' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'LimitNOFILE=infinity' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'LimitNPROC=infinity' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'LimitCORE=infinity' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'TimeoutStartSec=0' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'StandardOutput=null' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'Restart=always' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'StartLimitBurst=3' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'StartLimitInterval=60s' >> ${taosd_service_config}" + #${csudo} bash -c "echo 'StartLimitIntervalSec=60s' >> ${taosd_service_config}" + ${csudo} bash -c "echo >> ${taosd_service_config}" + ${csudo} bash -c "echo '[Install]' >> ${taosd_service_config}" + ${csudo} bash -c "echo 'WantedBy=multi-user.target' >> ${taosd_service_config}" + ${csudo} systemctl enable taosd + + ${csudo} systemctl daemon-reload +} + +function install_service() { + if ((${service_mod}==0)); then + install_service_on_systemd + elif ((${service_mod}==1)); then + install_service_on_sysvinit + else + # must manual stop taosd + kill_process taosd + fi +} + +function install_TDengine() { + # Start to install + echo -e "${GREEN}Start to install TDengine...${NC}" + + install_main_path + install_data + install_log + install_header + install_lib + + if [ -z $1 ]; then # install service and client + # For installing new + install_bin + install_service + #install_config + + # Ask if to start the service + #echo + #echo -e "\033[44;32;1mTDengine is installed successfully!${NC}" + echo + echo -e "${GREEN_DARK}To configure TDengine ${NC}: edit /etc/taos/taos.cfg" + if ((${service_mod}==0)); then + echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} systemctl start taosd${NC}" + elif ((${service_mod}==1)); then + echo -e "${GREEN_DARK}To start TDengine ${NC}: ${csudo} service taosd start${NC}" + else + echo -e "${GREEN_DARK}To start TDengine ${NC}: taosd${NC}" + fi + + if [ ! -z "$firstEp" ]; then + tmpFqdn=${firstEp%%:*} + substr=":" + if [[ $firstEp =~ $substr ]];then + tmpPort=${firstEp#*:} + else + tmpPort="" + fi + if [[ "$tmpPort" != "" ]];then + echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $tmpFqdn -P $tmpPort${GREEN_DARK} to login into cluster, then${NC}" + else + echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $tmpFqdn${GREEN_DARK} to login into cluster, then${NC}" + fi + echo -e "${GREEN_DARK}execute ${NC}: create dnode 'newDnodeFQDN:port'; ${GREEN_DARK}to add this new node${NC}" + echo + elif [ ! -z "$serverFqdn" ]; then + echo -e "${GREEN_DARK}To access TDengine ${NC}: taos -h $serverFqdn${GREEN_DARK} to login into TDengine server${NC}" + echo + fi + + echo -e "\033[44;32;1mTDengine is installed successfully!${NC}" + echo + else # Only install client + install_bin + #install_config + echo + echo -e "\033[44;32;1mTDengine client is installed successfully!${NC}" + fi + + touch ~/.taos_history +} + + +## ==============================Main program starts from here============================ +serverFqdn=$(hostname) +if [ "$verType" == "server" ]; then + # Install server and client + install_TDengine +elif [ "$verType" == "client" ]; then + interactiveFqdn=no + # Only install client + install_TDengine client +else + echo "please input correct verType" +fi diff --git a/packaging/release.sh b/packaging/release.sh index 8ea30223a6f0c7d1f30d610442634605ffebc5b3..5219b1b7b18d1901ead5fb56b6c7a685e7432047 100755 --- a/packaging/release.sh +++ b/packaging/release.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Generate the deb package for ubuntu, or rpm package for centos, or tar.gz package for other linux os +# Generate the tar.gz package for linux os set -e #set -x @@ -17,9 +17,12 @@ echo "=======================new version number: ${verNumber}=================== build_time=$(date +"%F %R") +echo "script_dir: ${script_dir}" echo "top_dir: ${top_dir}" cd ${top_dir} +git checkout -- . +git checkout 3.0 git pull || : echo "curr_dir: ${curr_dir}" @@ -49,28 +52,38 @@ cd ${release_dir} install_dir="${release_dir}/TDengine-server-${version}" mkdir -p ${install_dir} +mkdir -p ${install_dir}/bin mkdir -p ${install_dir}/lib - -bin_files="${compile_dir}/source/dnode/mgmt/daemon/taosd ${compile_dir}/tools/shell/taos ${compile_dir}/tests/test/c/create_table" -cp ${bin_files} ${install_dir}/ && chmod a+x ${install_dir}/* || : - - -cp ${compile_dir}/source/client/libtaos.so ${install_dir}/lib/ -cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/ -cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/ -cp ${compile_dir}/source/dnode/snode/libsnode.so ${install_dir}/lib/ -cp ${compile_dir}/source/dnode/bnode/libbnode.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/wal/libwal.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/scheduler/libscheduler.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/planner/libplanner.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/parser/libparser.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/qcom/libqcom.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/transport/libtransport.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/function/libfunction.so ${install_dir}/lib/ -cp ${compile_dir}/source/common/libcommon.so ${install_dir}/lib/ -cp ${compile_dir}/source/os/libos.so ${install_dir}/lib/ -cp ${compile_dir}/source/dnode/mnode/sdb/libsdb.so ${install_dir}/lib/ -cp ${compile_dir}/source/libs/catalog/libcatalog.so ${install_dir}/lib/ +mkdir -p ${install_dir}/inc + +install_files="${script_dir}/install.sh" +chmod a+x ${script_dir}/install.sh || : +cp ${install_files} ${install_dir} + +header_files="${top_dir}/include/client/taos.h ${top_dir}/include/util/taoserror.h" +cp ${header_files} ${install_dir}/inc + +bin_files="${compile_dir}/source/dnode/mgmt/taosd ${compile_dir}/tools/shell/taos ${compile_dir}/tests/test/c/create_table ${compile_dir}/tests/test/c/tmq_sim ${script_dir}/remove.sh" +cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : + +cp ${compile_dir}/source/client/libtaos.so ${install_dir}/lib/ +cp ${compile_dir}/source/libs/tdb/libtdb.so ${install_dir}/lib/ + +#cp ${compile_dir}/source/dnode/mnode/impl/libmnode.so ${install_dir}/lib/ +#cp ${compile_dir}/source/dnode/qnode/libqnode.so ${install_dir}/lib/ +#cp ${compile_dir}/source/dnode/snode/libsnode.so ${install_dir}/lib/ +#cp ${compile_dir}/source/dnode/bnode/libbnode.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/wal/libwal.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/scheduler/libscheduler.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/planner/libplanner.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/parser/libparser.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/qcom/libqcom.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/transport/libtransport.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/function/libfunction.so ${install_dir}/lib/ +#cp ${compile_dir}/source/common/libcommon.so ${install_dir}/lib/ +#cp ${compile_dir}/source/os/libos.so ${install_dir}/lib/ +#cp ${compile_dir}/source/dnode/mnode/sdb/libsdb.so ${install_dir}/lib/ +#cp ${compile_dir}/source/libs/catalog/libcatalog.so ${install_dir}/lib/ pkg_name=${install_dir}-Linux-x64 diff --git a/packaging/remove.sh b/packaging/remove.sh new file mode 100644 index 0000000000000000000000000000000000000000..3b043f44a330199640af34f550afa40c6e12e111 --- /dev/null +++ b/packaging/remove.sh @@ -0,0 +1,148 @@ +#!/bin/bash +# +# Script to stop the service and uninstall TDengine, but retain the config, data and log files. + +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/taos" +data_link_dir="/usr/local/taos/data" +log_link_dir="/usr/local/taos/log" +cfg_link_dir="/usr/local/taos/cfg" +bin_link_dir="/usr/bin" +lib_link_dir="/usr/lib" +lib64_link_dir="/usr/lib64" +inc_link_dir="/usr/include" + +service_config_dir="/etc/systemd/system" +taos_service_name="taosd" + +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_taosd() { + pid=$(ps -ef | grep "taosd" | 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 || : +} + +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.* || : +} + +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 || : +} + +function clean_config() { + # Remove link + ${csudo} rm -f ${cfg_link_dir}/* || : +} + +function clean_log() { + # 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 + fi + ${csudo} systemctl disable ${taos_service_name} &> /dev/null || echo &> /dev/null + ${csudo} rm -f ${taosd_service_config} +} + +function clean_service_on_sysvinit() { + echo " " +} + +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 +} + +# Stop service and disable booting start. +clean_service +# Remove binary file and links +clean_bin +# Remove header file. +clean_header +# Remove lib file +clean_lib +# Remove link log directory +clean_log +# Remove link configuration file +clean_config +# Remove data link directory +${csudo} rm -rf ${data_link_dir} || : + +${csudo} rm -rf ${install_main_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}" +echo diff --git a/source/dnode/mgmt/mm/mmHandle.c b/source/dnode/mgmt/mm/mmHandle.c index acf83d4ba831822d782a32f2dc7a74af800ecef6..dc7725dcd2686826b98b31cb4c1d1f966fafe406 100644 --- a/source/dnode/mgmt/mm/mmHandle.c +++ b/source/dnode/mgmt/mm/mmHandle.c @@ -150,6 +150,7 @@ void mmInitMsgHandle(SMgmtWrapper *pWrapper) { // Requests handled by VNODE dndSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CONN_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_REB_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); + dndSetMsgHandle(pWrapper, TDMT_VND_MQ_CANCEL_CONN_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_CREATE_STB_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_ALTER_STB_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_DROP_STB_RSP, mmProcessWriteMsg, DEFAULT_HANDLE); diff --git a/source/dnode/mgmt/vm/vmHandle.c b/source/dnode/mgmt/vm/vmHandle.c index bcb9ef9e5a4ec780f218aca91a4ba4cc39dd64f0..52af9cac60fb4da65eecd4f5f1087dda9ad2507a 100644 --- a/source/dnode/mgmt/vm/vmHandle.c +++ b/source/dnode/mgmt/vm/vmHandle.c @@ -271,6 +271,7 @@ void vmInitMsgHandle(SMgmtWrapper *pWrapper) { dndSetMsgHandle(pWrapper, TDMT_VND_SHOW_TABLES_FETCH, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_REB, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); + dndSetMsgHandle(pWrapper, TDMT_VND_MQ_CANCEL_CONN, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_MQ_SET_CUR, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_CONSUME, (NodeMsgFp)vmProcessFetchMsg, DEFAULT_HANDLE); dndSetMsgHandle(pWrapper, TDMT_VND_TASK_DEPLOY, (NodeMsgFp)vmProcessWriteMsg, DEFAULT_HANDLE); diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index 2e297865a0ab8cc6efc264b4ccdb3ff4ee6611df..8078338238ec2f9b0f4a53722034f6db365b28e5 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -61,6 +61,7 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT const SMqConsumerEp *pConsumerEp); static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp); +static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp, const char* oldTopicName); int32_t mndInitSubscribe(SMnode *pMnode) { SSdbTable table = {.sdbType = SDB_SUBSCRIBE, @@ -74,6 +75,7 @@ int32_t mndInitSubscribe(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_MND_SUBSCRIBE, mndProcessSubscribeReq); mndSetMsgHandle(pMnode, TDMT_VND_MQ_SET_CONN_RSP, mndProcessSubscribeInternalRsp); mndSetMsgHandle(pMnode, TDMT_VND_MQ_REB_RSP, mndProcessSubscribeInternalRsp); + mndSetMsgHandle(pMnode, TDMT_VND_MQ_CANCEL_CONN_RSP, mndProcessSubscribeInternalRsp); mndSetMsgHandle(pMnode, TDMT_MND_MQ_TIMER, mndProcessMqTimerMsg); mndSetMsgHandle(pMnode, TDMT_MND_GET_SUB_EP, mndProcessGetSubEpReq); mndSetMsgHandle(pMnode, TDMT_MND_MQ_DO_REBALANCE, mndProcessDoRebalanceMsg); @@ -154,11 +156,14 @@ static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqC return 0; } -static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp) { - SMqSetCVgReq req = {0}; +static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp, const char* oldTopicName) { + SMqCancelConnReq req = {0}; req.consumerId = pConsumerEp->consumerId; + req.vgId = pConsumerEp->vgId; + req.epoch = pConsumerEp->epoch; + strcpy(req.topicName, oldTopicName); - int32_t tlen = tEncodeSMqSetCVgReq(NULL, &req); + int32_t tlen = tEncodeSMqCancelConnReq(NULL, &req); void *buf = taosMemoryMalloc(sizeof(SMsgHead) + tlen); if (buf == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; @@ -169,16 +174,16 @@ static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsum pMsgHead->contLen = htonl(sizeof(SMsgHead) + tlen); pMsgHead->vgId = htonl(pConsumerEp->vgId); void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); - tEncodeSMqSetCVgReq(&abuf, &req); + tEncodeSMqCancelConnReq(&abuf, &req); *pBuf = buf; *pLen = tlen; return 0; } -static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) { +static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp, const char* oldTopicName) { void *buf; int32_t tlen; - if (mndBuildCancelConnReq(&buf, &tlen, pConsumerEp) < 0) { + if (mndBuildCancelConnReq(&buf, &tlen, pConsumerEp, oldTopicName) < 0) { return -1; } @@ -189,7 +194,7 @@ static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMq action.epSet = mndGetVgroupEpset(pMnode, pVgObj); action.pCont = buf; action.contLen = sizeof(SMsgHead) + tlen; - action.msgType = TDMT_VND_MQ_SET_CONN; + action.msgType = TDMT_VND_MQ_CANCEL_CONN; mndReleaseVgroup(pMnode, pVgObj); if (mndTransAppendRedoAction(pTrans, &action) != 0) { @@ -365,7 +370,7 @@ static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) { if (status == MQ_CONSUMER_STATUS__MODIFY) { int32_t removeSz = taosArrayGetSize(pConsumer->recentRemovedTopics); for (int32_t i = 0; i < removeSz; i++) { - char *topicName = taosArrayGet(pConsumer->recentRemovedTopics, i); + char *topicName = taosArrayGetP(pConsumer->recentRemovedTopics, i); taosMemoryFree(topicName); } taosArrayClear(pConsumer->recentRemovedTopics); @@ -797,7 +802,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) { int32_t vgsz = taosArrayGetSize(pSubConsumer->vgInfo); for (int32_t vgi = 0; vgi < vgsz; vgi++) { SMqConsumerEp *pConsumerEp = taosArrayGet(pSubConsumer->vgInfo, vgi); - mndPersistCancelConnReq(pMnode, pTrans, pConsumerEp); + mndPersistCancelConnReq(pMnode, pTrans, pConsumerEp, oldTopicName); taosArrayPush(pSub->unassignedVg, pConsumerEp); } taosArrayRemove(pSub->consumers, ci); @@ -859,7 +864,7 @@ static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg) { } } - if (oldSub) taosArrayDestroyEx(oldSub, (void (*)(void *))taosMemoryFree); + /*if (oldSub) taosArrayDestroyEx(oldSub, (void (*)(void *))taosMemoryFree);*/ // persist consumerObj SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pConsumer); diff --git a/source/dnode/vnode/inc/tsdb.h b/source/dnode/vnode/inc/tsdb.h index 38d6d879fa50b820777cfad5f692921e35a800a0..9e391a1b7c32dffca19737284bfef1c37def8cb1 100644 --- a/source/dnode/vnode/inc/tsdb.h +++ b/source/dnode/vnode/inc/tsdb.h @@ -88,14 +88,18 @@ int tsdbInsertData(STsdb *pTsdb, SSubmitReq *pMsg, SSubmitRsp *pRsp); int tsdbPrepareCommit(STsdb *pTsdb); int tsdbCommit(STsdb *pTsdb); + +int32_t tsdbInitSma(STsdb *pTsdb); +int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg); +int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg); /** * @brief When submit msg received, update the relative expired window synchronously. - * - * @param pTsdb - * @param msg - * @return int32_t + * + * @param pTsdb + * @param msg + * @return int32_t */ -int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, const char *msg); +int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, SSubmitReq *pMsg); /** * @brief Insert tSma(Time-range-wise SMA) data from stream computing engine diff --git a/source/dnode/vnode/src/inc/tsdbDef.h b/source/dnode/vnode/src/inc/tsdbDef.h index 3e42cb627a7456beff75bee8efc1340407f566af..7e79b4a30ccbfd1603dc0d3f1a0133e1bbbdf02a 100644 --- a/source/dnode/vnode/src/inc/tsdbDef.h +++ b/source/dnode/vnode/src/inc/tsdbDef.h @@ -46,7 +46,7 @@ extern "C" { struct STsdb { int32_t vgId; bool repoLocked; - TdThreadMutex mutex; + TdThreadMutex mutex; char * path; STsdbCfg config; STsdbMemTable * mem; @@ -56,17 +56,19 @@ struct STsdb { STsdbFS * fs; SMeta * pMeta; STfs * pTfs; - SSmaEnv * pTSmaEnv; - SSmaEnv * pRSmaEnv; + SSmaEnvs smaEnvs; }; -#define REPO_ID(r) ((r)->vgId) -#define REPO_CFG(r) (&(r)->config) -#define REPO_FS(r) (r)->fs -#define REPO_META(r) (r)->pMeta -#define REPO_TFS(r) (r)->pTfs -#define IS_REPO_LOCKED(r) (r)->repoLocked -#define REPO_SMA_ENV(r, t) ((TSDB_SMA_TYPE_ROLLUP == (t)) ? (r)->pRSmaEnv : (r)->pTSmaEnv) +#define REPO_ID(r) ((r)->vgId) +#define REPO_CFG(r) (&(r)->config) +#define REPO_FS(r) ((r)->fs) +#define REPO_META(r) ((r)->pMeta) +#define REPO_TFS(r) ((r)->pTfs) +#define IS_REPO_LOCKED(r) ((r)->repoLocked) +#define REPO_TSMA_NUM(r) ((r)->smaEnvs.nTSma) +#define REPO_RSMA_NUM(r) ((r)->smaEnvs.nRSma) +#define REPO_TSMA_ENV(r) ((r)->smaEnvs.pTSmaEnv) +#define REPO_RSMA_ENV(r) ((r)->smaEnvs.pRSmaEnv) int tsdbLockRepo(STsdb *pTsdb); int tsdbUnlockRepo(STsdb *pTsdb); diff --git a/source/dnode/vnode/src/inc/tsdbSma.h b/source/dnode/vnode/src/inc/tsdbSma.h index da0a6856ab02ff255bc7546dacc604a0bae8e7e7..ebeb67261d413036e22f1017c76fd9ed6fbe4c32 100644 --- a/source/dnode/vnode/src/inc/tsdbSma.h +++ b/source/dnode/vnode/src/inc/tsdbSma.h @@ -18,8 +18,9 @@ #define TSDB_SMA_TEST // remove after test finished -typedef struct SSmaStat SSmaStat; -typedef struct SSmaEnv SSmaEnv; +typedef struct SSmaStat SSmaStat; +typedef struct SSmaEnv SSmaEnv; +typedef struct SSmaEnvs SSmaEnvs; struct SSmaEnv { TdThreadRwlock lock; @@ -36,6 +37,13 @@ struct SSmaEnv { #define SMA_ENV_STAT(env) ((env)->pStat) #define SMA_ENV_STAT_ITEMS(env) ((env)->pStat->smaStatItems) +struct SSmaEnvs { + int16_t nTSma; + int16_t nRSma; + SSmaEnv *pTSmaEnv; + SSmaEnv *pRSmaEnv; +}; + void tsdbDestroySmaEnv(SSmaEnv *pSmaEnv); void *tsdbFreeSmaEnv(SSmaEnv *pSmaEnv); #if 0 diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index aa4a9fc1de9b71ed0b6ac420d7ab0ce989f36ab5..598c8c07bcf20c95de14db1c57011aa9f2f56b3b 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -197,6 +197,7 @@ int tqCommit(STQ*); int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId); int32_t tqProcessSetConnReq(STQ* pTq, char* msg); int32_t tqProcessRebReq(STQ* pTq, char* msg); +int32_t tqProcessCancelConnReq(STQ* pTq, char* msg); int32_t tqProcessTaskExec(STQ* pTq, char* msg, int32_t msgLen, int32_t workerId); int32_t tqProcessTaskDeploy(STQ* pTq, char* msg, int32_t msgLen); int32_t tqProcessStreamTrigger(STQ* pTq, void* data, int32_t dataLen, int32_t workerId); diff --git a/source/dnode/vnode/src/meta/metaBDBImpl.c b/source/dnode/vnode/src/meta/metaBDBImpl.c index 9485c291aec41a5b7ba19841b5b5c218f205d8e7..caa101b5d064ef1cc636fe9e29c7a5dd6137ac85 100644 --- a/source/dnode/vnode/src/meta/metaBDBImpl.c +++ b/source/dnode/vnode/src/meta/metaBDBImpl.c @@ -912,7 +912,7 @@ SMSmaCursor *metaOpenSmaCursor(SMeta *pMeta, tb_uid_t uid) { pCur->uid = uid; // TODO: lock? ret = pDB->pCtbIdx->cursor(pDB->pSmaIdx, NULL, &(pCur->pCur), 0); - if (ret != 0) { + if ((ret != 0) || (pCur->pCur == NULL)) { taosMemoryFree(pCur); return NULL; } @@ -996,32 +996,31 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid) { } SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup) { - SArray * pUids = NULL; + SArray *pUids = NULL; SMetaDB *pDB = pMeta->pDB; - DBC * pCur = NULL; + DBC *pCur = NULL; DBT pkey = {0}, pval = {0}; uint32_t mode = isDup ? DB_NEXT_DUP : DB_NEXT_NODUP; int ret; - pUids = taosArrayInit(16, sizeof(tb_uid_t)); - - if (!pUids) { - return NULL; - } - // TODO: lock? ret = pDB->pCtbIdx->cursor(pDB->pSmaIdx, NULL, &pCur, 0); if (ret != 0) { - taosArrayDestroy(pUids); return NULL; } - - void *pBuf = NULL; - // TODO: lock? + while ((ret = pCur->get(pCur, &pkey, &pval, mode)) == 0) { - taosArrayPush(pUids, pkey.data); + if (!pUids) { + pUids = taosArrayInit(16, sizeof(tb_uid_t)); + if (!pUids) { + return NULL; + } + } + + taosArrayPush(pUids, pkey.data); } + // TODO: lock? if (pCur) { pCur->close(pCur); diff --git a/source/dnode/vnode/src/meta/metaTDBImpl.c b/source/dnode/vnode/src/meta/metaTDBImpl.c index 812ec84a9a20aa2c1fdccf78fb816241899e2944..36b3b53ccdfe03e886c8a8dcc55e672226c626b3 100644 --- a/source/dnode/vnode/src/meta/metaTDBImpl.c +++ b/source/dnode/vnode/src/meta/metaTDBImpl.c @@ -603,7 +603,7 @@ void metaCloseSmaCurosr(SMSmaCursor *pCur) { SArray *metaGetSmaTbUids(SMeta *pMeta, bool isDup) { // TODO - ASSERT(0); + // ASSERT(0); // comment this line to pass CI return NULL; } diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index fcea9b93c147c67a6fc941a871f59ee702f4c636..7af5cbc5e5c3af543f6aa1f0c30b605159b68ec7 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -81,6 +81,13 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t versi return -1; } memcpy(data, msg, msgLen); + + if (msgType == TDMT_VND_SUBMIT) { + if (tsdbUpdateSmaWindow(pTq->pVnode->pTsdb, msg) != 0) { + return -1; + } + } + SRpcMsg req = { .msgType = TDMT_VND_STREAM_TRIGGER, .pCont = data, @@ -534,6 +541,11 @@ int32_t tqProcessSetConnReq(STQ* pTq, char* msg) { return 0; } +int32_t tqProcessCancelConnReq(STQ* pTq, char* msg) { + terrno = TSDB_CODE_SUCCESS; + return 0; +} + int32_t tqExpandTask(STQ* pTq, SStreamTask* pTask, int32_t parallel) { if (pTask->execType == TASK_EXEC__NONE) return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbMain.c b/source/dnode/vnode/src/tsdb/tsdbMain.c index 526109f796021cc4e17704717a02ef413ff8806e..653c30c09173b648e6e0adc7587f75d027d2d8d3 100644 --- a/source/dnode/vnode/src/tsdb/tsdbMain.c +++ b/source/dnode/vnode/src/tsdb/tsdbMain.c @@ -80,9 +80,6 @@ static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, pTsdb->pmaf = pMAF; pTsdb->pMeta = pMeta; pTsdb->pTfs = pTfs; - pTsdb->pTSmaEnv = NULL; - pTsdb->pRSmaEnv = NULL; - pTsdb->fs = tsdbNewFS(pTsdbCfg); return pTsdb; @@ -90,8 +87,8 @@ static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, static void tsdbFree(STsdb *pTsdb) { if (pTsdb) { - tsdbFreeSmaEnv(pTsdb->pRSmaEnv); - tsdbFreeSmaEnv(pTsdb->pTSmaEnv); + tsdbFreeSmaEnv(REPO_TSMA_ENV(pTsdb)); + tsdbFreeSmaEnv(REPO_RSMA_ENV(pTsdb)); tsdbFreeFS(pTsdb->fs); taosMemoryFreeClear(pTsdb->path); taosMemoryFree(pTsdb); @@ -100,7 +97,10 @@ static void tsdbFree(STsdb *pTsdb) { static int tsdbOpenImpl(STsdb *pTsdb) { tsdbOpenFS(pTsdb); + + tsdbInitSma(pTsdb); // TODO + return 0; } diff --git a/source/dnode/vnode/src/tsdb/tsdbSma.c b/source/dnode/vnode/src/tsdb/tsdbSma.c index f04f4791b5491dfd3eebf3c08f5bf8aff1af8845..aacaf1b3ecd9e532d7b5aee2eadf4613b4dc08f7 100644 --- a/source/dnode/vnode/src/tsdb/tsdbSma.c +++ b/source/dnode/vnode/src/tsdb/tsdbSma.c @@ -20,6 +20,7 @@ static const char *TSDB_SMA_DNAME[] = { "tsma", // TSDB_SMA_TYPE_TIME_RANGE "rsma", // TSDB_SMA_TYPE_ROLLUP }; + #undef _TEST_SMA_PRINT_DEBUG_LOG_ #define SMA_STORAGE_TSDB_DAYS 30 #define SMA_STORAGE_TSDB_TIMES 10 @@ -81,7 +82,7 @@ struct SSmaStat { // declaration of static functions // expired window -static int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, const char *msg); +static int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg); static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t indexUid, int64_t winSKey); static int32_t tsdbInitSmaStat(SSmaStat **pSmaStat); static void *tsdbFreeSmaStatItem(SSmaStatItem *pSmaStatItem); @@ -117,6 +118,19 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg); static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid); // implementation +static FORCE_INLINE int16_t tsdbTSmaAdd(STsdb *pTsdb, int16_t n) { return atomic_add_fetch_16(&REPO_TSMA_NUM(pTsdb), n); } +static FORCE_INLINE int16_t tsdbTSmaSub(STsdb *pTsdb, int16_t n) { return atomic_sub_fetch_16(&REPO_TSMA_NUM(pTsdb), n); } + +int32_t tsdbInitSma(STsdb *pTsdb) { + // tSma + int32_t numOfTSma = taosArrayGetSize(metaGetSmaTbUids(pTsdb->pMeta, false)); + if (numOfTSma > 0) { + atomic_store_16(&REPO_TSMA_NUM(pTsdb), (int16_t)numOfTSma); + } + // TODO: rSma + return TSDB_CODE_SUCCESS; +} + static FORCE_INLINE int8_t tsdbSmaStat(SSmaStatItem *pStatItem) { if (pStatItem) { return atomic_load_8(&pStatItem->state); @@ -246,8 +260,9 @@ void *tsdbFreeSmaEnv(SSmaEnv *pSmaEnv) { static int32_t tsdbRefSmaStat(STsdb *pTsdb, SSmaStat *pStat) { if (pStat == NULL) return 0; + int ref = T_REF_INC(pStat); - tsdbDebug("vgId:%d ref sma stat %p ref %d", REPO_ID(pTsdb), pStat, ref); + tsdbDebug("vgId:%d ref sma stat:%p, val:%d", REPO_ID(pTsdb), pStat, ref); return 0; } @@ -255,7 +270,7 @@ static int32_t tsdbUnRefSmaStat(STsdb *pTsdb, SSmaStat *pStat) { if (pStat == NULL) return 0; int ref = T_REF_DEC(pStat); - tsdbDebug("vgId:%d unref sma stat %p ref %d", REPO_ID(pTsdb), pStat, ref); + tsdbDebug("vgId:%d unref sma stat:%p, val:%d", REPO_ID(pTsdb), pStat, ref); return 0; } @@ -339,12 +354,12 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { // return if already init switch (smaType) { case TSDB_SMA_TYPE_TIME_RANGE: - if ((pEnv = (SSmaEnv *)atomic_load_ptr(&pTsdb->pTSmaEnv)) != NULL) { + if ((pEnv = (SSmaEnv *)atomic_load_ptr(&REPO_TSMA_ENV(pTsdb))) != NULL) { return TSDB_CODE_SUCCESS; } break; case TSDB_SMA_TYPE_ROLLUP: - if ((pEnv = (SSmaEnv *)atomic_load_ptr(&pTsdb->pRSmaEnv)) != NULL) { + if ((pEnv = (SSmaEnv *)atomic_load_ptr(&REPO_RSMA_ENV(pTsdb))) != NULL) { return TSDB_CODE_SUCCESS; } break; @@ -355,7 +370,8 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { // init sma env tsdbLockRepo(pTsdb); - pEnv = (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_load_ptr(&pTsdb->pTSmaEnv) : atomic_load_ptr(&pTsdb->pRSmaEnv); + pEnv = (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_load_ptr(&REPO_TSMA_ENV(pTsdb)) + : atomic_load_ptr(&REPO_RSMA_ENV(pTsdb)); if (pEnv == NULL) { char rname[TSDB_FILENAME_LEN] = {0}; @@ -377,8 +393,8 @@ static int32_t tsdbCheckAndInitSmaEnv(STsdb *pTsdb, int8_t smaType) { return TSDB_CODE_FAILED; } - (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&pTsdb->pTSmaEnv, pEnv) - : atomic_store_ptr(&pTsdb->pRSmaEnv, pEnv); + (smaType == TSDB_SMA_TYPE_TIME_RANGE) ? atomic_store_ptr(&REPO_TSMA_ENV(pTsdb), pEnv) + : atomic_store_ptr(&REPO_RSMA_ENV(pTsdb), pEnv); } tsdbUnlockRepo(pTsdb); @@ -430,9 +446,12 @@ static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t taosHashCleanup(pItem->expiredWindows); taosMemoryFreeClear(pItem->pSma); taosHashRemove(pItemsHash, &indexUid, sizeof(indexUid)); + tsdbWarn("vgId:%d smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window fail", REPO_ID(pTsdb), indexUid, + winSKey); return TSDB_CODE_FAILED; } - tsdbDebug("vgId:%d smaIndex %" PRIi64 " tsKey %" PRIi64 " is put to hash", REPO_ID(pTsdb), indexUid, winSKey); + tsdbDebug("vgId:%d smaIndex %" PRIi64 ", put skey %" PRIi64 " to expire window succeed", REPO_ID(pTsdb), indexUid, + winSKey); } /** @@ -442,18 +461,21 @@ static int32_t tsdbSetExpiredWindow(STsdb *pTsdb, SHashObj *pItemsHash, int64_t * @param msg SSubmitReq * @return int32_t */ -int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, const char *msg) { - const SSubmitReq *pMsg = (const SSubmitReq *)msg; - - if (pMsg->length <= sizeof(SSubmitReq)) { - terrno = TSDB_CODE_TDB_SUBMIT_MSG_MSSED_UP; - return TSDB_CODE_FAILED; - } +int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg) { if (!pTsdb->pMeta) { terrno = TSDB_CODE_INVALID_PTR; return TSDB_CODE_FAILED; } + if (atomic_load_16(&REPO_TSMA_NUM(pTsdb)) <= 0) { + tsdbWarn("vgId:%d not update expire window since no tSma", REPO_ID(pTsdb)); + return TSDB_CODE_SUCCESS; + } + + if (tdScanAndConvertSubmitMsg(pMsg) != TSDB_CODE_SUCCESS) { + return TSDB_CODE_FAILED; + } + // TODO: decode the msg from Stream Computing module => start #ifdef TSDB_SMA_TESTx int64_t indexUid = SMA_TEST_INDEX_UID; @@ -480,7 +502,7 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, const char *msg) { // Firstly, assume that tSma can only be created on super table/normal table. // getActiveTimeWindow - SSmaEnv *pEnv = REPO_SMA_ENV(pTsdb, TSDB_SMA_TYPE_TIME_RANGE); + SSmaEnv *pEnv = REPO_TSMA_ENV(pTsdb); SSmaStat *pStat = SMA_ENV_STAT(pEnv); SHashObj *pItemsHash = SMA_ENV_STAT_ITEMS(pEnv); @@ -569,10 +591,12 @@ static int32_t tsdbResetExpiredWindow(STsdb *pTsdb, SSmaStat *pStat, int64_t ind if (taosHashRemove(pItem->expiredWindows, &skey, sizeof(TSKEY)) != 0) { // error handling tsdbUnRefSmaStat(pTsdb, pStat); - tsdbWarn("vgId:%d remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " failed", REPO_ID(pTsdb), + tsdbWarn("vgId:%d remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " fail", REPO_ID(pTsdb), skey, indexUid); return TSDB_CODE_FAILED; } + tsdbDebug("vgId:%d remove skey %" PRIi64 " from expired window for sma index %" PRIi64 " succeed", REPO_ID(pTsdb), + skey, indexUid); // TODO: use a standalone interface to received state upate notification from stream computing module. /** * @brief state @@ -651,13 +675,14 @@ static int32_t tsdbGetSmaStorageLevel(int64_t interval, int8_t intervalUnit) { */ static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t keyLen, void *pData, uint32_t dataLen) { SDBFile *pDBFile = &pSmaH->dFile; - printf("\nvgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 "\n", - REPO_ID(pSmaH->pTsdb), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen); - // TODO: insert sma data blocks into B+Tree(TDB) if (tsdbSaveSmaToDB(pDBFile, smaKey, keyLen, pData, dataLen) != 0) { + tsdbWarn("vgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " fail", + REPO_ID(pSmaH->pTsdb), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen); return TSDB_CODE_FAILED; } + tsdbDebug("vgId:%d insert sma data blocks into %s: smaKey %" PRIx64 "-%" PRIx64 ", dataLen %" PRIu32 " succeed", + REPO_ID(pSmaH->pTsdb), pDBFile->path, *(int64_t *)smaKey, *(int64_t *)POINTER_SHIFT(smaKey, 8), dataLen); #ifdef _TEST_SMA_PRINT_DEBUG_LOG_ uint32_t valueSize = 0; @@ -680,7 +705,6 @@ static int32_t tsdbInsertTSmaBlocks(STSmaWriteH *pSmaH, void *smaKey, uint32_t k * @return int64_t */ static int64_t tsdbGetIntervalByPrecision(int64_t interval, uint8_t intervalUnit, int8_t precision, bool adjusted) { - if (adjusted) { return interval; } @@ -814,7 +838,7 @@ static int32_t tsdbGetTSmaDays(STsdb *pTsdb, int64_t interval, int32_t storageLe static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char *msg) { STsdbCfg *pCfg = REPO_CFG(pTsdb); const SArray *pDataBlocks = (const SArray *)msg; - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); + SSmaEnv *pEnv = atomic_load_ptr(&REPO_TSMA_ENV(pTsdb)); if (pEnv == NULL) { terrno = TSDB_CODE_INVALID_PTR; @@ -834,7 +858,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char return TSDB_CODE_FAILED; } - SSmaStat *pStat = SMA_ENV_STAT(pTsdb->pTSmaEnv); + SSmaStat *pStat = SMA_ENV_STAT(pEnv); SSmaStatItem *pItem = NULL; tsdbRefSmaStat(pTsdb, pStat); @@ -849,7 +873,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char return TSDB_CODE_FAILED; } - STSma *pSma = pItem->pSma; + STSma *pSma = pItem->pSma; STSmaWriteH tSmaH = {0}; if (tsdbInitTSmaWriteH(&tSmaH, pTsdb, pDataBlocks, pSma->interval, pSma->intervalUnit) != 0) { @@ -874,27 +898,41 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char // key: skey + groupId char smaKey[SMA_KEY_LEN] = {0}; char dataBuf[512] = {0}; - void *pDataBuf = &dataBuf; + void *pDataBuf = NULL; int32_t sz = taosArrayGetSize(pDataBlocks); for (int32_t i = 0; i < sz; ++i) { - SSDataBlock *pDataBlock = *(SSDataBlock **)taosArrayGet(pDataBlocks, i); + SSDataBlock *pDataBlock = taosArrayGet(pDataBlocks, i); int32_t colNum = pDataBlock->info.numOfCols; int32_t rows = pDataBlock->info.rows; int32_t rowSize = pDataBlock->info.rowSize; int64_t groupId = pDataBlock->info.groupId; for (int32_t j = 0; j < rows; ++j) { printf("|"); - TSKEY skey = TSKEY_INITIAL_VAL; // the start key of TS window by interval - void *pSmaKey = &smaKey; - int32_t tlen = 0; + TSKEY skey = 1649295200000; // TSKEY_INITIAL_VAL; // the start key of TS window by interval + void *pSmaKey = &smaKey; + bool isStartKey = false; + { + // just for debugging + isStartKey = true; + tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); + } + int32_t tlen = 0; // reset the len + pDataBuf = &dataBuf; // reset the buf for (int32_t k = 0; k < colNum; ++k) { - SColumnInfoData *pColInfoData = *(SColumnInfoData **)taosArrayGet(pDataBlock->pDataBlock, k); + SColumnInfoData *pColInfoData = taosArrayGet(pDataBlock->pDataBlock, k); void *var = POINTER_SHIFT(pColInfoData->pData, j * pColInfoData->info.bytes); switch (pColInfoData->info.type) { case TSDB_DATA_TYPE_TIMESTAMP: - skey = *(TSKEY *)var; - printf("==> skey = %" PRIi64 " groupId = %" PRId64 "|", skey, groupId); - tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); + if (!isStartKey) { + isStartKey = true; + skey = *(TSKEY *)var; + printf("==> skey = %" PRIi64 " groupId = %" PRIi64 "|", skey, groupId); + tsdbEncodeTSmaKey(groupId, skey, &pSmaKey); + } else { + printf(" %" PRIi64 " |", *(int64_t *)var); + tlen += taosEncodeFixedI64(&pDataBuf, *(int64_t *)var); + break; + } break; case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_UTINYINT: @@ -918,6 +956,9 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char tlen += taosEncodeFixedI32(&pDataBuf, *(int32_t *)var); break; case TSDB_DATA_TYPE_FLOAT: + printf(" %15f |", *(float *)var); + tlen += taosEncodeBinary(&pDataBuf, var, sizeof(float)); + break; case TSDB_DATA_TYPE_UINT: printf(" %15u |", *(uint32_t *)var); tlen += taosEncodeFixedU32(&pDataBuf, *(uint32_t *)var); @@ -927,6 +968,8 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char tlen += taosEncodeFixedI64(&pDataBuf, *(int64_t *)var); break; case TSDB_DATA_TYPE_DOUBLE: + printf(" %15lf |", *(double *)var); + tlen += taosEncodeBinary(&pDataBuf, var, sizeof(double)); case TSDB_DATA_TYPE_UBIGINT: printf(" %15lu |", *(uint64_t *)var); tlen += taosEncodeFixedU64(&pDataBuf, *(uint64_t *)var); @@ -938,8 +981,8 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char tlen += taosEncodeBinary(&pDataBuf, varDataVal(var), varDataLen(var)); break; } - case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY - char tmpChar[100] = {0}; + case TSDB_DATA_TYPE_VARCHAR: { // TSDB_DATA_TYPE_BINARY + char tmpChar[100] = {0}; strncpy(tmpChar, varDataVal(var), varDataLen(var)); printf(" %s |", tmpChar); tlen += taosEncodeBinary(&pDataBuf, varDataVal(var), varDataLen(var)); @@ -954,7 +997,8 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char break; } } - if ((tlen > 0) && (skey != TSKEY_INITIAL_VAL)) { + // if ((tlen > 0) && (skey != TSKEY_INITIAL_VAL)) { + if (tlen > 0) { int32_t fid = (int32_t)(TSDB_KEY_FID(skey, daysPerFile, pCfg->precision)); // Step 2: Set the DFile for storage of SMA index, and iterate/split the TSma data and store to B+Tree index @@ -966,7 +1010,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char tsdbCloseDBF(&tSmaH.dFile); } tsdbSetTSmaDataFile(&tSmaH, indexUid, fid); - if (tsdbOpenDBF(pTsdb->pTSmaEnv->dbEnv, &tSmaH.dFile) != 0) { + if (tsdbOpenDBF(pEnv->dbEnv, &tSmaH.dFile) != 0) { tsdbWarn("vgId:%d open DB file %s failed since %s", REPO_ID(pTsdb), tSmaH.dFile.path ? tSmaH.dFile.path : "path is NULL", tstrerror(terrno)); tsdbDestroyTSmaWriteH(&tSmaH); @@ -975,21 +1019,20 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char } } - if (tsdbInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, pDataBuf, tlen) != 0) { - tsdbWarn("vgId:%d insert tSma data blocks failed for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64 + if (tsdbInsertTSmaBlocks(&tSmaH, &smaKey, SMA_KEY_LEN, dataBuf, tlen) != 0) { + tsdbWarn("vgId:%d insert tSma data blocks fail for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64 " since %s", REPO_ID(pTsdb), indexUid, skey, groupId, tstrerror(terrno)); tsdbDestroyTSmaWriteH(&tSmaH); tsdbUnRefSmaStat(pTsdb, pStat); return TSDB_CODE_FAILED; - } else { - tsdbWarn("vgId:%d insert tSma data blocks success for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64, - REPO_ID(pTsdb), indexUid, skey, groupId); } + tsdbDebug("vgId:%d insert tSma data blocks success for index %" PRIi64 ", skey %" PRIi64 ", groupId %" PRIi64, + REPO_ID(pTsdb), indexUid, skey, groupId); // TODO:tsdbEndTSmaCommit(); // Step 3: reset the SSmaStat - tsdbResetExpiredWindow(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv), indexUid, skey); + tsdbResetExpiredWindow(pTsdb, pStat, indexUid, skey); } else { tsdbWarn("vgId:%d invalid data skey:%" PRIi64 ", tlen %" PRIi32 " during insert tSma data for %" PRIi64, REPO_ID(pTsdb), skey, tlen, indexUid); @@ -1012,7 +1055,7 @@ static int32_t tsdbInsertTSmaDataImpl(STsdb *pTsdb, int64_t indexUid, const char * @return int32_t */ static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid) { - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); + SSmaEnv *pEnv = atomic_load_ptr(&REPO_TSMA_ENV(pTsdb)); // clear local cache if (pEnv) { @@ -1035,12 +1078,17 @@ static int32_t tsdbDropTSmaDataImpl(STsdb *pTsdb, int64_t indexUid) { tsdbUnLockSma(pEnv); int32_t nSleep = 0; + int32_t refVal = INT32_MAX; while (true) { - if (T_REF_VAL_GET(SMA_ENV_STAT(pEnv)) <= 0) { + if ((refVal = T_REF_VAL_GET(SMA_ENV_STAT(pEnv))) <= 0) { + tsdbDebug("vgId:%d drop index %" PRIi64 " since refVal=%d", REPO_ID(pTsdb), indexUid, refVal); break; } + tsdbDebug("vgId:%d wait 1s to drop index %" PRIi64 " since refVal=%d", REPO_ID(pTsdb), indexUid, refVal); taosSsleep(1); if (++nSleep > SMA_DROP_EXPIRED_TIME) { + tsdbDebug("vgId:%d drop index %" PRIi64 " after wait %d (refVal=%d)", REPO_ID(pTsdb), indexUid, nSleep, + refVal); break; }; } @@ -1066,7 +1114,7 @@ static int32_t tsdbSetRSmaDataFile(STSmaWriteH *pSmaH, int32_t fid) { static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg) { STsdbCfg *pCfg = REPO_CFG(pTsdb); const SArray *pDataBlocks = (const SArray *)msg; - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pRSmaEnv); + SSmaEnv *pEnv = atomic_load_ptr(&REPO_RSMA_ENV(pTsdb)); int64_t indexUid = SMA_TEST_INDEX_UID; if (pEnv == NULL) { @@ -1093,7 +1141,7 @@ static int32_t tsdbInsertRSmaDataImpl(STsdb *pTsdb, const char *msg) { return TSDB_CODE_FAILED; } - SSmaStat *pStat = SMA_ENV_STAT(pTsdb->pTSmaEnv); + SSmaStat *pStat = SMA_ENV_STAT(pEnv); SSmaStatItem *pItem = NULL; tsdbRefSmaStat(pTsdb, pStat); @@ -1241,7 +1289,8 @@ static bool tsdbSetAndOpenTSmaFile(STSmaReadH *pReadH, TSKEY *queryKey) { * @return int32_t */ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) { - SSmaEnv *pEnv = atomic_load_ptr(&pTsdb->pTSmaEnv); + SSmaEnv *pEnv = atomic_load_ptr(&REPO_TSMA_ENV(pTsdb)); + SSmaStat *pStat = NULL; if (!pEnv) { terrno = TSDB_CODE_INVALID_PTR; @@ -1249,12 +1298,14 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, return TSDB_CODE_FAILED; } - tsdbRefSmaStat(pTsdb, SMA_ENV_STAT(pEnv)); + pStat = SMA_ENV_STAT(pEnv); + + tsdbRefSmaStat(pTsdb, pStat); SSmaStatItem *pItem = taosHashGet(SMA_ENV_STAT_ITEMS(pEnv), &indexUid, sizeof(indexUid)); if ((pItem == NULL) || ((pItem = *(SSmaStatItem **)pItem) == NULL)) { // Normally pItem should not be NULL, mark all windows as expired and notify query module to fetch raw TS data if // it's NULL. - tsdbUnRefSmaStat(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv)); + tsdbUnRefSmaStat(pTsdb, pStat); terrno = TSDB_CODE_TDB_INVALID_ACTION; tsdbDebug("vgId:%d getTSmaDataImpl failed since no index %" PRIi64, REPO_ID(pTsdb), indexUid); return TSDB_CODE_FAILED; @@ -1273,7 +1324,7 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, #if 1 int8_t smaStat = 0; if (!tsdbSmaStatIsOK(pItem, &smaStat)) { // TODO: multiple check for large scale sma query - tsdbUnRefSmaStat(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv)); + tsdbUnRefSmaStat(pTsdb, pStat); terrno = TSDB_CODE_TDB_INVALID_SMA_STAT; tsdbWarn("vgId:%d getTSmaDataImpl failed from index %" PRIi64 " since %s %" PRIi8, REPO_ID(pTsdb), indexUid, tstrerror(terrno), smaStat); @@ -1291,18 +1342,16 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, STSma *pTSma = pItem->pSma; - - #endif STSmaReadH tReadH = {0}; tsdbInitTSmaReadH(&tReadH, pTsdb, pTSma->interval, pTSma->intervalUnit); tsdbCloseDBF(&tReadH.dFile); - - tsdbUnRefSmaStat(pTsdb, SMA_ENV_STAT(pTsdb->pTSmaEnv)); + + tsdbUnRefSmaStat(pTsdb, pStat); tsdbInitTSmaFile(&tReadH, indexUid, querySKey); - if (tsdbOpenDBF(SMA_ENV_ENV(pTsdb->pTSmaEnv), &tReadH.dFile) != 0) { + if (tsdbOpenDBF(pEnv->dbEnv, &tReadH.dFile) != 0) { tsdbWarn("vgId:%d open DBF %s failed since %s", REPO_ID(pTsdb), tReadH.dFile.path, tstrerror(terrno)); return TSDB_CODE_FAILED; } @@ -1359,6 +1408,60 @@ static int32_t tsdbGetTSmaDataImpl(STsdb *pTsdb, char *pData, int64_t indexUid, return TSDB_CODE_SUCCESS; } +int32_t tsdbCreateTSma(STsdb *pTsdb, char *pMsg) { + SSmaCfg vCreateSmaReq = {0}; + if (tDeserializeSVCreateTSmaReq(pMsg, &vCreateSmaReq) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + tsdbWarn("vgId:%d TDMT_VND_CREATE_SMA received but deserialize failed since %s", REPO_ID(pTsdb), terrstr(terrno)); + return -1; + } + tsdbDebug("vgId:%d TDMT_VND_CREATE_SMA msg received for %s:%" PRIi64, REPO_ID(pTsdb), vCreateSmaReq.tSma.indexName, + vCreateSmaReq.tSma.indexUid); + + // record current timezone of server side + vCreateSmaReq.tSma.timezoneInt = tsTimezone; + + if (metaCreateTSma(pTsdb->pMeta, &vCreateSmaReq) < 0) { + // TODO: handle error + tdDestroyTSma(&vCreateSmaReq.tSma); + return -1; + } + + tsdbTSmaAdd(pTsdb, 1); + + tdDestroyTSma(&vCreateSmaReq.tSma); + // TODO: return directly or go on follow steps? +} + +int32_t tsdbDropTSma(STsdb *pTsdb, char *pMsg) { + SVDropTSmaReq vDropSmaReq = {0}; + if (tDeserializeSVDropTSmaReq(pMsg, &vDropSmaReq) == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return -1; + } + + // TODO: send msg to stream computing to drop tSma + // if ((send msg to stream computing) < 0) { + // tdDestroyTSma(&vCreateSmaReq); + // return -1; + // } + // + + if (metaDropTSma(pTsdb->pMeta, vDropSmaReq.indexUid) < 0) { + // TODO: handle error + return -1; + } + + if (tsdbDropTSmaData(pTsdb, vDropSmaReq.indexUid) < 0) { + // TODO: handle error + return -1; + } + + tsdbTSmaSub(pTsdb, 1); + + // TODO: return directly or go on follow steps? +} + #if 0 /** * @brief Get the start TS key of the last data block of one interval/sliding. @@ -1404,9 +1507,9 @@ int32_t tsdbInsertTSmaData(STsdb *pTsdb, int64_t indexUid, const char *msg) { return code; } -int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, const char *msg) { +int32_t tsdbUpdateSmaWindow(STsdb *pTsdb, SSubmitReq *pMsg) { int32_t code = TSDB_CODE_SUCCESS; - if ((code = tsdbUpdateExpiredWindowImpl(pTsdb, msg)) < 0) { + if ((code = tsdbUpdateExpiredWindowImpl(pTsdb, pMsg)) < 0) { tsdbWarn("vgId:%d update expired sma window failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); } return code; @@ -1420,7 +1523,7 @@ int32_t tsdbInsertRSmaData(STsdb *pTsdb, char *msg) { return code; } -int32_t tsdbGetTSmaData(STsdb *pTsdb, char*pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) { +int32_t tsdbGetTSmaData(STsdb *pTsdb, char *pData, int64_t indexUid, TSKEY querySKey, int32_t nMaxResult) { int32_t code = TSDB_CODE_SUCCESS; if ((code = tsdbGetTSmaDataImpl(pTsdb, pData, indexUid, querySKey, nMaxResult)) < 0) { tsdbWarn("vgId:%d get tSma data failed since %s", REPO_ID(pTsdb), tstrerror(terrno)); diff --git a/source/dnode/vnode/src/vnd/vnodeWrite.c b/source/dnode/vnode/src/vnd/vnodeWrite.c index 7ef0b5040268da07d8fa5b2b84b1524f5f0d8d33..e841eb676192b8fe1390f93f0574d756a9911f99 100644 --- a/source/dnode/vnode/src/vnd/vnodeWrite.c +++ b/source/dnode/vnode/src/vnd/vnodeWrite.c @@ -191,6 +191,10 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { if (tqProcessRebReq(pVnode->pTq, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { } } break; + case TDMT_VND_MQ_CANCEL_CONN: { + if (tqProcessCancelConnReq(pVnode->pTq, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { + } + } break; case TDMT_VND_TASK_DEPLOY: { if (tqProcessTaskDeploy(pVnode->pTq, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), pMsg->contLen - sizeof(SMsgHead)) < 0) { @@ -202,17 +206,17 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { } } break; case TDMT_VND_CREATE_SMA: { // timeRangeSMA -#if 1 +#if 0 SSmaCfg vCreateSmaReq = {0}; if (tDeserializeSVCreateTSmaReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vCreateSmaReq) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; - vWarn("vgId%d: TDMT_VND_CREATE_SMA received but deserialize failed since %s", pVnode->config.vgId, + vWarn("vgId:%d TDMT_VND_CREATE_SMA received but deserialize failed since %s", pVnode->config.vgId, terrstr(terrno)); return -1; } - vWarn("vgId%d: TDMT_VND_CREATE_SMA received for %s:%" PRIi64, pVnode->config.vgId, vCreateSmaReq.tSma.indexName, - vCreateSmaReq.tSma.indexUid); + vDebug("vgId:%d TDMT_VND_CREATE_SMA msg received for %s:%" PRIi64, pVnode->config.vgId, + vCreateSmaReq.tSma.indexName, vCreateSmaReq.tSma.indexUid); // record current timezone of server side vCreateSmaReq.tSma.timezoneInt = tsTimezone; @@ -222,19 +226,24 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) { tdDestroyTSma(&vCreateSmaReq.tSma); return -1; } - // TODO: send msg to stream computing to create tSma - // if ((send msg to stream computing) < 0) { - // tdDestroyTSma(&vCreateSmaReq); - // return -1; - // } + + tsdbTSmaAdd(pVnode->pTsdb, 1); + tdDestroyTSma(&vCreateSmaReq.tSma); // TODO: return directly or go on follow steps? #endif + if (tsdbCreateTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { + // TODO + } } break; case TDMT_VND_CANCEL_SMA: { // timeRangeSMA } break; case TDMT_VND_DROP_SMA: { // timeRangeSMA + if (tsdbDropTSma(pVnode->pTsdb, POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead))) < 0) { + // TODO + } #if 0 + tsdbTSmaSub(pVnode->pTsdb, 1); SVDropTSmaReq vDropSmaReq = {0}; if (tDeserializeSVDropTSmaReq(POINTER_SHIFT(pMsg->pCont, sizeof(SMsgHead)), &vDropSmaReq) == NULL) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/vnode/test/tsdbSmaTest.cpp b/source/dnode/vnode/test/tsdbSmaTest.cpp index db31b9f4a3d6ef60a4a893b2f3349d6d5589e57f..37e2f188cdf2b83496b98403af7559ccd633ba6f 100644 --- a/source/dnode/vnode/test/tsdbSmaTest.cpp +++ b/source/dnode/vnode/test/tsdbSmaTest.cpp @@ -408,7 +408,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) { EXPECT_EQ(tdScanAndConvertSubmitMsg(pMsg), TSDB_CODE_SUCCESS); - EXPECT_EQ(tsdbUpdateSmaWindow(pTsdb, (const char *)pMsg), 0); + EXPECT_EQ(tsdbUpdateSmaWindow(pTsdb, pMsg), 0); // init const int32_t tSmaGroupSize = 4; diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index a6a1d6ea05ae92ddb823bab71850cf1d33fce50c..953c87bf7e4d2ef5c53626838476c97140d5843d 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -544,8 +544,9 @@ static SResultRow* doSetResultOutBufByKey_rv(SDiskbasedBuf* pResultBuf, SResultR existInCurrentResusltRowInfo = false; // this time window created by other timestamp that does not belongs to current table. assert(pResultRowInfo->curPos == -1); } else if (pResultRowInfo->size == 1) { - ASSERT(0); -// existInCurrentResusltRowInfo = (pResultRowInfo->pResult[0] == (*p1)); + // ASSERT(0); + SResultRowPosition* p = &pResultRowInfo->pPosition[0]; + existInCurrentResusltRowInfo = (p->pageId == p1->pageId && p->offset == p1->offset); } else { // check if current pResultRowInfo contains the existInCurrentResusltRowInfo pResultRow SET_RES_EXT_WINDOW_KEY(pSup->keyBuf, pData, bytes, tid, pResultRowInfo); int64_t* index = taosHashGet(pSup->pResultRowListSet, pSup->keyBuf, GET_RES_EXT_WINDOW_KEY_LEN(bytes)); @@ -597,6 +598,8 @@ static SResultRow* doSetResultOutBufByKey_rv(SDiskbasedBuf* pResultBuf, SResultR int64_t index = pResultRowInfo->curPos; SET_RES_EXT_WINDOW_KEY(pSup->keyBuf, pData, bytes, tid, pResultRowInfo); taosHashPut(pSup->pResultRowListSet, pSup->keyBuf, GET_RES_EXT_WINDOW_KEY_LEN(bytes), &index, POINTER_BYTES); + } else { + pResult = getResultRowByPos(pResultBuf, p1); } // too many time window in query @@ -1264,19 +1267,10 @@ static void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSData pResult->info.rows = pCtx[0].input.numOfRows; } else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) { - SVariant *pVal = pExpr[k].pExpr->pVal; - char *payload; - if (IS_VAR_DATA_TYPE(pVal->nType)) { - payload = taosMemoryCalloc(1, pVal->nLen + VARSTR_HEADER_SIZE); - } else { - payload = taosMemoryCalloc(1, tDataTypes[pVal->nType].bytes); - } - taosVariantDump(pVal, payload, pVal->nType, true); SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, k); for (int32_t i = 0; i < pSrcBlock->info.rows; ++i) { - colDataAppend(pColInfoData, i, payload, false); + colDataAppend(pColInfoData, i, taosVariantGet(&pExpr[k].base.pParam[0].param, pExpr[k].base.pParam[0].param.nType), TSDB_DATA_TYPE_NULL == pExpr[k].base.pParam[0].param.nType); } - taosMemoryFree(payload); pResult->info.rows = pSrcBlock->info.rows; } else if (pExpr[k].pExpr->nodeType == QUERY_NODE_OPERATOR) { SArray* pBlockList = taosArrayInit(4, POINTER_BYTES); @@ -1322,12 +1316,6 @@ static void projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSData pResult->info.rows = dest.numOfRows; taosArrayDestroy(pBlockList); } - } else if (pExpr[k].pExpr->nodeType == QUERY_NODE_VALUE) { - SColumnInfoData* pColInfoData = taosArrayGet(pResult->pDataBlock, k); - for (int32_t i = 0; i < pSrcBlock->info.rows; ++i) { - colDataAppend(pColInfoData, i, taosVariantGet(&pExpr[k].base.pParam[0].param, pExpr[k].base.pParam[0].type), TSDB_DATA_TYPE_NULL == pExpr[k].base.pParam[0].param.nType); - } - pResult->info.rows = pSrcBlock->info.rows; } else { ASSERT(0); } @@ -1627,7 +1615,8 @@ static SArray* hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe getNumOfRowsInTimeWindow(&pSDataBlock->info, tsCols, startPos, ekey, binarySearchForKey, NULL, TSDB_ORDER_ASC); // window start(end) key interpolation - doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->binfo.pCtx, pResult, &nextWin, startPos, forwardStep, pInfo->order, false); + doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->binfo.pCtx, pResult, &nextWin, startPos, forwardStep, + pInfo->order, false); updateTimeWindowInfo(&pInfo->timeWindowData, &nextWin, true); doApplyFunctions(pInfo->binfo.pCtx, &nextWin, &pInfo->timeWindowData, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput, TSDB_ORDER_ASC); @@ -6976,15 +6965,16 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* pExp->base.pParam[0].pCol = createColumn(pColNode->dataBlockId, pColNode->slotId, pType); pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN; } else if (nodeType(pTargetNode->pExpr) == QUERY_NODE_VALUE) { - pExp->pExpr->nodeType = QUERY_NODE_VALUE; - SValueNode* pValueNode = (SValueNode*)pTargetNode->pExpr; - SDataType* pType = &pValueNode->node.resType; - char *pDatum = nodesGetValueFromNode(pValueNode); - if (IS_VAR_DATA_TYPE(pType->type)) { - pDatum = varDataVal(pDatum); - } - pExp->pExpr->pVal = taosMemoryCalloc(1, sizeof(SVariant)); - taosVariantCreateFromBinary(pExp->pExpr->pVal, pDatum, pType->bytes, pType->type); + pExp->pExpr->nodeType = QUERY_NODE_VALUE; + SValueNode* pValNode = (SValueNode*)pTargetNode->pExpr; + + pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam)); + pExp->base.numOfParams = 1; + + SDataType* pType = &pValNode->node.resType; + pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale, pType->precision, pValNode->node.aliasName); + pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE; + valueNodeToVariant(pValNode, &pExp->base.pParam[0].param); } else if (nodeType(pTargetNode->pExpr) == QUERY_NODE_FUNCTION) { pExp->pExpr->nodeType = QUERY_NODE_FUNCTION; SFunctionNode* pFuncNode = (SFunctionNode*)pTargetNode->pExpr; @@ -7029,17 +7019,6 @@ SExprInfo* createExprInfo(SNodeList* pNodeList, SNodeList* pGroupKeys, int32_t* // pExp->base.pParam[0].type = FUNC_PARAM_TYPE_COLUMN; // pExp->base.pParam[0].pCol = createColumn(pTargetNode->dataBlockId, pTargetNode->slotId, pType); - } else if (nodeType(pTargetNode->pExpr) == QUERY_NODE_VALUE) { - pExp->pExpr->nodeType = QUERY_NODE_VALUE; - SValueNode* pValNode = (SValueNode*)pTargetNode->pExpr; - - pExp->base.pParam = taosMemoryCalloc(1, sizeof(SFunctParam)); - pExp->base.numOfParams = 1; - - SDataType* pType = &pValNode->node.resType; - pExp->base.resSchema = createResSchema(pType->type, pType->bytes, pTargetNode->slotId, pType->scale, pType->precision, pValNode->node.aliasName); - pExp->base.pParam[0].type = FUNC_PARAM_TYPE_VALUE; - valueNodeToVariant(pValNode, &pExp->base.pParam[0].param); } else { ASSERT(0); } diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 6cb1955307a24571cc6a74d91cf08e58da9be447..c3bc696a534cdc84a6dfc0314fd70ab3b59cc6ac 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -994,6 +994,7 @@ static int32_t jsonToPhysiExchangeNode(const SJson* pJson, void* pObj) { static const char* jkSortPhysiPlanExprs = "Exprs"; static const char* jkSortPhysiPlanSortKeys = "SortKeys"; +static const char* jkSortPhysiPlanTargets = "Targets"; static int32_t physiSortNodeToJson(const void* pObj, SJson* pJson) { const SSortPhysiNode* pNode = (const SSortPhysiNode*)pObj; @@ -1005,6 +1006,9 @@ static int32_t physiSortNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkSortPhysiPlanSortKeys, pNode->pSortKeys); } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkSortPhysiPlanTargets, pNode->pTargets); + } return code; } @@ -1019,6 +1023,9 @@ static int32_t jsonToPhysiSortNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkSortPhysiPlanSortKeys, &pNode->pSortKeys); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkSortPhysiPlanTargets, &pNode->pTargets); + } return code; } @@ -1177,6 +1184,7 @@ static int32_t jsonToPhysiStateWindowNode(const SJson* pJson, void* pObj) { static const char* jkPartitionPhysiPlanExprs = "Exprs"; static const char* jkPartitionPhysiPlanPartitionKeys = "PartitionKeys"; +static const char* jkPartitionPhysiPlanTargets = "Targets"; static int32_t physiPartitionNodeToJson(const void* pObj, SJson* pJson) { const SPartitionPhysiNode* pNode = (const SPartitionPhysiNode*)pObj; @@ -1188,6 +1196,9 @@ static int32_t physiPartitionNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = nodeListToJson(pJson, jkPartitionPhysiPlanPartitionKeys, pNode->pPartitionKeys); } + if (TSDB_CODE_SUCCESS == code) { + code = nodeListToJson(pJson, jkPartitionPhysiPlanTargets, pNode->pTargets); + } return code; } @@ -1202,6 +1213,9 @@ static int32_t jsonToPhysiPartitionNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeList(pJson, jkPartitionPhysiPlanPartitionKeys, &pNode->pPartitionKeys); } + if (TSDB_CODE_SUCCESS == code) { + code = jsonToNodeList(pJson, jkPartitionPhysiPlanTargets, &pNode->pTargets); + } return code; } diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c index e59a76ca3c7709bb883701c404c30b9faeec9266..3c102879924872993ed81f056352bb59d6bc263d 100644 --- a/source/libs/nodes/src/nodesTraverseFuncs.c +++ b/source/libs/nodes/src/nodesTraverseFuncs.c @@ -301,9 +301,10 @@ void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker wa case SQL_CLAUSE_GROUP_BY: nodesWalkExpr(pSelect->pHaving, walker, pContext); case SQL_CLAUSE_HAVING: - nodesWalkExprs(pSelect->pProjectionList, walker, pContext); - case SQL_CLAUSE_SELECT: + case SQL_CLAUSE_DISTINCT: nodesWalkExprs(pSelect->pOrderByList, walker, pContext); + case SQL_CLAUSE_ORDER_BY: + nodesWalkExprs(pSelect->pProjectionList, walker, pContext); default: break; } @@ -329,9 +330,10 @@ void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewrit case SQL_CLAUSE_GROUP_BY: nodesRewriteExpr(&(pSelect->pHaving), rewriter, pContext); case SQL_CLAUSE_HAVING: - nodesRewriteExprs(pSelect->pProjectionList, rewriter, pContext); - case SQL_CLAUSE_SELECT: + case SQL_CLAUSE_DISTINCT: nodesRewriteExprs(pSelect->pOrderByList, rewriter, pContext); + case SQL_CLAUSE_ORDER_BY: + nodesRewriteExprs(pSelect->pProjectionList, rewriter, pContext); default: break; } diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 2fe325f1c5201031d1e7fffd8ae2f1616fa9eff7..2ac7dbe8e39c31d4ad440aa45a289dc990edffa8 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -35,7 +35,7 @@ typedef struct SAstCreateContext { } SAstCreateContext; typedef enum EDatabaseOptionType { - DB_OPTION_BLOCKS = 0, + DB_OPTION_BLOCKS = 1, DB_OPTION_CACHE, DB_OPTION_CACHELAST, DB_OPTION_COMP, @@ -52,26 +52,22 @@ typedef enum EDatabaseOptionType { DB_OPTION_VGROUPS, DB_OPTION_SINGLE_STABLE, DB_OPTION_STREAM_MODE, - DB_OPTION_RETENTIONS, - - DB_OPTION_MAX + DB_OPTION_RETENTIONS } EDatabaseOptionType; typedef enum ETableOptionType { - TABLE_OPTION_KEEP = 0, + TABLE_OPTION_KEEP = 1, TABLE_OPTION_TTL, TABLE_OPTION_COMMENT, TABLE_OPTION_SMA, TABLE_OPTION_FILE_FACTOR, - TABLE_OPTION_DELAY, - - TABLE_OPTION_MAX + TABLE_OPTION_DELAY } ETableOptionType; typedef struct SAlterOption { int32_t type; - SToken val; - SNodeList* pKeep; + SValueNode* pVal; + SNodeList* pList; } SAlterOption; extern SToken nil_token; @@ -97,6 +93,7 @@ SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNo SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight); SNode* createFunctionNode(SAstCreateContext* pCxt, const SToken* pFuncName, SNodeList* pParameterList); SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList); +SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2); SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias); SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const SToken* pTableAlias); SNode* createJoinTableNode(SAstCreateContext* pCxt, EJoinType type, SNode* pLeft, SNode* pRight, SNode* pJoinCond); @@ -119,20 +116,12 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit); SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable); SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight); -SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt); -SNode* createDefaultAlterDatabaseOptions(SAstCreateContext* pCxt); -SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOptionType type, const SToken* pVal); -SNode* setDatabaseKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep); +SNode* createDatabaseOptions(SAstCreateContext* pCxt); SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption); SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pDbName, SNode* pOptions); SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pDbName); SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* pOptions); -SNode* createDefaultTableOptions(SAstCreateContext* pCxt); -SNode* createDefaultAlterTableOptions(SAstCreateContext* pCxt); -SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, const SToken* pVal); -SNode* setTableSmaOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pSma); -SNode* setTableRollupOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pFuncs); -SNode* setTableKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep); +SNode* createTableOptions(SAstCreateContext* pCxt); SNode* setTableAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption); SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment); SDataType createDataType(uint8_t type); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index c30a75aa66d971286fc4622ad5135b117c47f0e7..6e6a769db71e8915951d99a9a7dea3d99ff8acd3 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -128,44 +128,59 @@ not_exists_opt(A) ::= . exists_opt(A) ::= IF EXISTS. { A = true; } exists_opt(A) ::= . { A = false; } -db_options(A) ::= . { A = createDefaultDatabaseOptions(pCxt); } -db_options(A) ::= db_options(B) BLOCKS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_BLOCKS, &C); } -db_options(A) ::= db_options(B) CACHE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHE, &C); } -db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_CACHELAST, &C); } -db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); } -db_options(A) ::= db_options(B) DAYS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); } -db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); } -db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); } -db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); } -db_options(A) ::= db_options(B) KEEP integer_list(C). { A = setDatabaseKeepOption(pCxt, B, C); } -db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); } -db_options(A) ::= db_options(B) QUORUM NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_QUORUM, &C); } -db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); } -db_options(A) ::= db_options(B) TTL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TTL, &C); } -db_options(A) ::= db_options(B) WAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); } -db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); } -db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLE_STABLE, &C); } -db_options(A) ::= db_options(B) STREAM_MODE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STREAM_MODE, &C); } -db_options(A) ::= db_options(B) RETENTIONS NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, &C); } - -alter_db_options(A) ::= alter_db_option(B). { A = createDefaultAlterDatabaseOptions(pCxt); A = setDatabaseAlterOption(pCxt, A, &B); } +db_options(A) ::= . { A = createDatabaseOptions(pCxt); } +db_options(A) ::= db_options(B) BLOCKS NK_INTEGER(C). { ((SDatabaseOptions*)B)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) CACHE NK_INTEGER(C). { ((SDatabaseOptions*)B)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) CACHELAST NK_INTEGER(C). { ((SDatabaseOptions*)B)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { ((SDatabaseOptions*)B)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) DAYS NK_INTEGER(C). { ((SDatabaseOptions*)B)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) DAYS NK_VARIABLE(C). { ((SDatabaseOptions*)B)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &C); A = B; } +db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { ((SDatabaseOptions*)B)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { ((SDatabaseOptions*)B)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { ((SDatabaseOptions*)B)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) KEEP integer_list(C). { ((SDatabaseOptions*)B)->pKeep = C; A = B; } +db_options(A) ::= db_options(B) KEEP variable_list(C). { ((SDatabaseOptions*)B)->pKeep = C; A = B; } +db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { ((SDatabaseOptions*)B)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C); A = B; } +db_options(A) ::= db_options(B) QUORUM NK_INTEGER(C). { ((SDatabaseOptions*)B)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { ((SDatabaseOptions*)B)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) TTL NK_INTEGER(C). { ((SDatabaseOptions*)B)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) WAL NK_INTEGER(C). { ((SDatabaseOptions*)B)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { ((SDatabaseOptions*)B)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { ((SDatabaseOptions*)B)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) STREAM_MODE NK_INTEGER(C). { ((SDatabaseOptions*)B)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +db_options(A) ::= db_options(B) RETENTIONS retention_list(C). { ((SDatabaseOptions*)B)->pRetentions = C; A = B; } + +alter_db_options(A) ::= alter_db_option(B). { A = createDatabaseOptions(pCxt); A = setDatabaseAlterOption(pCxt, A, &B); } alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). { A = setDatabaseAlterOption(pCxt, B, &C); } %type alter_db_option { SAlterOption } %destructor alter_db_option { } -alter_db_option(A) ::= BLOCKS NK_INTEGER(B). { A.type = DB_OPTION_BLOCKS; A.val = B; } -alter_db_option(A) ::= FSYNC NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } -alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pKeep = B; } -alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } -alter_db_option(A) ::= QUORUM NK_INTEGER(B). { A.type = DB_OPTION_QUORUM; A.val = B; } -alter_db_option(A) ::= CACHELAST NK_INTEGER(B). { A.type = DB_OPTION_CACHELAST; A.val = B; } -alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } +alter_db_option(A) ::= BLOCKS NK_INTEGER(B). { A.type = DB_OPTION_BLOCKS; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +alter_db_option(A) ::= FSYNC NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } +alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } +alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +alter_db_option(A) ::= QUORUM NK_INTEGER(B). { A.type = DB_OPTION_QUORUM; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +alter_db_option(A) ::= CACHELAST NK_INTEGER(B). { A.type = DB_OPTION_CACHELAST; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } +alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } integer_list(A) ::= NK_INTEGER(B). { A = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B)); } integer_list(A) ::= integer_list(B) NK_COMMA NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); } +%type variable_list { SNodeList* } +%destructor variable_list { nodesDestroyList($$); } +variable_list(A) ::= NK_VARIABLE(B). { A = createNodeList(pCxt, createDurationValueNode(pCxt, &B)); } +variable_list(A) ::= variable_list(B) NK_COMMA NK_VARIABLE(C). { A = addNodeToList(pCxt, B, createDurationValueNode(pCxt, &C)); } + +%type retention_list { SNodeList* } +%destructor retention_list { nodesDestroyList($$); } +retention_list(A) ::= retention(B). { A = createNodeList(pCxt, B); } +retention_list(A) ::= retention_list(B) NK_COMMA retention(C). { A = addNodeToList(pCxt, B, C); } + +retention(A) ::= NK_VARIABLE(B) NK_COLON NK_VARIABLE(C). { A = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &B), createDurationValueNode(pCxt, &C)); } + /************************************************ create/drop table/stable ********************************************/ cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E); } @@ -263,23 +278,23 @@ tags_def_opt(A) ::= tags_def(B). %destructor tags_def { nodesDestroyList($$); } tags_def(A) ::= TAGS NK_LP column_def_list(B) NK_RP. { A = B; } -table_options(A) ::= . { A = createDefaultTableOptions(pCxt); } -table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { A = setTableOption(pCxt, B, TABLE_OPTION_COMMENT, &C); } -table_options(A) ::= table_options(B) KEEP integer_list(C). { A = setTableKeepOption(pCxt, B, C); } -table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_TTL, &C); } -table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { A = setTableSmaOption(pCxt, B, C); } -table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { A = setTableRollupOption(pCxt, B, C); } -table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { A = setTableOption(pCxt, B, TABLE_OPTION_FILE_FACTOR, &C); } -table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { A = setTableOption(pCxt, B, TABLE_OPTION_DELAY, &C); } +table_options(A) ::= . { A = createTableOptions(pCxt); } +table_options(A) ::= table_options(B) COMMENT NK_STRING(C). { ((STableOptions*)B)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &C); A = B; } +table_options(A) ::= table_options(B) KEEP integer_list(C). { ((STableOptions*)B)->pKeep = C; A = B; } +table_options(A) ::= table_options(B) TTL NK_INTEGER(C). { ((STableOptions*)B)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } +table_options(A) ::= table_options(B) SMA NK_LP col_name_list(C) NK_RP. { ((STableOptions*)B)->pSma = C; A = B; } +table_options(A) ::= table_options(B) ROLLUP NK_LP func_name_list(C) NK_RP. { ((STableOptions*)B)->pFuncs = C; A = B; } +table_options(A) ::= table_options(B) FILE_FACTOR NK_FLOAT(C). { ((STableOptions*)B)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &C); A = B; } +table_options(A) ::= table_options(B) DELAY NK_INTEGER(C). { ((STableOptions*)B)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C); A = B; } -alter_table_options(A) ::= alter_table_option(B). { A = createDefaultAlterTableOptions(pCxt); A = setTableAlterOption(pCxt, A, &B); } +alter_table_options(A) ::= alter_table_option(B). { A = createTableOptions(pCxt); A = setTableAlterOption(pCxt, A, &B); } alter_table_options(A) ::= alter_table_options(B) alter_table_option(C). { A = setTableAlterOption(pCxt, B, &C); } %type alter_table_option { SAlterOption } %destructor alter_table_option { } -alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.val = B; } -alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pKeep = B; } -alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.val = B; } +alter_table_option(A) ::= COMMENT NK_STRING(B). { A.type = TABLE_OPTION_COMMENT; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &B); } +alter_table_option(A) ::= KEEP integer_list(B). { A.type = TABLE_OPTION_KEEP; A.pList = B; } +alter_table_option(A) ::= TTL NK_INTEGER(B). { A.type = TABLE_OPTION_TTL; A.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &B); } %type col_name_list { SNodeList* } %destructor col_name_list { nodesDestroyList($$); } @@ -471,6 +486,8 @@ column_name(A) ::= NK_ID(B). %type function_name { SToken } %destructor function_name { } function_name(A) ::= NK_ID(B). { A = B; } +function_name(A) ::= FIRST(B). { A = B; } +function_name(A) ::= LAST(B). { A = B; } %type table_alias { SToken } %destructor table_alias { } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index 3f7c22f4c5454fbdd9f233bddb0e838551a264ba..893d50064172eebaa7746601e61da362ba4f97bd 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -16,6 +16,7 @@ #include "parAst.h" #include "parUtil.h" +#include "ttime.h" #define CHECK_OUT_OF_MEM(p) \ do { \ @@ -36,314 +37,6 @@ SToken nil_token = { .type = TK_NK_NIL, .n = 0, .z = NULL }; -typedef SDatabaseOptions* (*FSetDatabaseOption)(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal); -static FSetDatabaseOption setDbOptionFuncs[DB_OPTION_MAX]; - -typedef STableOptions* (*FSetTableOption)(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal); -static FSetTableOption setTableOptionFuncs[TABLE_OPTION_MAX]; - -static SDatabaseOptions* setDbBlocks(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_TOTAL_BLOCKS || val > TSDB_MAX_TOTAL_BLOCKS) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option totalBlocks: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); - pCxt->valid = false; - return pOptions; - } - pOptions->numOfBlocks = val; - return pOptions; -} - -static SDatabaseOptions* setDbCache(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_CACHE_BLOCK_SIZE || val > TSDB_MAX_CACHE_BLOCK_SIZE) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheBlockSize: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); - pCxt->valid = false; - return pOptions; - } - pOptions->cacheBlockSize = val; - return pOptions; -} - -static SDatabaseOptions* setDbCacheLast(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_CACHE_LAST_ROW || val > TSDB_MAX_DB_CACHE_LAST_ROW) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option cacheLast: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); - pCxt->valid = false; - return pOptions; - } - pOptions->cachelast = val; - return pOptions; -} - -static SDatabaseOptions* setDbComp(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_COMP_LEVEL || val > TSDB_MAX_COMP_LEVEL) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option compression: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); - pCxt->valid = false; - return pOptions; - } - pOptions->compressionLevel = val; - return pOptions; -} - -static SDatabaseOptions* setDbDays(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DAYS_PER_FILE || val > TSDB_MAX_DAYS_PER_FILE) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option daysPerFile: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); - pCxt->valid = false; - return pOptions; - } - pOptions->daysPerFile = val; - return pOptions; -} - -static SDatabaseOptions* setDbFsync(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_FSYNC_PERIOD || val > TSDB_MAX_FSYNC_PERIOD) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option fsyncPeriod: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); - pCxt->valid = false; - return pOptions; - } - pOptions->fsyncPeriod = val; - return pOptions; -} - -static SDatabaseOptions* setDbMaxRows(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_MAX_ROW_FBLOCK || val > TSDB_MAX_MAX_ROW_FBLOCK) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option maxRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); - pCxt->valid = false; - return pOptions; - } - pOptions->maxRowsPerBlock = val; - return pOptions; -} - -static SDatabaseOptions* setDbMinRows(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_MIN_ROW_FBLOCK || val > TSDB_MAX_MIN_ROW_FBLOCK) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option minRowsPerBlock: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); - pCxt->valid = false; - return pOptions; - } - pOptions->minRowsPerBlock = val; - return pOptions; -} - -static SDatabaseOptions* setDbPrecision(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - char val[10] = {0}; - trimString(pVal->z, pVal->n, val, sizeof(val)); - if (0 == strcmp(val, TSDB_TIME_PRECISION_MILLI_STR)) { - pOptions->precision = TSDB_TIME_PRECISION_MILLI; - } else if (0 == strcmp(val, TSDB_TIME_PRECISION_MICRO_STR)) { - pOptions->precision = TSDB_TIME_PRECISION_MICRO; - } else if (0 == strcmp(val, TSDB_TIME_PRECISION_NANO_STR)) { - pOptions->precision = TSDB_TIME_PRECISION_NANO; - } else { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option precision: %s", val); - pCxt->valid = false; - } - return pOptions; -} - -static SDatabaseOptions* setDbQuorum(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_QUORUM_OPTION || val > TSDB_MAX_DB_QUORUM_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option quorum: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); - pCxt->valid = false; - return pOptions; - } - pOptions->quorum = val; - return pOptions; -} - -static SDatabaseOptions* setDbReplica(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (!(val == TSDB_MIN_DB_REPLICA_OPTION || val == TSDB_MAX_DB_REPLICA_OPTION)) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option replications: %"PRId64", only 1, 3 allowed", val); - pCxt->valid = false; - return pOptions; - } - pOptions->replica = val; - return pOptions; -} - -static SDatabaseOptions* setDbTtl(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_TTL_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); - pCxt->valid = false; - return pOptions; - } - pOptions->ttl = val; - return pOptions; -} - -static SDatabaseOptions* setDbWal(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_WAL_LEVEL || val > TSDB_MAX_WAL_LEVEL) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option walLevel: %"PRId64", only 1-2 allowed", val); - pCxt->valid = false; - return pOptions; - } - pOptions->walLevel = val; - return pOptions; -} - -static SDatabaseOptions* setDbVgroups(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_VNODES_PER_DB || val > TSDB_MAX_VNODES_PER_DB) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid db option vgroups: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); - pCxt->valid = false; - return pOptions; - } - pOptions->numOfVgroups = val; - return pOptions; -} - -static SDatabaseOptions* setDbSingleStable(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_SINGLE_STABLE_OPTION || val > TSDB_MAX_DB_SINGLE_STABLE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option singleStable: %"PRId64", only 0-1 allowed", val); - pCxt->valid = false; - return pOptions; - } - pOptions->singleStable = val; - return pOptions; -} - -static SDatabaseOptions* setDbStreamMode(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_STREAM_MODE_OPTION || val > TSDB_MAX_DB_STREAM_MODE_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option streamMode: %"PRId64", only 0-1 allowed", val); - pCxt->valid = false; - return pOptions; - } - pOptions->streamMode = val; - return pOptions; -} - -static SDatabaseOptions* setDbRetentions(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal) { - pOptions->pRetentions = nodesMakeList(); - if (NULL == pOptions->pRetentions) { - pCxt->valid = false; - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "Out of memory"); - return pOptions; - } - - if (pVal->n > 2) { - char* pStart = pVal->z + 1; - char* pEnd = pVal->z + pVal->n - 1; - int32_t sepOrder = 1; - while (1) { - char* pPos = strchr(pStart, (0 == (sepOrder++) % 2) ? ',' : ':'); - SToken t = { .type = TK_NK_VARIABLE, .z = pStart, .n = (NULL == pPos ? pEnd - pStart : pPos - pStart)}; - if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pOptions->pRetentions, createDurationValueNode(pCxt, &t))) { - pCxt->valid = false; - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "Out of memory"); - return pOptions; - } - if (NULL == pPos) { - break; - } - pStart = pPos + 1; - } - } - - if (LIST_LENGTH(pOptions->pRetentions) < 2 || LIST_LENGTH(pOptions->pRetentions) % 2 != 0) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid db option retentions: %s", pVal->z); - pCxt->valid = false; - } - - return pOptions; -} - -static void initSetDatabaseOptionFp() { - setDbOptionFuncs[DB_OPTION_BLOCKS] = setDbBlocks; - setDbOptionFuncs[DB_OPTION_CACHE] = setDbCache; - setDbOptionFuncs[DB_OPTION_CACHELAST] = setDbCacheLast; - setDbOptionFuncs[DB_OPTION_COMP] = setDbComp; - setDbOptionFuncs[DB_OPTION_DAYS] = setDbDays; - setDbOptionFuncs[DB_OPTION_FSYNC] = setDbFsync; - setDbOptionFuncs[DB_OPTION_MAXROWS] = setDbMaxRows; - setDbOptionFuncs[DB_OPTION_MINROWS] = setDbMinRows; - setDbOptionFuncs[DB_OPTION_PRECISION] = setDbPrecision; - setDbOptionFuncs[DB_OPTION_QUORUM] = setDbQuorum; - setDbOptionFuncs[DB_OPTION_REPLICA] = setDbReplica; - setDbOptionFuncs[DB_OPTION_TTL] = setDbTtl; - setDbOptionFuncs[DB_OPTION_WAL] = setDbWal; - setDbOptionFuncs[DB_OPTION_VGROUPS] = setDbVgroups; - setDbOptionFuncs[DB_OPTION_SINGLE_STABLE] = setDbSingleStable; - setDbOptionFuncs[DB_OPTION_STREAM_MODE] = setDbStreamMode; - setDbOptionFuncs[DB_OPTION_RETENTIONS] = setDbRetentions; -} - -static STableOptions* setTableTtl(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_TTL_OPTION) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option ttl: %"PRId64", should be greater than or equal to %d", val, TSDB_MIN_DB_TTL_OPTION); - pCxt->valid = false; - return pOptions; - } - pOptions->ttl = val; - return pOptions; -} - -static STableOptions* setTableComment(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { - if (pVal->n >= sizeof(pOptions->comments)) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option comment, length cannot exceed %d", (int32_t)(sizeof(pOptions->comments) - 1)); - pCxt->valid = false; - return pOptions; - } - trimString(pVal->z, pVal->n, pOptions->comments, sizeof(pOptions->comments)); - return pOptions; -} - -static STableOptions* setTableFileFactor(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { - double val = strtod(pVal->z, NULL); - if (val < TSDB_MIN_DB_FILE_FACTOR || val > TSDB_MAX_DB_FILE_FACTOR) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option file_factor: %f valid range: [%d, %d]", val, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); - pCxt->valid = false; - return pOptions; - } - pOptions->filesFactor = val; - return pOptions; -} - -static STableOptions* setTableDelay(SAstCreateContext* pCxt, STableOptions* pOptions, const SToken* pVal) { - int64_t val = strtol(pVal->z, NULL, 10); - if (val < TSDB_MIN_DB_DELAY || val > TSDB_MAX_DB_DELAY) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, - "invalid table option delay: %"PRId64" valid range: [%d, %d]", val, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); - pCxt->valid = false; - return pOptions; - } - pOptions->delay = val; - return pOptions; -} - -static void initSetTableOptionFp() { - setTableOptionFuncs[TABLE_OPTION_TTL] = setTableTtl; - setTableOptionFuncs[TABLE_OPTION_COMMENT] = setTableComment; - setTableOptionFuncs[TABLE_OPTION_FILE_FACTOR] = setTableFileFactor; - setTableOptionFuncs[TABLE_OPTION_DELAY] = setTableDelay; -} - void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) { pCxt->pQueryCxt = pParseCxt; pCxt->msgBuf.buf = pParseCxt->pMsg; @@ -351,8 +44,6 @@ void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) { pCxt->notSupport = false; pCxt->valid = true; pCxt->pRootNode = NULL; - initSetDatabaseOptionFp(); - initSetTableOptionFp(); } static void trimEscape(SToken* pName) { @@ -652,6 +343,16 @@ SNode* createNodeListNode(SAstCreateContext* pCxt, SNodeList* pList) { return (SNode*)list; } +SNode* createNodeListNodeEx(SAstCreateContext* pCxt, SNode* p1, SNode* p2) { + SNodeListNode* list = (SNodeListNode*)nodesMakeNode(QUERY_NODE_NODE_LIST); + CHECK_OUT_OF_MEM(list); + list->pNodeList = nodesMakeList(); + CHECK_OUT_OF_MEM(list->pNodeList); + nodesListAppend(list->pNodeList, p1); + nodesListAppend(list->pNodeList, p2); + return (SNode*)list; +} + SNode* createRealTableNode(SAstCreateContext* pCxt, SToken* pDbName, SToken* pTableName, SToken* pTableAlias) { if (!checkDbName(pCxt, pDbName, true) || !checkTableName(pCxt, pTableName) || !checkTableName(pCxt, pTableAlias)) { return NULL; @@ -855,60 +556,12 @@ SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* return (SNode*)setOp; } -SNode* createDefaultDatabaseOptions(SAstCreateContext* pCxt) { +SNode* createDatabaseOptions(SAstCreateContext* pCxt) { SDatabaseOptions* pOptions = nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->numOfBlocks = TSDB_DEFAULT_TOTAL_BLOCKS; - pOptions->cacheBlockSize = TSDB_DEFAULT_CACHE_BLOCK_SIZE; - pOptions->cachelast = TSDB_DEFAULT_CACHE_LAST_ROW; - pOptions->compressionLevel = TSDB_DEFAULT_COMP_LEVEL; - pOptions->daysPerFile = TSDB_DEFAULT_DAYS_PER_FILE; - pOptions->fsyncPeriod = TSDB_DEFAULT_FSYNC_PERIOD; - pOptions->maxRowsPerBlock = TSDB_DEFAULT_MAX_ROW_FBLOCK; - pOptions->minRowsPerBlock = TSDB_DEFAULT_MIN_ROW_FBLOCK; - pOptions->keep0 = TSDB_DEFAULT_KEEP; - pOptions->keep1 = TSDB_DEFAULT_KEEP; - pOptions->keep2 = TSDB_DEFAULT_KEEP; - pOptions->precision = TSDB_TIME_PRECISION_MILLI; - pOptions->quorum = TSDB_DEFAULT_DB_QUORUM_OPTION; - pOptions->replica = TSDB_DEFAULT_DB_REPLICA_OPTION; - pOptions->ttl = TSDB_DEFAULT_DB_TTL_OPTION; - pOptions->walLevel = TSDB_DEFAULT_WAL_LEVEL; - pOptions->numOfVgroups = TSDB_DEFAULT_VN_PER_DB; - pOptions->singleStable = TSDB_DEFAULT_DB_SINGLE_STABLE_OPTION; - pOptions->streamMode = TSDB_DEFAULT_DB_STREAM_MODE_OPTION; return (SNode*)pOptions; } -SNode* createDefaultAlterDatabaseOptions(SAstCreateContext* pCxt) { - SDatabaseOptions* pOptions = nodesMakeNode(QUERY_NODE_DATABASE_OPTIONS); - CHECK_OUT_OF_MEM(pOptions); - pOptions->numOfBlocks = -1; - pOptions->cacheBlockSize = -1; - pOptions->cachelast = -1; - pOptions->compressionLevel = -1; - pOptions->daysPerFile = -1; - pOptions->fsyncPeriod = -1; - pOptions->maxRowsPerBlock = -1; - pOptions->minRowsPerBlock = -1; - pOptions->keep0 = -1; - pOptions->keep1 = -1; - pOptions->keep2= -1; - pOptions->precision = -1; - pOptions->quorum = -1; - pOptions->replica = -1; - pOptions->ttl = -1; - pOptions->walLevel = -1; - pOptions->numOfVgroups = -1; - pOptions->singleStable = -1; - pOptions->streamMode = -1; - return (SNode*)pOptions; -} - -SNode* setDatabaseOption(SAstCreateContext* pCxt, SNode* pOptions, EDatabaseOptionType type, const SToken* pVal) { - return (SNode*)setDbOptionFuncs[type](pCxt, (SDatabaseOptions*)pOptions, pVal); -} - static bool checkAndSetKeepOption(SAstCreateContext* pCxt, SNodeList* pKeep, int32_t* pKeep0, int32_t* pKeep1, int32_t* pKeep2) { int32_t numOfKeep = LIST_LENGTH(pKeep); if (numOfKeep > 3 || numOfKeep < 1) { @@ -937,18 +590,66 @@ static bool checkAndSetKeepOption(SAstCreateContext* pCxt, SNodeList* pKeep, int return true; } -SNode* setDatabaseKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep) { - SDatabaseOptions* pOp = (SDatabaseOptions*)pOptions; - pCxt->valid = checkAndSetKeepOption(pCxt, pKeep, &pOp->keep0, &pOp->keep1, &pOp->keep2); - return pOptions; -} - SNode* setDatabaseAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption) { - if (DB_OPTION_KEEP == pAlterOption->type) { - return setDatabaseKeepOption(pCxt, pOptions, pAlterOption->pKeep); - } else { - return setDatabaseOption(pCxt, pOptions, pAlterOption->type, &pAlterOption->val); + switch (pAlterOption->type) { + case DB_OPTION_BLOCKS: + ((SDatabaseOptions*)pOptions)->pNumOfBlocks = pAlterOption->pVal; + break; + case DB_OPTION_CACHE: + ((SDatabaseOptions*)pOptions)->pCacheBlockSize = pAlterOption->pVal; + break; + case DB_OPTION_CACHELAST: + ((SDatabaseOptions*)pOptions)->pCachelast = pAlterOption->pVal; + break; + case DB_OPTION_COMP: + ((SDatabaseOptions*)pOptions)->pCompressionLevel = pAlterOption->pVal; + break; + case DB_OPTION_DAYS: + ((SDatabaseOptions*)pOptions)->pDaysPerFile = pAlterOption->pVal; + break; + case DB_OPTION_FSYNC: + ((SDatabaseOptions*)pOptions)->pFsyncPeriod = pAlterOption->pVal; + break; + case DB_OPTION_MAXROWS: + ((SDatabaseOptions*)pOptions)->pMaxRowsPerBlock = pAlterOption->pVal; + break; + case DB_OPTION_MINROWS: + ((SDatabaseOptions*)pOptions)->pMinRowsPerBlock = pAlterOption->pVal; + break; + case DB_OPTION_KEEP: + ((SDatabaseOptions*)pOptions)->pKeep = pAlterOption->pList; + break; + case DB_OPTION_PRECISION: + ((SDatabaseOptions*)pOptions)->pPrecision = pAlterOption->pVal; + break; + case DB_OPTION_QUORUM: + ((SDatabaseOptions*)pOptions)->pQuorum = pAlterOption->pVal; + break; + case DB_OPTION_REPLICA: + ((SDatabaseOptions*)pOptions)->pReplica = pAlterOption->pVal; + break; + case DB_OPTION_TTL: + ((SDatabaseOptions*)pOptions)->pTtl = pAlterOption->pVal; + break; + case DB_OPTION_WAL: + ((SDatabaseOptions*)pOptions)->pWalLevel = pAlterOption->pVal; + break; + case DB_OPTION_VGROUPS: + ((SDatabaseOptions*)pOptions)->pNumOfVgroups = pAlterOption->pVal; + break; + case DB_OPTION_SINGLE_STABLE: + ((SDatabaseOptions*)pOptions)->pSingleStable = pAlterOption->pVal; + break; + case DB_OPTION_STREAM_MODE: + ((SDatabaseOptions*)pOptions)->pStreamMode = pAlterOption->pVal; + break; + case DB_OPTION_RETENTIONS: + ((SDatabaseOptions*)pOptions)->pRetentions = pAlterOption->pList; + break; + default: + break; } + return pOptions; } SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, SToken* pDbName, SNode* pOptions) { @@ -985,61 +686,36 @@ SNode* createAlterDatabaseStmt(SAstCreateContext* pCxt, SToken* pDbName, SNode* return (SNode*)pStmt; } -SNode* createDefaultTableOptions(SAstCreateContext* pCxt) { - STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); - CHECK_OUT_OF_MEM(pOptions); - pOptions->keep0 = TSDB_DEFAULT_KEEP; - pOptions->keep1 = TSDB_DEFAULT_KEEP; - pOptions->keep2 = TSDB_DEFAULT_KEEP; - pOptions->ttl = TSDB_DEFAULT_DB_TTL_OPTION; - pOptions->filesFactor = TSDB_DEFAULT_DB_FILE_FACTOR; - pOptions->delay = TSDB_DEFAULT_DB_DELAY; - return (SNode*)pOptions; -} - -SNode* createDefaultAlterTableOptions(SAstCreateContext* pCxt) { +SNode* createTableOptions(SAstCreateContext* pCxt) { STableOptions* pOptions = nodesMakeNode(QUERY_NODE_TABLE_OPTIONS); CHECK_OUT_OF_MEM(pOptions); - pOptions->keep0 = -1; - pOptions->keep1 = -1; - pOptions->keep2 = -1; - pOptions->ttl = -1; - pOptions->filesFactor = -1; - pOptions->delay = -1; return (SNode*)pOptions; } -SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType type, const SToken* pVal) { - return (SNode*)setTableOptionFuncs[type](pCxt, (STableOptions*)pOptions, pVal); -} - -SNode* setTableSmaOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pSma) { - ((STableOptions*)pOptions)->pSma = pSma; - return pOptions; -} - -SNode* setTableRollupOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pFuncs) { - if (1 != LIST_LENGTH(pFuncs)) { - snprintf(pCxt->pQueryCxt->pMsg, pCxt->pQueryCxt->msgLen, "invalid table option rollup: only one function is allowed"); - pCxt->valid = false; - return pOptions; - } - ((STableOptions*)pOptions)->pFuncs = pFuncs; - return pOptions; -} - -SNode* setTableKeepOption(SAstCreateContext* pCxt, SNode* pOptions, SNodeList* pKeep) { - STableOptions* pOp = (STableOptions*)pOptions; - pCxt->valid = checkAndSetKeepOption(pCxt, pKeep, &pOp->keep0, &pOp->keep1, &pOp->keep2); - return pOptions; -} - SNode* setTableAlterOption(SAstCreateContext* pCxt, SNode* pOptions, SAlterOption* pAlterOption) { - if (TABLE_OPTION_KEEP == pAlterOption->type) { - return setTableKeepOption(pCxt, pOptions, pAlterOption->pKeep); - } else { - return setTableOption(pCxt, pOptions, pAlterOption->type, &pAlterOption->val); + switch (pAlterOption->type) { + case TABLE_OPTION_KEEP: + ((STableOptions*)pOptions)->pKeep = pAlterOption->pList; + break; + case TABLE_OPTION_TTL: + ((STableOptions*)pOptions)->pTtl = pAlterOption->pVal; + break; + case TABLE_OPTION_COMMENT: + ((STableOptions*)pOptions)->pComments = pAlterOption->pVal; + break; + case TABLE_OPTION_SMA: + ((STableOptions*)pOptions)->pSma = pAlterOption->pList; + break; + case TABLE_OPTION_FILE_FACTOR: + ((STableOptions*)pOptions)->pFilesFactor = pAlterOption->pVal; + break; + case TABLE_OPTION_DELAY: + ((STableOptions*)pOptions)->pDelay = pAlterOption->pVal; + break; + default: + break; } + return pOptions; } SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment) { diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index 21191563e1d4698e7e76d9487c4e203d6b7751f9..300c41f73fbad873f0b8fc31a5b8966b49d26670 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -72,6 +72,7 @@ static SKeyword keywordTable[] = { {"EXPLAIN", TK_EXPLAIN}, {"FILE_FACTOR", TK_FILE_FACTOR}, {"FILL", TK_FILL}, + {"FIRST", TK_FIRST}, {"FLOAT", TK_FLOAT}, {"FROM", TK_FROM}, {"FSYNC", TK_FSYNC}, @@ -95,6 +96,7 @@ static SKeyword keywordTable[] = { {"JSON", TK_JSON}, {"KEEP", TK_KEEP}, {"KILL", TK_KILL}, + {"LAST", TK_LAST}, {"LICENCE", TK_LICENCE}, {"LIKE", TK_LIKE}, {"LIMIT", TK_LIMIT}, @@ -113,6 +115,7 @@ static SKeyword keywordTable[] = { {"NOT", TK_NOT}, {"NOW", TK_NOW}, {"NULL", TK_NULL}, + {"NULLS", TK_NULLS}, {"OFFSET", TK_OFFSET}, {"ON", TK_ON}, {"OR", TK_OR}, diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 35166b47fada99d36f227ab694503be2ce7272d7..3491974eab965968099d9d59ecae2c092d112a5c 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -21,6 +21,8 @@ #include "parUtil.h" #include "ttime.h" +#define GET_OPTION_VAL(pVal, defaultVal) (NULL == (pVal) ? (defaultVal) : ((SValueNode*)(pVal))->datum.i) + typedef struct STranslateContext { SParseContext* pParseCxt; int32_t errCode; @@ -934,7 +936,7 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) { static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbReq* pReq) { if (NULL != pRetentions) { - pReq->pRetensions = taosArrayInit(LIST_LENGTH(pRetentions) / 2, sizeof(SRetention)); + pReq->pRetensions = taosArrayInit(LIST_LENGTH(pRetentions), sizeof(SRetention)); if (NULL == pReq->pRetensions) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -943,18 +945,15 @@ static int32_t buildCreateDbRetentions(const SNodeList* pRetentions, SCreateDbRe SNode* pNode = NULL; int32_t index = 0; FOREACH(pNode, pRetentions) { - if (0 == ((index++) & 1)) { - pFreq = (SValueNode*)pNode; - } else { - pKeep = (SValueNode*)pNode; - SRetention retention = { - .freq = pFreq->datum.i, - .freqUnit = pFreq->unit, - .keep = pKeep->datum.i, - .keepUnit = pKeep->unit - }; - taosArrayPush(pReq->pRetensions, &retention); - } + pFreq = (SValueNode*)nodesListGetNode(((SNodeListNode*)pNode)->pNodeList, 0); + pKeep = (SValueNode*)nodesListGetNode(((SNodeListNode*)pNode)->pNodeList, 1); + SRetention retention = { + .freq = pFreq->datum.i, + .freqUnit = pFreq->unit, + .keep = pKeep->datum.i, + .keepUnit = pKeep->unit + }; + taosArrayPush(pReq->pRetensions, &retention); } pReq->numOfRetensions = taosArrayGetSize(pReq->pRetensions); } @@ -965,41 +964,220 @@ static int32_t buildCreateDbReq(STranslateContext* pCxt, SCreateDatabaseStmt* pS SName name = {0}; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pReq->db); - pReq->numOfVgroups = pStmt->pOptions->numOfVgroups; - pReq->cacheBlockSize = pStmt->pOptions->cacheBlockSize; - pReq->totalBlocks = pStmt->pOptions->numOfBlocks; - pReq->daysPerFile = pStmt->pOptions->daysPerFile; - pReq->daysToKeep0 = pStmt->pOptions->keep0; - pReq->daysToKeep1 = pStmt->pOptions->keep1; - pReq->daysToKeep2 = pStmt->pOptions->keep2; - pReq->minRows = pStmt->pOptions->minRowsPerBlock; - pReq->maxRows = pStmt->pOptions->maxRowsPerBlock; + pReq->numOfVgroups = GET_OPTION_VAL(pStmt->pOptions->pNumOfVgroups, TSDB_DEFAULT_VN_PER_DB); + pReq->cacheBlockSize = GET_OPTION_VAL(pStmt->pOptions->pCacheBlockSize, TSDB_DEFAULT_CACHE_BLOCK_SIZE); + pReq->totalBlocks = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, TSDB_DEFAULT_TOTAL_BLOCKS); + pReq->daysPerFile = GET_OPTION_VAL(pStmt->pOptions->pDaysPerFile, TSDB_DEFAULT_DAYS_PER_FILE); + pReq->daysToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), TSDB_DEFAULT_KEEP); + pReq->daysToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), TSDB_DEFAULT_KEEP); + pReq->daysToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), TSDB_DEFAULT_KEEP); + pReq->minRows = GET_OPTION_VAL(pStmt->pOptions->pMinRowsPerBlock, TSDB_DEFAULT_MIN_ROW_FBLOCK); + pReq->maxRows = GET_OPTION_VAL(pStmt->pOptions->pMaxRowsPerBlock, TSDB_DEFAULT_MAX_ROW_FBLOCK); pReq->commitTime = -1; - pReq->fsyncPeriod = pStmt->pOptions->fsyncPeriod; - pReq->walLevel = pStmt->pOptions->walLevel; - pReq->precision = pStmt->pOptions->precision; - pReq->compression = pStmt->pOptions->compressionLevel; - pReq->replications = pStmt->pOptions->replica; - pReq->quorum = pStmt->pOptions->quorum; + pReq->fsyncPeriod = GET_OPTION_VAL(pStmt->pOptions->pFsyncPeriod, TSDB_DEFAULT_FSYNC_PERIOD); + pReq->walLevel = GET_OPTION_VAL(pStmt->pOptions->pWalLevel, TSDB_DEFAULT_WAL_LEVEL); + pReq->precision = GET_OPTION_VAL(pStmt->pOptions->pPrecision, TSDB_TIME_PRECISION_MILLI); + pReq->compression = GET_OPTION_VAL(pStmt->pOptions->pCompressionLevel, TSDB_DEFAULT_COMP_LEVEL); + pReq->replications = GET_OPTION_VAL(pStmt->pOptions->pReplica, TSDB_DEFAULT_DB_REPLICA_OPTION); + pReq->quorum = GET_OPTION_VAL(pStmt->pOptions->pQuorum, TSDB_DEFAULT_DB_QUORUM_OPTION); pReq->update = -1; - pReq->cacheLastRow = pStmt->pOptions->cachelast; + pReq->cacheLastRow = GET_OPTION_VAL(pStmt->pOptions->pCachelast, TSDB_DEFAULT_CACHE_LAST_ROW); pReq->ignoreExist = pStmt->ignoreExists; - pReq->streamMode = pStmt->pOptions->streamMode; + pReq->streamMode = GET_OPTION_VAL(pStmt->pOptions->pStreamMode, TSDB_DEFAULT_DB_STREAM_MODE_OPTION); return buildCreateDbRetentions(pStmt->pOptions->pRetentions, pReq); } -static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { - if (NULL != pStmt->pOptions->pRetentions) { - SNode* pNode = NULL; - FOREACH(pNode, pStmt->pOptions->pRetentions) { - if (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pNode)) { +static int32_t checkRangeOption(STranslateContext* pCxt, const char* pName, SValueNode* pVal, int32_t minVal, int32_t maxVal) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + int64_t val = pVal->datum.i; + if (val < minVal || val > maxVal) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_RANGE_OPTION, pName, val, minVal, maxVal); + } + } + return TSDB_CODE_SUCCESS; +} + +static void convertValueFromStrToInt(SValueNode* pVal, int64_t val) { + taosMemoryFreeClear(pVal->datum.p); + pVal->datum.i = val; + pVal->node.resType.type = TSDB_DATA_TYPE_BIGINT; + pVal->node.resType.bytes = tDataTypes[pVal->node.resType.type].bytes; +} + +static int32_t checkDbPrecisionOption(STranslateContext* pCxt, SValueNode* pVal) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + char* pRrecision = varDataVal(pVal->datum.p); + if (0 == strcmp(pRrecision, TSDB_TIME_PRECISION_MILLI_STR)) { + convertValueFromStrToInt(pVal, TSDB_TIME_PRECISION_MILLI); + } else if (0 == strcmp(pRrecision, TSDB_TIME_PRECISION_MICRO_STR)) { + convertValueFromStrToInt(pVal, TSDB_TIME_PRECISION_MICRO); + } else if (0 == strcmp(pRrecision, TSDB_TIME_PRECISION_NANO_STR)) { + convertValueFromStrToInt(pVal, TSDB_TIME_PRECISION_NANO); + } else { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_STR_OPTION, "precision", pVal->datum.p); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t checkDbEnumOption(STranslateContext* pCxt, const char* pName, SValueNode* pVal, int32_t v1, int32_t v2) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + int64_t val = pVal->datum.i; + if (val != v1 && val != v2) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_ENUM_OPTION, pName, val, v1, v2); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t checkTtlOption(STranslateContext* pCxt, SValueNode* pVal) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + int64_t val = pVal->datum.i; + if (val < TSDB_MIN_DB_TTL_OPTION) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_TTL_OPTION, val, TSDB_MIN_DB_TTL_OPTION); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t checkKeepOption(STranslateContext* pCxt, SNodeList* pKeep) { + if (NULL == pKeep) { + return TSDB_CODE_SUCCESS; + } + + int32_t numOfKeep = LIST_LENGTH(pKeep); + if (numOfKeep > 3 || numOfKeep < 1) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_KEEP_NUM); + } + + SNode* pNode = NULL; + FOREACH(pNode, pKeep) { + if (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pNode)) { + return pCxt->errCode; + } + } + + if (1 == numOfKeep) { + if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pKeep, nodesCloneNode(nodesListGetNode(pKeep, 0)))) { + return TSDB_CODE_OUT_OF_MEMORY; + } + ++numOfKeep; + } + if (2 == numOfKeep) { + if (TSDB_CODE_SUCCESS != nodesListStrictAppend(pKeep, nodesCloneNode(nodesListGetNode(pKeep, 1)))) { + return TSDB_CODE_OUT_OF_MEMORY; + } + } + + int32_t daysToKeep0 = ((SValueNode*)nodesListGetNode(pKeep, 0))->datum.i; + int32_t daysToKeep1 = ((SValueNode*)nodesListGetNode(pKeep, 1))->datum.i; + int32_t daysToKeep2 = ((SValueNode*)nodesListGetNode(pKeep, 2))->datum.i; + if (daysToKeep0 < TSDB_MIN_KEEP || daysToKeep1 < TSDB_MIN_KEEP || daysToKeep2 < TSDB_MIN_KEEP || + daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_KEEP_VALUE, daysToKeep0, daysToKeep1, daysToKeep2, TSDB_MIN_KEEP, TSDB_MAX_KEEP); + } + + if (!((daysToKeep0 <= daysToKeep1) && (daysToKeep1 <= daysToKeep2))) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_KEEP_ORDER); + } + + return TSDB_CODE_SUCCESS; +} + +static int32_t checkDbRetentionsOption(STranslateContext* pCxt, SNodeList* pRetentions) { + if (NULL == pRetentions) { + return TSDB_CODE_SUCCESS; + } + + if (LIST_LENGTH(pRetentions) > 3) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION); + } + + SNode* pNode = NULL; + FOREACH(pNode, pRetentions) { + SNode* pVal = NULL; + FOREACH(pVal, ((SNodeListNode*)pNode)->pNodeList) { + if (DEAL_RES_ERROR == translateValue(pCxt, (SValueNode*)pVal)) { return pCxt->errCode; } } } + return TSDB_CODE_SUCCESS; } +static int32_t checkDatabaseOptions(STranslateContext* pCxt, SDatabaseOptions* pOptions) { + int32_t code = checkRangeOption(pCxt, "totalBlocks", pOptions->pNumOfBlocks, TSDB_MIN_TOTAL_BLOCKS, TSDB_MAX_TOTAL_BLOCKS); + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "cacheBlockSize", pOptions->pCacheBlockSize, TSDB_MIN_CACHE_BLOCK_SIZE, TSDB_MAX_CACHE_BLOCK_SIZE); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "cacheLast", pOptions->pCachelast, TSDB_MIN_DB_CACHE_LAST_ROW, TSDB_MAX_DB_CACHE_LAST_ROW); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "compression", pOptions->pCompressionLevel, TSDB_MIN_COMP_LEVEL, TSDB_MAX_COMP_LEVEL); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "daysPerFile", pOptions->pDaysPerFile, TSDB_MIN_DAYS_PER_FILE, TSDB_MAX_DAYS_PER_FILE); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "fsyncPeriod", pOptions->pFsyncPeriod, TSDB_MIN_FSYNC_PERIOD, TSDB_MAX_FSYNC_PERIOD); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "maxRowsPerBlock", pOptions->pMaxRowsPerBlock, TSDB_MIN_MAX_ROW_FBLOCK, TSDB_MAX_MAX_ROW_FBLOCK); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "minRowsPerBlock", pOptions->pMinRowsPerBlock, TSDB_MIN_MIN_ROW_FBLOCK, TSDB_MAX_MIN_ROW_FBLOCK); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkKeepOption(pCxt, pOptions->pKeep); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbPrecisionOption(pCxt, pOptions->pPrecision); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "quorum", pOptions->pQuorum, TSDB_MIN_DB_QUORUM_OPTION, TSDB_MAX_DB_QUORUM_OPTION); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEnumOption(pCxt, "replications", pOptions->pReplica, TSDB_MIN_DB_REPLICA_OPTION, TSDB_MAX_DB_REPLICA_OPTION); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTtlOption(pCxt, pOptions->pTtl); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEnumOption(pCxt, "walLevel", pOptions->pWalLevel, TSDB_MIN_WAL_LEVEL, TSDB_MAX_WAL_LEVEL); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "vgroups", pOptions->pNumOfVgroups, TSDB_MIN_VNODES_PER_DB, TSDB_MAX_VNODES_PER_DB); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEnumOption(pCxt, "singleStable", pOptions->pSingleStable, TSDB_MIN_DB_SINGLE_STABLE_OPTION, TSDB_MAX_DB_SINGLE_STABLE_OPTION); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbEnumOption(pCxt, "streamMode", pOptions->pStreamMode, TSDB_MIN_DB_STREAM_MODE_OPTION, TSDB_MAX_DB_STREAM_MODE_OPTION); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkDbRetentionsOption(pCxt, pOptions->pRetentions); + } + return code; +} + +static int32_t checkCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { + return checkDatabaseOptions(pCxt, pStmt->pOptions); +} + static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseStmt* pStmt) { SCreateDbReq createReq = {0}; @@ -1053,19 +1231,24 @@ static void buildAlterDbReq(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt, SName name = {0}; tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); tNameGetFullDbName(&name, pReq->db); - pReq->totalBlocks = pStmt->pOptions->numOfBlocks; - pReq->daysToKeep0 = pStmt->pOptions->keep0; - pReq->daysToKeep1 = pStmt->pOptions->keep1; - pReq->daysToKeep2 = pStmt->pOptions->keep2; - pReq->fsyncPeriod = pStmt->pOptions->fsyncPeriod; - pReq->walLevel = pStmt->pOptions->walLevel; - pReq->quorum = pStmt->pOptions->quorum; - pReq->cacheLastRow = pStmt->pOptions->cachelast; - pReq->replications = pStmt->pOptions->replica; + pReq->totalBlocks = GET_OPTION_VAL(pStmt->pOptions->pNumOfBlocks, -1); + pReq->daysToKeep0 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 0), -1); + pReq->daysToKeep1 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 1), -1); + pReq->daysToKeep2 = GET_OPTION_VAL(nodesListGetNode(pStmt->pOptions->pKeep, 2), -1); + pReq->fsyncPeriod = GET_OPTION_VAL(pStmt->pOptions->pFsyncPeriod, -1); + pReq->walLevel = GET_OPTION_VAL(pStmt->pOptions->pWalLevel, -1); + pReq->quorum = GET_OPTION_VAL(pStmt->pOptions->pQuorum, -1); + pReq->cacheLastRow = GET_OPTION_VAL(pStmt->pOptions->pCachelast, -1); + pReq->replications = GET_OPTION_VAL(pStmt->pOptions->pReplica, -1); return; } static int32_t translateAlterDatabase(STranslateContext* pCxt, SAlterDatabaseStmt* pStmt) { + int32_t code = checkDatabaseOptions(pCxt, pStmt->pOptions); + if (TSDB_CODE_SUCCESS != code) { + return code; + } + SAlterDbReq alterReq = {0}; buildAlterDbReq(pCxt, pStmt, &alterReq); @@ -1129,7 +1312,31 @@ static SColumnDefNode* findColDef(SNodeList* pCols, const SColumnNode* pCol) { return NULL; } -static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { +static int32_t checkTableCommentOption(STranslateContext* pCxt, SValueNode* pVal) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + if (pVal->node.resType.bytes >= TSDB_STB_COMMENT_LEN) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COMMENT_OPTION, TSDB_STB_COMMENT_LEN - 1); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t checTableFactorOption(STranslateContext* pCxt, SValueNode* pVal) { + if (NULL != pVal) { + if (DEAL_RES_ERROR == translateValue(pCxt, pVal)) { + return pCxt->errCode; + } + if (pVal->datum.d < TSDB_MIN_DB_FILE_FACTOR || pVal->datum.d > TSDB_MAX_DB_FILE_FACTOR) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_F_RANGE_OPTION, "file_factor", pVal->datum.d, TSDB_MIN_DB_FILE_FACTOR, TSDB_MAX_DB_FILE_FACTOR); + } + } + return TSDB_CODE_SUCCESS; +} + +static int32_t checkTableSmaOption(STranslateContext* pCxt, SCreateTableStmt* pStmt) { if (NULL != pStmt->pOptions->pSma) { SNode* pNode = NULL; FOREACH(pNode, pStmt->pCols) { @@ -1145,15 +1352,47 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt pColDef->sma = true; } } - if (NULL != pStmt->pOptions->pFuncs) { - SFunctionNode* pFunc = nodesListGetNode(pStmt->pOptions->pFuncs, 0); - if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pFunc->functionName, &pFunc->funcId, &pFunc->funcType)) { - return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_FUNTION, pFunc->functionName); - } + return TSDB_CODE_SUCCESS; +} + +static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs) { + if (NULL == pFuncs) { + return TSDB_CODE_SUCCESS; + } + + if (1 != LIST_LENGTH(pFuncs)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_ROLLUP_OPTION); + } + SFunctionNode* pFunc = nodesListGetNode(pFuncs, 0); + if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pFunc->functionName, &pFunc->funcId, &pFunc->funcType)) { + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_FUNTION, pFunc->functionName); } return TSDB_CODE_SUCCESS; } +static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt) { + int32_t code = checkKeepOption(pCxt, pStmt->pOptions->pKeep); + if (TSDB_CODE_SUCCESS == code) { + code = checkTtlOption(pCxt, pStmt->pOptions->pTtl); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTableCommentOption(pCxt, pStmt->pOptions->pComments); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTableSmaOption(pCxt, pStmt); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTableRollupOption(pCxt, pStmt->pOptions->pFuncs); + } + if (TSDB_CODE_SUCCESS == code) { + code = checTableFactorOption(pCxt, pStmt->pOptions->pFilesFactor); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkRangeOption(pCxt, "delay", pStmt->pOptions->pDelay, TSDB_MIN_DB_DELAY, TSDB_MAX_DB_DELAY); + } + return code; +} + static int32_t getAggregationMethod(SNodeList* pFuncs) { if (NULL == pFuncs) { return -1; @@ -1170,8 +1409,8 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt SMCreateStbReq createReq = {0}; createReq.igExists = pStmt->ignoreExists; createReq.aggregationMethod = getAggregationMethod(pStmt->pOptions->pFuncs); - createReq.xFilesFactor = pStmt->pOptions->filesFactor; - createReq.delay = pStmt->pOptions->delay; + createReq.xFilesFactor = GET_OPTION_VAL(pStmt->pOptions->pFilesFactor, TSDB_DEFAULT_DB_FILE_FACTOR); + createReq.delay = GET_OPTION_VAL(pStmt->pOptions->pDelay, TSDB_DEFAULT_DB_DELAY); columnDefNodeToField(pStmt->pCols, &createReq.pColumns); columnDefNodeToField(pStmt->pTags, &createReq.pTags); createReq.numOfColumns = LIST_LENGTH(pStmt->pCols); @@ -2188,8 +2427,8 @@ static int32_t buildSmaParam(STableOptions* pOptions, SVCreateTbReq* pReq) { if (NULL == pReq->ntbCfg.pRSmaParam) { return TSDB_CODE_OUT_OF_MEMORY; } - pReq->ntbCfg.pRSmaParam->delay = pOptions->delay; - pReq->ntbCfg.pRSmaParam->xFilesFactor = pOptions->filesFactor; + pReq->ntbCfg.pRSmaParam->delay = GET_OPTION_VAL(pOptions->pDelay, TSDB_DEFAULT_DB_DELAY); + pReq->ntbCfg.pRSmaParam->xFilesFactor = GET_OPTION_VAL(pOptions->pFilesFactor, TSDB_DEFAULT_DB_FILE_FACTOR); pReq->ntbCfg.pRSmaParam->nFuncIds = LIST_LENGTH(pOptions->pFuncs); pReq->ntbCfg.pRSmaParam->pFuncIds = taosMemoryCalloc(pReq->ntbCfg.pRSmaParam->nFuncIds, sizeof(func_id_t)); if (NULL == pReq->ntbCfg.pRSmaParam->pFuncIds) { @@ -2439,7 +2678,7 @@ static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClau static int32_t checkCreateSubTable(STranslateContext* pCxt, SCreateSubTableClause* pStmt) { if (0 != strcmp(pStmt->dbName, pStmt->useDbName)) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR);; + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR); } return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index aeed7719f38d673dadb9dfe6816ad13d2c4a7b4d..5206e0f8a52ca410b991dcaf2f7894fc163d5616 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -67,6 +67,28 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Invalid identifier name : %s"; case TSDB_CODE_PAR_CORRESPONDING_STABLE_ERR: return "corresponding super table not in this db"; + case TSDB_CODE_PAR_INVALID_RANGE_OPTION: + return "invalid option %s: %"PRId64" valid range: [%d, %d]"; + case TSDB_CODE_PAR_INVALID_STR_OPTION: + return "invalid option %s: %s"; + case TSDB_CODE_PAR_INVALID_ENUM_OPTION: + return "invalid option %s: %"PRId64", only %d, %d allowed"; + case TSDB_CODE_PAR_INVALID_TTL_OPTION: + return "invalid option ttl: %"PRId64", should be greater than or equal to %d"; + case TSDB_CODE_PAR_INVALID_KEEP_NUM: + return "invalid number of keep options"; + case TSDB_CODE_PAR_INVALID_KEEP_ORDER: + return "invalid keep value, should be keep0 <= keep1 <= keep2"; + case TSDB_CODE_PAR_INVALID_KEEP_VALUE: + return "invalid option keep: %d, %d, %d valid range: [%d, %d]"; + case TSDB_CODE_PAR_INVALID_COMMENT_OPTION: + return "invalid option comment, length cannot exceed %d"; + case TSDB_CODE_PAR_INVALID_F_RANGE_OPTION: + return "invalid option %s: %f valid range: [%d, %d]"; + case TSDB_CODE_PAR_INVALID_ROLLUP_OPTION: + return "invalid option rollup: only one function is allowed"; + case TSDB_CODE_PAR_INVALID_RETENTIONS_OPTION: + return "invalid option retentions"; case TSDB_CODE_OUT_OF_MEMORY: return "Out of memory"; default: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 30c85e28fe757b2b36b6bb916c1c08efb6300129..b2ddd1d0bc03009b672cba82bc0676b090957b94 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -100,24 +100,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 304 +#define YYNOCODE 308 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - EOperatorType yy60; - SNode* yy104; - SToken yy129; - bool yy185; - int32_t yy196; - SAlterOption yy253; - SNodeList* yy312; - SDataType yy336; - EOrder yy354; - ENullOrder yy489; - EJoinType yy532; - EFillMode yy550; + ENullOrder yy81; + SNode* yy168; + SDataType yy224; + SAlterOption yy277; + SNodeList* yy376; + EFillMode yy382; + SToken yy393; + EOperatorType yy436; + int32_t yy508; + bool yy537; + EOrder yy554; + EJoinType yy596; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +132,17 @@ typedef union { #define ParseCTX_PARAM #define ParseCTX_FETCH #define ParseCTX_STORE -#define YYNSTATE 511 -#define YYNRULE 390 -#define YYNTOKEN 201 -#define YY_MAX_SHIFT 510 -#define YY_MIN_SHIFTREDUCE 762 -#define YY_MAX_SHIFTREDUCE 1151 -#define YY_ERROR_ACTION 1152 -#define YY_ACCEPT_ACTION 1153 -#define YY_NO_ACTION 1154 -#define YY_MIN_REDUCE 1155 -#define YY_MAX_REDUCE 1544 +#define YYNSTATE 518 +#define YYNRULE 400 +#define YYNTOKEN 202 +#define YY_MAX_SHIFT 517 +#define YY_MIN_SHIFTREDUCE 776 +#define YY_MAX_SHIFTREDUCE 1175 +#define YY_ERROR_ACTION 1176 +#define YY_ACCEPT_ACTION 1177 +#define YY_NO_ACTION 1178 +#define YY_MIN_REDUCE 1179 +#define YY_MAX_REDUCE 1578 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,462 +209,466 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (1461) +#define YY_ACTTAB_COUNT (1488) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1250, 441, 441, 266, 441, 1246, 1413, 72, 305, 307, - /* 10 */ 72, 111, 31, 29, 349, 409, 253, 355, 21, 1263, - /* 20 */ 262, 1153, 990, 1261, 1261, 270, 1261, 1429, 32, 30, - /* 30 */ 28, 27, 26, 1399, 412, 441, 234, 98, 988, 117, - /* 40 */ 409, 306, 1399, 1014, 427, 1395, 1401, 11, 1386, 1429, - /* 50 */ 1301, 31, 29, 1094, 1395, 1401, 425, 1261, 799, 262, - /* 60 */ 798, 990, 98, 409, 69, 1414, 1415, 1418, 1462, 1, - /* 70 */ 96, 277, 255, 1458, 120, 1413, 1308, 988, 800, 411, - /* 80 */ 121, 1469, 1470, 1308, 1474, 98, 11, 1340, 402, 252, - /* 90 */ 31, 29, 507, 1490, 1306, 96, 1429, 1252, 262, 326, - /* 100 */ 990, 440, 1523, 425, 989, 122, 1469, 1470, 1, 1474, - /* 110 */ 23, 25, 191, 427, 1399, 125, 988, 1386, 96, 1521, - /* 120 */ 32, 30, 28, 27, 26, 11, 1395, 1402, 123, 1469, - /* 130 */ 1470, 507, 1474, 70, 1414, 1415, 1418, 1462, 991, 1386, - /* 140 */ 440, 1461, 1458, 989, 135, 134, 1413, 1, 32, 30, - /* 150 */ 28, 27, 26, 186, 65, 994, 995, 1038, 1039, 1040, - /* 160 */ 1041, 1042, 1043, 1044, 1045, 99, 233, 1429, 1010, 1406, - /* 170 */ 507, 300, 1253, 299, 425, 319, 126, 991, 331, 1010, - /* 180 */ 428, 1404, 989, 265, 427, 273, 1348, 332, 1386, 12, - /* 190 */ 1413, 126, 1339, 1341, 994, 995, 1038, 1039, 1040, 1041, - /* 200 */ 1042, 1043, 1044, 1045, 69, 1414, 1415, 1418, 1462, 441, - /* 210 */ 126, 1429, 255, 1458, 1535, 312, 991, 1239, 425, 1308, - /* 220 */ 159, 441, 1336, 1496, 352, 267, 440, 313, 427, 133, - /* 230 */ 1306, 1261, 1386, 994, 995, 1038, 1039, 1040, 1041, 1042, - /* 240 */ 1043, 1044, 1045, 1261, 1237, 354, 31, 29, 70, 1414, - /* 250 */ 1415, 1418, 1462, 340, 262, 330, 990, 1459, 325, 324, - /* 260 */ 323, 322, 321, 340, 318, 317, 316, 315, 311, 310, - /* 270 */ 309, 308, 988, 84, 1118, 12, 83, 82, 81, 80, - /* 280 */ 79, 78, 77, 76, 75, 31, 29, 426, 1156, 362, - /* 290 */ 476, 357, 301, 262, 361, 990, 126, 160, 213, 358, - /* 300 */ 356, 1291, 359, 7, 396, 1116, 1117, 1119, 1120, 84, - /* 310 */ 1178, 988, 83, 82, 81, 80, 79, 78, 77, 76, - /* 320 */ 75, 441, 1308, 1523, 31, 29, 507, 339, 274, 399, - /* 330 */ 476, 441, 262, 1306, 990, 126, 125, 1258, 989, 114, - /* 340 */ 1521, 1225, 7, 1261, 1012, 32, 30, 28, 27, 26, - /* 350 */ 988, 131, 1386, 1261, 874, 464, 463, 462, 878, 461, - /* 360 */ 880, 881, 460, 883, 457, 507, 889, 454, 891, 892, - /* 370 */ 451, 448, 991, 1177, 113, 48, 1167, 989, 47, 403, - /* 380 */ 1413, 7, 404, 400, 32, 30, 28, 27, 26, 994, - /* 390 */ 995, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 441, - /* 400 */ 1523, 1429, 1201, 1108, 507, 438, 111, 385, 425, 1013, - /* 410 */ 126, 991, 1176, 1522, 1264, 1386, 989, 1521, 427, 503, - /* 420 */ 502, 1261, 1386, 32, 30, 28, 27, 26, 994, 995, - /* 430 */ 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 115, 1414, - /* 440 */ 1415, 1418, 6, 32, 30, 28, 27, 26, 386, 272, - /* 450 */ 991, 362, 1015, 357, 1386, 1248, 361, 111, 236, 160, - /* 460 */ 246, 358, 356, 1175, 359, 1263, 1413, 994, 995, 1038, - /* 470 */ 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1537, 236, 1523, - /* 480 */ 31, 29, 159, 9, 8, 1011, 352, 1429, 262, 1057, - /* 490 */ 990, 1155, 125, 1059, 425, 292, 1521, 247, 376, 245, - /* 500 */ 244, 1026, 351, 1148, 427, 1386, 988, 354, 1386, 1057, - /* 510 */ 294, 1063, 1174, 413, 1173, 93, 92, 91, 90, 89, - /* 520 */ 88, 87, 86, 85, 68, 1414, 1415, 1418, 1462, 1523, - /* 530 */ 50, 275, 235, 1458, 22, 1058, 416, 1, 1308, 111, - /* 540 */ 95, 50, 125, 1172, 1523, 441, 1521, 1263, 1256, 1307, - /* 550 */ 798, 439, 1070, 1062, 1386, 1058, 1386, 125, 467, 1257, - /* 560 */ 507, 1521, 172, 417, 441, 441, 347, 1261, 1171, 1147, - /* 570 */ 205, 276, 989, 1062, 1089, 1170, 24, 260, 1052, 1053, - /* 580 */ 1054, 1055, 1056, 1060, 1061, 1386, 1261, 1261, 1244, 32, - /* 590 */ 30, 28, 27, 26, 1169, 1166, 24, 260, 1052, 1053, - /* 600 */ 1054, 1055, 1056, 1060, 1061, 1198, 991, 28, 27, 26, - /* 610 */ 1386, 147, 428, 1101, 119, 1093, 112, 1386, 1349, 1012, - /* 620 */ 345, 219, 146, 994, 995, 1038, 1039, 1040, 1041, 1042, - /* 630 */ 1043, 1044, 1045, 217, 1165, 1476, 1386, 1386, 1164, 1163, - /* 640 */ 1162, 1161, 1160, 136, 1159, 1158, 51, 1026, 420, 144, - /* 650 */ 998, 1413, 1375, 1473, 495, 494, 493, 492, 491, 490, - /* 660 */ 489, 488, 207, 485, 484, 483, 482, 481, 480, 479, - /* 670 */ 478, 477, 1429, 1476, 1476, 424, 1386, 165, 58, 425, - /* 680 */ 1386, 1386, 1386, 1386, 1386, 466, 1386, 1386, 284, 427, - /* 690 */ 418, 1472, 1471, 1386, 1481, 1089, 1254, 486, 152, 1413, - /* 700 */ 295, 150, 374, 143, 67, 138, 384, 140, 1168, 69, - /* 710 */ 1414, 1415, 1418, 1462, 1226, 372, 1001, 255, 1458, 1535, - /* 720 */ 1429, 1194, 1189, 154, 137, 415, 153, 412, 1519, 46, - /* 730 */ 45, 304, 156, 130, 1187, 155, 158, 427, 298, 157, - /* 740 */ 1302, 1386, 1413, 363, 365, 64, 242, 188, 290, 397, - /* 750 */ 286, 282, 127, 9, 8, 60, 368, 69, 1414, 1415, - /* 760 */ 1418, 1462, 181, 1429, 346, 255, 1458, 120, 104, 44, - /* 770 */ 425, 388, 1115, 175, 126, 997, 177, 421, 1413, 187, - /* 780 */ 427, 1150, 1151, 1049, 1386, 392, 1489, 33, 1092, 410, - /* 790 */ 1064, 33, 33, 194, 1023, 957, 196, 1492, 1430, 1429, - /* 800 */ 69, 1414, 1415, 1418, 1462, 1413, 425, 190, 255, 1458, - /* 810 */ 1535, 101, 102, 2, 433, 202, 427, 1010, 104, 1480, - /* 820 */ 1386, 867, 283, 279, 241, 413, 1429, 409, 510, 243, - /* 830 */ 966, 44, 841, 425, 862, 211, 225, 1414, 1415, 1418, - /* 840 */ 320, 1000, 210, 427, 314, 94, 1338, 1386, 132, 98, - /* 850 */ 333, 499, 446, 209, 102, 895, 1523, 899, 103, 104, - /* 860 */ 1413, 905, 904, 70, 1414, 1415, 1418, 1462, 413, 125, - /* 870 */ 328, 423, 1458, 1521, 1019, 327, 329, 66, 334, 1018, - /* 880 */ 203, 1429, 96, 102, 335, 336, 105, 139, 425, 337, - /* 890 */ 1017, 338, 184, 1469, 408, 142, 407, 49, 427, 1523, - /* 900 */ 341, 145, 1386, 1016, 1413, 348, 74, 350, 379, 1413, - /* 910 */ 437, 1251, 125, 149, 378, 380, 1521, 1247, 115, 1414, - /* 920 */ 1415, 1418, 151, 106, 353, 1429, 360, 377, 107, 1249, - /* 930 */ 1429, 1015, 425, 1245, 108, 391, 109, 425, 168, 167, - /* 940 */ 170, 251, 427, 387, 398, 389, 1386, 427, 1493, 261, - /* 950 */ 390, 1386, 431, 974, 393, 164, 414, 1536, 383, 1503, - /* 960 */ 995, 173, 229, 1414, 1415, 1418, 1413, 229, 1414, 1415, - /* 970 */ 1418, 1413, 1502, 395, 5, 176, 1089, 394, 254, 406, - /* 980 */ 1483, 97, 401, 4, 1014, 17, 34, 1429, 256, 1477, - /* 990 */ 422, 183, 1429, 419, 425, 1347, 429, 435, 198, 425, - /* 1000 */ 430, 264, 182, 180, 427, 118, 1346, 1413, 1386, 427, - /* 1010 */ 1444, 434, 1262, 1386, 436, 1413, 259, 200, 59, 57, - /* 1020 */ 212, 1520, 214, 208, 228, 1414, 1415, 1418, 1429, 229, - /* 1030 */ 1414, 1415, 1418, 473, 444, 425, 1429, 189, 487, 506, - /* 1040 */ 220, 1413, 1538, 425, 221, 427, 40, 216, 1380, 1386, - /* 1050 */ 1413, 218, 263, 427, 1379, 278, 405, 1386, 1376, 280, - /* 1060 */ 281, 984, 1429, 285, 985, 229, 1414, 1415, 1418, 425, - /* 1070 */ 128, 1429, 1374, 222, 1414, 1415, 1418, 1413, 425, 427, - /* 1080 */ 287, 288, 289, 1386, 1373, 1413, 1372, 291, 427, 1363, - /* 1090 */ 293, 129, 1386, 296, 297, 969, 1357, 968, 1429, 227, - /* 1100 */ 1414, 1415, 1418, 1356, 303, 425, 1429, 302, 230, 1414, - /* 1110 */ 1415, 1418, 1355, 425, 1354, 427, 940, 1331, 1330, 1386, - /* 1120 */ 1329, 1413, 1328, 427, 1327, 1326, 1413, 1386, 1325, 1324, - /* 1130 */ 1323, 1322, 1321, 1320, 1319, 223, 1414, 1415, 1418, 100, - /* 1140 */ 1318, 1317, 1429, 231, 1414, 1415, 1418, 1429, 1316, 425, - /* 1150 */ 1315, 1314, 1313, 1312, 425, 1311, 1310, 942, 1309, 427, - /* 1160 */ 1200, 1371, 1413, 1386, 427, 1365, 1353, 1413, 1386, 1344, - /* 1170 */ 141, 1240, 1199, 1413, 811, 1197, 342, 1186, 343, 224, - /* 1180 */ 1414, 1415, 1418, 1429, 232, 1414, 1415, 1418, 1429, 344, - /* 1190 */ 425, 1185, 1182, 1242, 1429, 425, 910, 73, 1241, 148, - /* 1200 */ 427, 425, 912, 486, 1386, 427, 840, 1195, 839, 1386, - /* 1210 */ 248, 427, 1190, 1188, 1413, 1386, 838, 837, 835, 834, - /* 1220 */ 1426, 1414, 1415, 1418, 249, 1425, 1414, 1415, 1418, 1413, - /* 1230 */ 250, 1424, 1414, 1415, 1418, 1429, 366, 369, 269, 268, - /* 1240 */ 1413, 371, 425, 1181, 1180, 373, 1370, 71, 1003, 1238, - /* 1250 */ 1429, 43, 427, 163, 976, 1413, 1386, 425, 1364, 110, - /* 1260 */ 381, 1429, 1352, 990, 996, 1236, 1351, 427, 425, 382, - /* 1270 */ 166, 1386, 239, 1414, 1415, 1418, 1429, 37, 427, 988, - /* 1280 */ 1343, 1413, 1386, 425, 52, 169, 116, 238, 1414, 1415, - /* 1290 */ 1418, 3, 367, 427, 178, 33, 38, 1386, 240, 1414, - /* 1300 */ 1415, 1418, 1429, 174, 1114, 19, 206, 375, 171, 425, - /* 1310 */ 472, 1404, 179, 237, 1414, 1415, 1418, 14, 442, 427, - /* 1320 */ 1107, 162, 206, 1386, 370, 53, 472, 20, 185, 364, - /* 1330 */ 999, 474, 161, 507, 15, 124, 35, 1086, 1085, 226, - /* 1340 */ 1414, 1415, 1418, 36, 1141, 989, 16, 474, 54, 1136, - /* 1350 */ 471, 470, 469, 10, 468, 1135, 42, 257, 1140, 41, - /* 1360 */ 1139, 258, 8, 192, 1004, 1050, 471, 470, 469, 1024, - /* 1370 */ 468, 13, 18, 1342, 193, 1112, 195, 197, 55, 991, - /* 1380 */ 432, 1007, 995, 199, 201, 56, 1005, 1403, 896, 60, - /* 1390 */ 39, 445, 271, 204, 443, 447, 994, 995, 893, 449, - /* 1400 */ 450, 452, 890, 453, 455, 884, 456, 458, 882, 888, - /* 1410 */ 459, 873, 465, 907, 61, 62, 63, 906, 887, 886, - /* 1420 */ 903, 885, 901, 831, 809, 475, 830, 823, 829, 828, - /* 1430 */ 827, 826, 825, 824, 842, 821, 820, 819, 1196, 1184, - /* 1440 */ 818, 817, 816, 1183, 815, 814, 496, 497, 500, 501, - /* 1450 */ 1179, 504, 498, 505, 1154, 992, 215, 508, 1154, 1154, - /* 1460 */ 509, + /* 0 */ 255, 432, 272, 1447, 267, 52, 1218, 1380, 275, 25, + /* 10 */ 193, 304, 31, 29, 121, 1371, 1373, 1431, 96, 1431, + /* 20 */ 264, 444, 1012, 1431, 445, 1333, 1288, 1463, 367, 1427, + /* 30 */ 1433, 1427, 1433, 72, 429, 1427, 1434, 117, 1010, 1340, + /* 40 */ 352, 1251, 1557, 310, 431, 254, 1284, 11, 1418, 1293, + /* 50 */ 1338, 263, 1225, 413, 1017, 130, 813, 432, 812, 1555, + /* 60 */ 31, 29, 1118, 1381, 231, 1448, 1449, 1452, 264, 1270, + /* 70 */ 1012, 1, 12, 236, 31, 29, 814, 444, 100, 1340, + /* 80 */ 413, 444, 264, 445, 1012, 269, 1010, 343, 31, 29, + /* 90 */ 1338, 1418, 72, 1035, 514, 11, 264, 417, 1012, 358, + /* 100 */ 1010, 366, 1017, 360, 858, 100, 1011, 365, 1293, 11, + /* 110 */ 97, 98, 361, 359, 1010, 362, 1017, 1034, 1340, 1, + /* 120 */ 860, 186, 1503, 412, 276, 411, 445, 208, 1557, 1338, + /* 130 */ 1017, 476, 12, 1, 1222, 308, 1463, 116, 98, 1191, + /* 140 */ 1013, 130, 514, 429, 1032, 1555, 445, 7, 127, 1503, + /* 150 */ 1504, 1293, 1508, 478, 1011, 309, 514, 1016, 1036, 1037, + /* 160 */ 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1011, 482, + /* 170 */ 514, 1293, 475, 474, 473, 406, 472, 163, 1117, 131, + /* 180 */ 131, 355, 1011, 502, 501, 500, 499, 279, 1013, 498, + /* 190 */ 497, 496, 102, 491, 490, 489, 488, 487, 486, 485, + /* 200 */ 484, 108, 1013, 357, 6, 1016, 1036, 1037, 1062, 1063, + /* 210 */ 1064, 1065, 1066, 1067, 1068, 1069, 1013, 510, 509, 1016, + /* 220 */ 1036, 1037, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, + /* 230 */ 1038, 1036, 1037, 1016, 1036, 1037, 1062, 1063, 1064, 1065, + /* 240 */ 1066, 1067, 1068, 1069, 1142, 1271, 31, 29, 430, 32, + /* 250 */ 30, 28, 27, 26, 264, 131, 1012, 136, 407, 31, + /* 260 */ 29, 235, 303, 1032, 302, 445, 65, 264, 1180, 1012, + /* 270 */ 322, 403, 1010, 334, 315, 400, 1140, 1141, 1143, 1144, + /* 280 */ 101, 131, 335, 50, 1202, 1010, 49, 1285, 1017, 84, + /* 290 */ 1293, 343, 83, 82, 81, 80, 79, 78, 77, 76, + /* 300 */ 75, 1017, 131, 131, 329, 7, 480, 896, 468, 467, + /* 310 */ 466, 900, 465, 902, 903, 464, 905, 461, 7, 911, + /* 320 */ 458, 913, 914, 455, 452, 408, 404, 84, 514, 1418, + /* 330 */ 83, 82, 81, 80, 79, 78, 77, 76, 75, 1113, + /* 340 */ 1011, 514, 188, 32, 30, 28, 27, 26, 364, 363, + /* 350 */ 140, 139, 333, 1011, 1116, 328, 327, 326, 325, 324, + /* 360 */ 445, 321, 320, 319, 318, 314, 313, 312, 311, 316, + /* 370 */ 1172, 9, 8, 1033, 1013, 32, 30, 28, 27, 26, + /* 380 */ 32, 30, 28, 27, 26, 1293, 1201, 1013, 483, 1200, + /* 390 */ 1265, 1016, 1036, 1037, 1062, 1063, 1064, 1065, 1066, 1067, + /* 400 */ 1068, 1069, 421, 1132, 1016, 1036, 1037, 1062, 1063, 1064, + /* 410 */ 1065, 1066, 1067, 1068, 1069, 238, 1282, 31, 29, 32, + /* 420 */ 30, 28, 27, 26, 366, 264, 360, 1012, 1199, 1447, + /* 430 */ 365, 1418, 371, 97, 1418, 361, 359, 1171, 362, 471, + /* 440 */ 1050, 445, 1094, 1010, 1447, 1557, 445, 379, 1081, 268, + /* 450 */ 342, 1269, 380, 1463, 238, 1290, 1368, 114, 1556, 1017, + /* 460 */ 429, 165, 1555, 138, 374, 1295, 1293, 52, 1463, 368, + /* 470 */ 431, 1293, 164, 1418, 1418, 416, 1, 445, 1278, 417, + /* 480 */ 28, 27, 26, 1557, 1198, 431, 442, 1081, 1289, 1418, + /* 490 */ 227, 1448, 1449, 1452, 1082, 1280, 130, 480, 42, 514, + /* 500 */ 1555, 41, 1293, 1197, 1083, 69, 1448, 1449, 1452, 1496, + /* 510 */ 1557, 1011, 1086, 257, 1492, 125, 274, 495, 493, 1276, + /* 520 */ 1177, 1039, 1087, 130, 114, 215, 420, 1555, 1323, 1418, + /* 530 */ 115, 422, 1295, 1082, 1524, 221, 24, 262, 1076, 1077, + /* 540 */ 1078, 1079, 1080, 1084, 1085, 1013, 22, 219, 1418, 1196, + /* 550 */ 1195, 1086, 32, 30, 28, 27, 26, 141, 1515, 1113, + /* 560 */ 168, 1447, 1016, 1036, 1037, 1062, 1063, 1064, 1065, 1066, + /* 570 */ 1067, 1068, 1069, 280, 1447, 24, 262, 1076, 1077, 1078, + /* 580 */ 1079, 1080, 1084, 1085, 295, 1463, 388, 271, 270, 59, + /* 590 */ 1510, 445, 429, 114, 1418, 1418, 1510, 1025, 1463, 297, + /* 600 */ 443, 1296, 431, 413, 1557, 429, 1418, 1194, 1507, 445, + /* 610 */ 1286, 417, 1050, 1018, 1506, 431, 1293, 130, 207, 1418, + /* 620 */ 67, 1555, 68, 1448, 1449, 1452, 1496, 470, 100, 1017, + /* 630 */ 237, 1492, 277, 174, 1293, 70, 1448, 1449, 1452, 1496, + /* 640 */ 114, 812, 1557, 1495, 1492, 48, 47, 307, 1295, 135, + /* 650 */ 1193, 1252, 1418, 1192, 301, 130, 1407, 350, 1190, 1555, + /* 660 */ 248, 98, 244, 517, 293, 1447, 289, 285, 132, 446, + /* 670 */ 415, 126, 1503, 1504, 1189, 1508, 1188, 212, 1125, 1510, + /* 680 */ 95, 1021, 156, 163, 1034, 154, 506, 355, 211, 1463, + /* 690 */ 494, 131, 287, 1187, 298, 1418, 416, 1505, 445, 249, + /* 700 */ 1447, 247, 246, 1418, 354, 1186, 431, 278, 428, 357, + /* 710 */ 1418, 1185, 1184, 1183, 66, 1026, 106, 205, 419, 1418, + /* 720 */ 392, 1418, 1182, 1293, 1463, 1020, 69, 1448, 1449, 1452, + /* 730 */ 1496, 429, 1029, 1340, 257, 1492, 125, 1213, 1418, 401, + /* 740 */ 1340, 431, 1447, 158, 1372, 1418, 157, 441, 189, 160, + /* 750 */ 1418, 1339, 159, 1447, 396, 1523, 1418, 1418, 1418, 369, + /* 760 */ 1211, 69, 1448, 1449, 1452, 1496, 1463, 1418, 378, 257, + /* 770 */ 1492, 1569, 395, 429, 190, 170, 162, 1463, 1447, 161, + /* 780 */ 1530, 376, 372, 431, 429, 44, 424, 1418, 338, 1139, + /* 790 */ 996, 177, 167, 1023, 431, 179, 9, 8, 1418, 413, + /* 800 */ 389, 397, 1463, 69, 1448, 1449, 1452, 1496, 1334, 429, + /* 810 */ 1019, 257, 1492, 1569, 231, 1448, 1449, 1452, 1073, 431, + /* 820 */ 64, 1447, 1553, 1418, 100, 1174, 1175, 33, 387, 33, + /* 830 */ 61, 1088, 1447, 1047, 1438, 183, 349, 832, 1012, 69, + /* 840 */ 1448, 1449, 1452, 1496, 390, 1463, 1436, 257, 1492, 1569, + /* 850 */ 1526, 33, 429, 833, 1010, 979, 1463, 98, 1514, 1464, + /* 860 */ 196, 94, 431, 429, 198, 437, 1418, 128, 1503, 1504, + /* 870 */ 1017, 1508, 104, 431, 1447, 1557, 204, 1418, 1022, 414, + /* 880 */ 192, 2, 70, 1448, 1449, 1452, 1496, 1032, 130, 282, + /* 890 */ 427, 1492, 1555, 118, 1448, 1449, 1452, 286, 1463, 243, + /* 900 */ 106, 245, 1447, 44, 889, 429, 858, 884, 450, 104, + /* 910 */ 514, 988, 917, 921, 213, 431, 105, 425, 151, 1418, + /* 920 */ 927, 124, 1011, 317, 106, 1370, 1463, 348, 926, 150, + /* 930 */ 1447, 418, 1570, 429, 137, 70, 1448, 1449, 1452, 1496, + /* 940 */ 323, 104, 330, 431, 1493, 107, 331, 1418, 332, 336, + /* 950 */ 1043, 337, 1042, 339, 1463, 53, 1013, 143, 148, 1447, + /* 960 */ 340, 429, 1041, 230, 1448, 1449, 1452, 21, 341, 146, + /* 970 */ 51, 431, 1040, 1016, 351, 1418, 344, 32, 30, 28, + /* 980 */ 27, 26, 149, 1463, 1447, 383, 356, 353, 381, 74, + /* 990 */ 429, 118, 1448, 1449, 1452, 409, 253, 1283, 384, 153, + /* 1000 */ 431, 382, 391, 1279, 1418, 155, 109, 261, 1463, 110, + /* 1010 */ 1281, 1277, 147, 111, 120, 429, 144, 112, 1447, 169, + /* 1020 */ 231, 1448, 1449, 1452, 23, 431, 1179, 393, 172, 1418, + /* 1030 */ 1571, 1039, 265, 142, 32, 30, 28, 27, 26, 402, + /* 1040 */ 1527, 394, 1463, 1017, 435, 231, 1448, 1449, 1452, 429, + /* 1050 */ 93, 92, 91, 90, 89, 88, 87, 86, 85, 431, + /* 1060 */ 1537, 175, 1447, 1418, 399, 5, 178, 410, 1447, 256, + /* 1070 */ 398, 405, 1113, 4, 1038, 99, 123, 34, 1517, 224, + /* 1080 */ 1448, 1449, 1452, 1536, 185, 258, 1463, 184, 182, 1511, + /* 1090 */ 17, 426, 1463, 429, 423, 1478, 1447, 1572, 191, 429, + /* 1100 */ 1379, 433, 1554, 431, 1447, 434, 438, 1418, 439, 431, + /* 1110 */ 1378, 200, 266, 1418, 202, 214, 440, 58, 1294, 60, + /* 1120 */ 1463, 448, 1266, 229, 1448, 1449, 1452, 429, 1463, 232, + /* 1130 */ 1448, 1449, 1452, 477, 216, 429, 210, 431, 1447, 222, + /* 1140 */ 40, 1418, 513, 223, 220, 431, 1268, 1412, 218, 1418, + /* 1150 */ 1447, 1411, 281, 1408, 283, 284, 1006, 225, 1448, 1449, + /* 1160 */ 1452, 1007, 1463, 133, 1406, 233, 1448, 1449, 1452, 429, + /* 1170 */ 288, 290, 291, 292, 1463, 1405, 294, 1404, 296, 431, + /* 1180 */ 1395, 429, 134, 1418, 299, 300, 991, 990, 1389, 1388, + /* 1190 */ 1387, 431, 305, 306, 1386, 1418, 1447, 962, 1363, 226, + /* 1200 */ 1448, 1449, 1452, 1362, 208, 1361, 1360, 1359, 476, 1358, + /* 1210 */ 1357, 234, 1448, 1449, 1452, 1356, 1355, 1354, 1353, 1352, + /* 1220 */ 1463, 1447, 1351, 103, 1350, 1349, 1348, 429, 1347, 1346, + /* 1230 */ 478, 1345, 1447, 964, 1344, 1343, 1342, 431, 1341, 1224, + /* 1240 */ 1403, 1418, 1397, 1385, 1376, 1463, 1272, 145, 825, 475, + /* 1250 */ 474, 473, 429, 472, 1223, 1221, 1463, 1460, 1448, 1449, + /* 1260 */ 1452, 345, 431, 429, 347, 1210, 1418, 1209, 1447, 346, + /* 1270 */ 1206, 1274, 73, 431, 1447, 152, 494, 1418, 932, 934, + /* 1280 */ 1273, 492, 1459, 1448, 1449, 1452, 857, 856, 855, 854, + /* 1290 */ 851, 850, 1463, 1458, 1448, 1449, 1452, 1219, 1463, 429, + /* 1300 */ 250, 1214, 1447, 251, 1212, 429, 252, 370, 1205, 431, + /* 1310 */ 1447, 373, 375, 1418, 1204, 431, 377, 1402, 71, 1418, + /* 1320 */ 166, 998, 1396, 43, 113, 385, 1463, 386, 122, 241, + /* 1330 */ 1448, 1449, 1452, 429, 1463, 240, 1448, 1449, 1452, 1384, + /* 1340 */ 1383, 429, 1375, 431, 1447, 54, 37, 1418, 171, 14, + /* 1350 */ 3, 431, 1436, 33, 173, 1418, 38, 15, 176, 1138, + /* 1360 */ 119, 181, 180, 242, 1448, 1449, 1452, 19, 1463, 10, + /* 1370 */ 55, 239, 1448, 1449, 1452, 429, 56, 20, 1131, 1110, + /* 1380 */ 36, 16, 1109, 187, 1160, 431, 1159, 1165, 259, 1418, + /* 1390 */ 1164, 1163, 260, 8, 129, 1048, 13, 35, 18, 194, + /* 1400 */ 195, 1136, 1074, 197, 199, 228, 1448, 1449, 1452, 436, + /* 1410 */ 1374, 201, 45, 1435, 57, 61, 1027, 918, 206, 203, + /* 1420 */ 39, 449, 273, 915, 453, 456, 447, 451, 454, 895, + /* 1430 */ 912, 457, 910, 906, 459, 460, 462, 904, 463, 929, + /* 1440 */ 62, 46, 63, 909, 928, 923, 469, 925, 823, 479, + /* 1450 */ 481, 908, 846, 864, 845, 907, 209, 844, 843, 842, + /* 1460 */ 841, 839, 840, 859, 836, 861, 835, 834, 831, 830, + /* 1470 */ 829, 828, 1220, 503, 504, 1208, 1207, 505, 507, 508, + /* 1480 */ 1203, 511, 512, 1178, 1014, 217, 515, 516, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 226, 210, 210, 217, 210, 226, 204, 216, 216, 210, - /* 10 */ 216, 225, 12, 13, 223, 210, 229, 223, 2, 233, - /* 20 */ 20, 201, 22, 232, 232, 229, 232, 225, 12, 13, - /* 30 */ 14, 15, 16, 246, 232, 210, 237, 232, 38, 224, - /* 40 */ 210, 216, 246, 20, 242, 258, 259, 47, 246, 225, - /* 50 */ 235, 12, 13, 14, 258, 259, 232, 232, 20, 20, - /* 60 */ 22, 22, 232, 210, 262, 263, 264, 265, 266, 69, - /* 70 */ 265, 251, 270, 271, 272, 204, 225, 38, 40, 274, - /* 80 */ 275, 276, 277, 225, 279, 232, 47, 236, 264, 231, - /* 90 */ 12, 13, 92, 291, 236, 265, 225, 204, 20, 63, - /* 100 */ 22, 20, 282, 232, 104, 275, 276, 277, 69, 279, - /* 110 */ 2, 267, 268, 242, 246, 295, 38, 246, 265, 299, - /* 120 */ 12, 13, 14, 15, 16, 47, 258, 259, 275, 276, - /* 130 */ 277, 92, 279, 262, 263, 264, 265, 266, 138, 246, - /* 140 */ 20, 270, 271, 104, 108, 109, 204, 69, 12, 13, - /* 150 */ 14, 15, 16, 130, 209, 155, 156, 157, 158, 159, - /* 160 */ 160, 161, 162, 163, 164, 220, 18, 225, 20, 69, - /* 170 */ 92, 137, 227, 139, 232, 27, 176, 138, 30, 20, - /* 180 */ 242, 81, 104, 245, 242, 234, 248, 39, 246, 69, - /* 190 */ 204, 176, 241, 242, 155, 156, 157, 158, 159, 160, - /* 200 */ 161, 162, 163, 164, 262, 263, 264, 265, 266, 210, - /* 210 */ 176, 225, 270, 271, 272, 216, 138, 0, 232, 225, - /* 220 */ 57, 210, 232, 281, 61, 231, 20, 216, 242, 239, - /* 230 */ 236, 232, 246, 155, 156, 157, 158, 159, 160, 161, - /* 240 */ 162, 163, 164, 232, 0, 82, 12, 13, 262, 263, - /* 250 */ 264, 265, 266, 46, 20, 107, 22, 271, 110, 111, - /* 260 */ 112, 113, 114, 46, 116, 117, 118, 119, 120, 121, - /* 270 */ 122, 123, 38, 21, 155, 69, 24, 25, 26, 27, - /* 280 */ 28, 29, 30, 31, 32, 12, 13, 14, 0, 49, - /* 290 */ 46, 51, 251, 20, 54, 22, 176, 57, 218, 59, - /* 300 */ 60, 221, 62, 69, 185, 186, 187, 188, 189, 21, - /* 310 */ 204, 38, 24, 25, 26, 27, 28, 29, 30, 31, - /* 320 */ 32, 210, 225, 282, 12, 13, 92, 216, 231, 128, - /* 330 */ 46, 210, 20, 236, 22, 176, 295, 216, 104, 213, - /* 340 */ 299, 215, 69, 232, 20, 12, 13, 14, 15, 16, - /* 350 */ 38, 44, 246, 232, 83, 84, 85, 86, 87, 88, - /* 360 */ 89, 90, 91, 92, 93, 92, 95, 96, 97, 98, - /* 370 */ 99, 100, 138, 204, 203, 68, 205, 104, 71, 20, - /* 380 */ 204, 69, 181, 182, 12, 13, 14, 15, 16, 155, - /* 390 */ 156, 157, 158, 159, 160, 161, 162, 163, 164, 210, - /* 400 */ 282, 225, 0, 70, 92, 216, 225, 210, 232, 20, - /* 410 */ 176, 138, 204, 295, 233, 246, 104, 299, 242, 207, - /* 420 */ 208, 232, 246, 12, 13, 14, 15, 16, 155, 156, - /* 430 */ 157, 158, 159, 160, 161, 162, 163, 164, 262, 263, - /* 440 */ 264, 265, 43, 12, 13, 14, 15, 16, 251, 217, - /* 450 */ 138, 49, 20, 51, 246, 226, 54, 225, 47, 57, - /* 460 */ 35, 59, 60, 204, 62, 233, 204, 155, 156, 157, - /* 470 */ 158, 159, 160, 161, 162, 163, 164, 301, 47, 282, - /* 480 */ 12, 13, 57, 1, 2, 20, 61, 225, 20, 78, - /* 490 */ 22, 0, 295, 124, 232, 134, 299, 72, 251, 74, - /* 500 */ 75, 70, 77, 131, 242, 246, 38, 82, 246, 78, - /* 510 */ 149, 142, 204, 251, 204, 24, 25, 26, 27, 28, - /* 520 */ 29, 30, 31, 32, 262, 263, 264, 265, 266, 282, - /* 530 */ 212, 217, 270, 271, 165, 124, 3, 69, 225, 225, - /* 540 */ 222, 212, 295, 204, 282, 210, 299, 233, 230, 236, - /* 550 */ 22, 216, 70, 142, 246, 124, 246, 295, 80, 230, - /* 560 */ 92, 299, 130, 67, 210, 210, 38, 232, 204, 197, - /* 570 */ 216, 216, 104, 142, 175, 204, 165, 166, 167, 168, - /* 580 */ 169, 170, 171, 172, 173, 246, 232, 232, 226, 12, - /* 590 */ 13, 14, 15, 16, 204, 204, 165, 166, 167, 168, - /* 600 */ 169, 170, 171, 172, 173, 0, 138, 14, 15, 16, - /* 610 */ 246, 33, 242, 14, 36, 4, 18, 246, 248, 20, - /* 620 */ 42, 23, 44, 155, 156, 157, 158, 159, 160, 161, - /* 630 */ 162, 163, 164, 35, 204, 260, 246, 246, 204, 204, - /* 640 */ 204, 204, 204, 45, 204, 204, 68, 70, 67, 71, - /* 650 */ 38, 204, 0, 278, 49, 50, 51, 52, 53, 54, - /* 660 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - /* 670 */ 65, 66, 225, 260, 260, 47, 246, 226, 209, 232, - /* 680 */ 246, 246, 246, 246, 246, 226, 246, 246, 36, 242, - /* 690 */ 194, 278, 278, 246, 174, 175, 227, 67, 73, 204, - /* 700 */ 70, 76, 21, 125, 106, 127, 254, 129, 205, 262, - /* 710 */ 263, 264, 265, 266, 215, 34, 104, 270, 271, 272, - /* 720 */ 225, 0, 0, 73, 146, 192, 76, 232, 281, 131, - /* 730 */ 132, 133, 73, 135, 0, 76, 73, 242, 140, 76, - /* 740 */ 235, 246, 204, 22, 22, 69, 148, 302, 150, 293, - /* 750 */ 152, 153, 154, 1, 2, 79, 22, 262, 263, 264, - /* 760 */ 265, 266, 287, 225, 207, 270, 271, 272, 67, 67, - /* 770 */ 232, 70, 70, 67, 176, 38, 70, 196, 204, 284, - /* 780 */ 242, 199, 200, 155, 246, 290, 291, 67, 177, 280, - /* 790 */ 70, 67, 67, 67, 70, 70, 70, 261, 225, 225, - /* 800 */ 262, 263, 264, 265, 266, 204, 232, 296, 270, 271, - /* 810 */ 272, 67, 67, 283, 70, 70, 242, 20, 67, 281, - /* 820 */ 246, 70, 36, 210, 257, 251, 225, 210, 19, 214, - /* 830 */ 136, 67, 38, 232, 70, 252, 262, 263, 264, 265, - /* 840 */ 240, 104, 33, 242, 210, 36, 210, 246, 115, 232, - /* 850 */ 210, 42, 67, 44, 67, 70, 282, 70, 67, 67, - /* 860 */ 204, 70, 70, 262, 263, 264, 265, 266, 251, 295, - /* 870 */ 124, 270, 271, 299, 20, 238, 238, 68, 256, 20, - /* 880 */ 71, 225, 265, 67, 242, 250, 70, 212, 232, 232, - /* 890 */ 20, 243, 275, 276, 277, 212, 279, 212, 242, 282, - /* 900 */ 210, 212, 246, 20, 204, 206, 210, 225, 145, 204, - /* 910 */ 101, 225, 295, 225, 256, 255, 299, 225, 262, 263, - /* 920 */ 264, 265, 225, 225, 214, 225, 214, 232, 225, 225, - /* 930 */ 225, 20, 232, 225, 225, 126, 225, 232, 129, 209, - /* 940 */ 209, 206, 242, 250, 184, 232, 246, 242, 261, 249, - /* 950 */ 243, 246, 183, 144, 249, 146, 300, 301, 242, 292, - /* 960 */ 156, 247, 262, 263, 264, 265, 204, 262, 263, 264, - /* 970 */ 265, 204, 292, 246, 191, 247, 175, 179, 246, 190, - /* 980 */ 289, 232, 246, 178, 20, 69, 115, 225, 198, 260, - /* 990 */ 195, 273, 225, 193, 232, 247, 246, 244, 232, 232, - /* 1000 */ 246, 246, 285, 288, 242, 286, 247, 204, 246, 242, - /* 1010 */ 269, 127, 232, 246, 243, 204, 249, 209, 69, 209, - /* 1020 */ 221, 298, 210, 209, 262, 263, 264, 265, 225, 262, - /* 1030 */ 263, 264, 265, 214, 228, 232, 225, 297, 214, 206, - /* 1040 */ 219, 204, 303, 232, 219, 242, 253, 211, 0, 246, - /* 1050 */ 204, 202, 249, 242, 0, 60, 294, 246, 0, 38, - /* 1060 */ 151, 38, 225, 151, 38, 262, 263, 264, 265, 232, - /* 1070 */ 38, 225, 0, 262, 263, 264, 265, 204, 232, 242, - /* 1080 */ 38, 38, 151, 246, 0, 204, 0, 38, 242, 0, - /* 1090 */ 38, 69, 246, 142, 141, 104, 0, 138, 225, 262, - /* 1100 */ 263, 264, 265, 0, 134, 232, 225, 50, 262, 263, - /* 1110 */ 264, 265, 0, 232, 0, 242, 81, 0, 0, 246, - /* 1120 */ 0, 204, 0, 242, 0, 0, 204, 246, 0, 0, - /* 1130 */ 0, 0, 0, 0, 0, 262, 263, 264, 265, 115, - /* 1140 */ 0, 0, 225, 262, 263, 264, 265, 225, 0, 232, - /* 1150 */ 0, 0, 0, 0, 232, 0, 0, 22, 0, 242, - /* 1160 */ 0, 0, 204, 246, 242, 0, 0, 204, 246, 0, - /* 1170 */ 43, 0, 0, 204, 48, 0, 38, 0, 36, 262, - /* 1180 */ 263, 264, 265, 225, 262, 263, 264, 265, 225, 43, - /* 1190 */ 232, 0, 0, 0, 225, 232, 22, 78, 0, 76, - /* 1200 */ 242, 232, 38, 67, 246, 242, 38, 0, 38, 246, - /* 1210 */ 22, 242, 0, 0, 204, 246, 38, 38, 38, 38, - /* 1220 */ 262, 263, 264, 265, 22, 262, 263, 264, 265, 204, - /* 1230 */ 22, 262, 263, 264, 265, 225, 39, 38, 12, 13, - /* 1240 */ 204, 22, 232, 0, 0, 22, 0, 20, 22, 0, - /* 1250 */ 225, 130, 242, 147, 38, 204, 246, 232, 0, 143, - /* 1260 */ 22, 225, 0, 22, 38, 0, 0, 242, 232, 130, - /* 1270 */ 127, 246, 262, 263, 264, 265, 225, 130, 242, 38, - /* 1280 */ 0, 204, 246, 232, 69, 43, 69, 262, 263, 264, - /* 1290 */ 265, 67, 4, 242, 69, 67, 67, 246, 262, 263, - /* 1300 */ 264, 265, 225, 70, 70, 69, 57, 19, 125, 232, - /* 1310 */ 61, 81, 67, 262, 263, 264, 265, 180, 92, 242, - /* 1320 */ 70, 33, 57, 246, 36, 69, 61, 67, 81, 41, - /* 1330 */ 104, 82, 44, 92, 180, 81, 174, 70, 70, 262, - /* 1340 */ 263, 264, 265, 67, 70, 104, 67, 82, 4, 38, - /* 1350 */ 101, 102, 103, 180, 105, 38, 68, 38, 38, 71, - /* 1360 */ 38, 38, 2, 81, 138, 155, 101, 102, 103, 70, - /* 1370 */ 105, 69, 69, 0, 70, 70, 69, 69, 69, 138, - /* 1380 */ 128, 155, 156, 43, 125, 69, 22, 81, 70, 79, - /* 1390 */ 69, 38, 38, 81, 80, 69, 155, 156, 70, 38, - /* 1400 */ 69, 38, 70, 69, 38, 70, 69, 38, 70, 94, - /* 1410 */ 69, 22, 82, 38, 69, 69, 69, 104, 94, 94, - /* 1420 */ 38, 94, 22, 22, 48, 47, 38, 22, 38, 38, - /* 1430 */ 38, 38, 38, 38, 38, 38, 38, 38, 0, 0, - /* 1440 */ 38, 38, 38, 0, 38, 38, 38, 36, 38, 37, - /* 1450 */ 0, 22, 43, 21, 304, 22, 22, 21, 304, 304, - /* 1460 */ 20, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1470 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1480 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1490 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1500 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1510 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1520 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1530 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1540 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1550 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1560 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1570 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1580 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1590 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1600 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1610 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1620 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1630 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1640 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1650 */ 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, - /* 1660 */ 304, 304, + /* 0 */ 233, 246, 233, 205, 249, 213, 0, 252, 238, 271, + /* 10 */ 272, 255, 12, 13, 228, 245, 246, 250, 226, 250, + /* 20 */ 20, 20, 22, 250, 211, 239, 234, 229, 22, 262, + /* 30 */ 263, 262, 263, 220, 236, 262, 263, 214, 38, 229, + /* 40 */ 227, 218, 286, 211, 246, 235, 205, 47, 250, 236, + /* 50 */ 240, 253, 0, 211, 54, 299, 20, 246, 22, 303, + /* 60 */ 12, 13, 14, 252, 266, 267, 268, 269, 20, 0, + /* 70 */ 22, 71, 71, 241, 12, 13, 40, 20, 236, 229, + /* 80 */ 211, 20, 20, 211, 22, 235, 38, 46, 12, 13, + /* 90 */ 240, 250, 220, 20, 94, 47, 20, 255, 22, 227, + /* 100 */ 38, 49, 54, 51, 38, 236, 106, 55, 236, 47, + /* 110 */ 58, 269, 60, 61, 38, 63, 54, 20, 229, 71, + /* 120 */ 54, 279, 280, 281, 235, 283, 211, 58, 286, 240, + /* 130 */ 54, 62, 71, 71, 0, 220, 229, 204, 269, 206, + /* 140 */ 140, 299, 94, 236, 20, 303, 211, 71, 279, 280, + /* 150 */ 281, 236, 283, 84, 106, 220, 94, 157, 158, 159, + /* 160 */ 160, 161, 162, 163, 164, 165, 166, 167, 106, 54, + /* 170 */ 94, 236, 103, 104, 105, 268, 107, 58, 4, 179, + /* 180 */ 179, 62, 106, 49, 50, 51, 52, 53, 140, 55, + /* 190 */ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + /* 200 */ 66, 67, 140, 84, 43, 157, 158, 159, 160, 161, + /* 210 */ 162, 163, 164, 165, 166, 167, 140, 208, 209, 157, + /* 220 */ 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + /* 230 */ 20, 158, 159, 157, 158, 159, 160, 161, 162, 163, + /* 240 */ 164, 165, 166, 167, 157, 0, 12, 13, 14, 12, + /* 250 */ 13, 14, 15, 16, 20, 179, 22, 44, 20, 12, + /* 260 */ 13, 18, 139, 20, 141, 211, 210, 20, 0, 22, + /* 270 */ 27, 130, 38, 30, 220, 188, 189, 190, 191, 192, + /* 280 */ 224, 179, 39, 70, 205, 38, 73, 231, 54, 21, + /* 290 */ 236, 46, 24, 25, 26, 27, 28, 29, 30, 31, + /* 300 */ 32, 54, 179, 179, 64, 71, 46, 85, 86, 87, + /* 310 */ 88, 89, 90, 91, 92, 93, 94, 95, 71, 97, + /* 320 */ 98, 99, 100, 101, 102, 184, 185, 21, 94, 250, + /* 330 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 178, + /* 340 */ 106, 94, 132, 12, 13, 14, 15, 16, 215, 216, + /* 350 */ 110, 111, 109, 106, 180, 112, 113, 114, 115, 116, + /* 360 */ 211, 118, 119, 120, 121, 122, 123, 124, 125, 220, + /* 370 */ 133, 1, 2, 20, 140, 12, 13, 14, 15, 16, + /* 380 */ 12, 13, 14, 15, 16, 236, 205, 140, 217, 205, + /* 390 */ 219, 157, 158, 159, 160, 161, 162, 163, 164, 165, + /* 400 */ 166, 167, 68, 72, 157, 158, 159, 160, 161, 162, + /* 410 */ 163, 164, 165, 166, 167, 47, 230, 12, 13, 12, + /* 420 */ 13, 14, 15, 16, 49, 20, 51, 22, 205, 205, + /* 430 */ 55, 250, 4, 58, 250, 60, 61, 200, 63, 82, + /* 440 */ 72, 211, 72, 38, 205, 286, 211, 19, 80, 221, + /* 450 */ 220, 0, 255, 229, 47, 220, 236, 229, 299, 54, + /* 460 */ 236, 33, 303, 243, 36, 237, 236, 213, 229, 41, + /* 470 */ 246, 236, 44, 250, 250, 236, 71, 211, 230, 255, + /* 480 */ 14, 15, 16, 286, 205, 246, 220, 80, 234, 250, + /* 490 */ 266, 267, 268, 269, 126, 230, 299, 46, 70, 94, + /* 500 */ 303, 73, 236, 205, 126, 266, 267, 268, 269, 270, + /* 510 */ 286, 106, 144, 274, 275, 276, 221, 215, 216, 230, + /* 520 */ 202, 20, 144, 299, 229, 222, 3, 303, 225, 250, + /* 530 */ 18, 197, 237, 126, 295, 23, 168, 169, 170, 171, + /* 540 */ 172, 173, 174, 175, 176, 140, 168, 35, 250, 205, + /* 550 */ 205, 144, 12, 13, 14, 15, 16, 45, 177, 178, + /* 560 */ 230, 205, 157, 158, 159, 160, 161, 162, 163, 164, + /* 570 */ 165, 166, 167, 255, 205, 168, 169, 170, 171, 172, + /* 580 */ 173, 174, 175, 176, 136, 229, 258, 12, 13, 210, + /* 590 */ 264, 211, 236, 229, 250, 250, 264, 22, 229, 151, + /* 600 */ 220, 237, 246, 211, 286, 236, 250, 205, 282, 211, + /* 610 */ 231, 255, 72, 38, 282, 246, 236, 299, 220, 250, + /* 620 */ 108, 303, 266, 267, 268, 269, 270, 230, 236, 54, + /* 630 */ 274, 275, 221, 132, 236, 266, 267, 268, 269, 270, + /* 640 */ 229, 22, 286, 274, 275, 133, 134, 135, 237, 137, + /* 650 */ 205, 218, 250, 206, 142, 299, 0, 38, 205, 303, + /* 660 */ 35, 269, 150, 19, 152, 205, 154, 155, 156, 94, + /* 670 */ 278, 279, 280, 281, 205, 283, 205, 33, 14, 264, + /* 680 */ 36, 106, 75, 58, 20, 78, 42, 62, 44, 229, + /* 690 */ 68, 179, 36, 205, 72, 250, 236, 282, 211, 74, + /* 700 */ 205, 76, 77, 250, 79, 205, 246, 220, 47, 84, + /* 710 */ 250, 205, 205, 205, 70, 140, 68, 73, 195, 250, + /* 720 */ 72, 250, 205, 236, 229, 38, 266, 267, 268, 269, + /* 730 */ 270, 236, 157, 229, 274, 275, 276, 0, 250, 297, + /* 740 */ 229, 246, 205, 75, 240, 250, 78, 103, 288, 75, + /* 750 */ 250, 240, 78, 205, 294, 295, 250, 250, 250, 22, + /* 760 */ 0, 266, 267, 268, 269, 270, 229, 250, 21, 274, + /* 770 */ 275, 276, 128, 236, 306, 131, 75, 229, 205, 78, + /* 780 */ 285, 34, 22, 246, 236, 68, 68, 250, 246, 72, + /* 790 */ 146, 68, 148, 106, 246, 72, 1, 2, 250, 211, + /* 800 */ 211, 253, 229, 266, 267, 268, 269, 270, 239, 236, + /* 810 */ 38, 274, 275, 276, 266, 267, 268, 269, 157, 246, + /* 820 */ 71, 205, 285, 250, 236, 158, 159, 68, 246, 68, + /* 830 */ 81, 72, 205, 72, 71, 291, 208, 38, 22, 266, + /* 840 */ 267, 268, 269, 270, 255, 229, 83, 274, 275, 276, + /* 850 */ 265, 68, 236, 54, 38, 72, 229, 269, 285, 229, + /* 860 */ 68, 68, 246, 236, 72, 72, 250, 279, 280, 281, + /* 870 */ 54, 283, 68, 246, 205, 286, 72, 250, 106, 284, + /* 880 */ 300, 287, 266, 267, 268, 269, 270, 20, 299, 211, + /* 890 */ 274, 275, 303, 266, 267, 268, 269, 36, 229, 261, + /* 900 */ 68, 215, 205, 68, 72, 236, 38, 72, 68, 68, + /* 910 */ 94, 138, 72, 72, 256, 246, 68, 199, 33, 250, + /* 920 */ 72, 36, 106, 211, 68, 211, 229, 42, 72, 44, + /* 930 */ 205, 304, 305, 236, 117, 266, 267, 268, 269, 270, + /* 940 */ 244, 68, 242, 246, 275, 72, 126, 250, 242, 211, + /* 950 */ 20, 260, 20, 254, 229, 70, 140, 213, 73, 205, + /* 960 */ 236, 236, 20, 266, 267, 268, 269, 2, 247, 213, + /* 970 */ 213, 246, 20, 157, 207, 250, 211, 12, 13, 14, + /* 980 */ 15, 16, 213, 229, 205, 147, 215, 229, 236, 211, + /* 990 */ 236, 266, 267, 268, 269, 298, 207, 229, 259, 229, + /* 1000 */ 246, 260, 254, 229, 250, 229, 229, 253, 229, 229, + /* 1010 */ 229, 229, 127, 229, 129, 236, 131, 229, 205, 210, + /* 1020 */ 266, 267, 268, 269, 2, 246, 0, 236, 210, 250, + /* 1030 */ 305, 20, 253, 148, 12, 13, 14, 15, 16, 187, + /* 1040 */ 265, 247, 229, 54, 186, 266, 267, 268, 269, 236, + /* 1050 */ 24, 25, 26, 27, 28, 29, 30, 31, 32, 246, + /* 1060 */ 296, 251, 205, 250, 250, 194, 251, 193, 205, 250, + /* 1070 */ 182, 250, 178, 181, 20, 236, 290, 117, 293, 266, + /* 1080 */ 267, 268, 269, 296, 277, 201, 229, 289, 292, 264, + /* 1090 */ 71, 198, 229, 236, 196, 273, 205, 307, 301, 236, + /* 1100 */ 251, 250, 302, 246, 205, 250, 129, 250, 248, 246, + /* 1110 */ 251, 236, 250, 250, 210, 225, 247, 210, 236, 71, + /* 1120 */ 229, 232, 219, 266, 267, 268, 269, 236, 229, 266, + /* 1130 */ 267, 268, 269, 215, 211, 236, 210, 246, 205, 223, + /* 1140 */ 257, 250, 207, 223, 203, 246, 0, 0, 212, 250, + /* 1150 */ 205, 0, 61, 0, 38, 153, 38, 266, 267, 268, + /* 1160 */ 269, 38, 229, 38, 0, 266, 267, 268, 269, 236, + /* 1170 */ 153, 38, 38, 153, 229, 0, 38, 0, 38, 246, + /* 1180 */ 0, 236, 71, 250, 144, 143, 106, 140, 0, 0, + /* 1190 */ 0, 246, 50, 136, 0, 250, 205, 83, 0, 266, + /* 1200 */ 267, 268, 269, 0, 58, 0, 0, 0, 62, 0, + /* 1210 */ 0, 266, 267, 268, 269, 0, 0, 0, 0, 0, + /* 1220 */ 229, 205, 0, 117, 0, 0, 0, 236, 0, 0, + /* 1230 */ 84, 0, 205, 22, 0, 0, 0, 246, 0, 0, + /* 1240 */ 0, 250, 0, 0, 0, 229, 0, 43, 48, 103, + /* 1250 */ 104, 105, 236, 107, 0, 0, 229, 266, 267, 268, + /* 1260 */ 269, 38, 246, 236, 43, 0, 250, 0, 205, 36, + /* 1270 */ 0, 0, 80, 246, 205, 78, 68, 250, 22, 38, + /* 1280 */ 0, 68, 266, 267, 268, 269, 38, 38, 38, 38, + /* 1290 */ 38, 38, 229, 266, 267, 268, 269, 0, 229, 236, + /* 1300 */ 22, 0, 205, 22, 0, 236, 22, 39, 0, 246, + /* 1310 */ 205, 38, 22, 250, 0, 246, 22, 0, 20, 250, + /* 1320 */ 149, 38, 0, 132, 145, 22, 229, 132, 129, 266, + /* 1330 */ 267, 268, 269, 236, 229, 266, 267, 268, 269, 0, + /* 1340 */ 0, 236, 0, 246, 205, 71, 132, 250, 43, 183, + /* 1350 */ 68, 246, 83, 68, 127, 250, 68, 183, 72, 72, + /* 1360 */ 71, 68, 71, 266, 267, 268, 269, 71, 229, 183, + /* 1370 */ 71, 266, 267, 268, 269, 236, 4, 68, 72, 72, + /* 1380 */ 68, 68, 72, 83, 38, 246, 38, 72, 38, 250, + /* 1390 */ 38, 38, 38, 2, 83, 72, 71, 177, 71, 83, + /* 1400 */ 72, 72, 157, 71, 71, 266, 267, 268, 269, 130, + /* 1410 */ 0, 43, 71, 83, 71, 81, 22, 72, 83, 127, + /* 1420 */ 71, 38, 38, 72, 38, 38, 82, 71, 71, 22, + /* 1430 */ 72, 71, 96, 72, 38, 71, 38, 72, 71, 38, + /* 1440 */ 71, 71, 71, 96, 106, 22, 84, 38, 48, 47, + /* 1450 */ 69, 96, 38, 54, 38, 96, 68, 38, 38, 38, + /* 1460 */ 38, 22, 38, 38, 38, 54, 38, 38, 38, 38, + /* 1470 */ 38, 38, 0, 38, 36, 0, 0, 43, 38, 37, + /* 1480 */ 0, 22, 21, 308, 22, 22, 21, 20, 308, 308, + /* 1490 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1500 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1510 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1520 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1530 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1540 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1550 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1560 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1570 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1580 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1590 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1600 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1610 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1620 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1630 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1640 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1650 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1660 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1670 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + /* 1680 */ 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, }; -#define YY_SHIFT_COUNT (510) +#define YY_SHIFT_COUNT (517) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1450) +#define YY_SHIFT_MAX (1480) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 598, 0, 39, 78, 78, 78, 78, 234, 78, 78, - /* 10 */ 312, 468, 120, 273, 312, 312, 312, 312, 312, 312, - /* 20 */ 312, 312, 312, 312, 312, 312, 312, 312, 312, 312, - /* 30 */ 312, 312, 312, 312, 206, 206, 206, 159, 1226, 1226, - /* 40 */ 34, 81, 81, 15, 1226, 81, 81, 81, 81, 81, - /* 50 */ 81, 207, 324, 359, 15, 389, 324, 81, 81, 324, - /* 60 */ 81, 324, 389, 324, 324, 81, 284, 148, 431, 411, - /* 70 */ 411, 252, 425, 1241, 240, 1241, 1241, 1241, 1241, 1241, - /* 80 */ 1241, 1241, 1241, 1241, 1241, 1241, 1241, 1241, 1241, 1241, - /* 90 */ 1241, 1241, 1241, 1241, 38, 217, 23, 23, 23, 244, - /* 100 */ 465, 389, 324, 324, 324, 478, 271, 271, 271, 271, - /* 110 */ 271, 271, 809, 288, 402, 372, 119, 163, 201, 528, - /* 120 */ 432, 520, 399, 520, 599, 533, 611, 797, 786, 794, - /* 130 */ 694, 797, 797, 733, 746, 746, 797, 854, 389, 859, - /* 140 */ 207, 465, 870, 207, 207, 797, 207, 883, 324, 324, - /* 150 */ 324, 324, 324, 324, 324, 324, 324, 324, 324, 794, - /* 160 */ 794, 797, 883, 465, 854, 763, 389, 859, 284, 465, - /* 170 */ 870, 284, 911, 760, 769, 804, 760, 769, 804, 804, - /* 180 */ 783, 789, 798, 805, 801, 465, 964, 871, 790, 795, - /* 190 */ 800, 916, 324, 769, 804, 804, 769, 804, 884, 465, - /* 200 */ 870, 284, 478, 284, 465, 949, 794, 794, 797, 284, - /* 210 */ 883, 1461, 1461, 1461, 1461, 1461, 605, 578, 491, 1288, - /* 220 */ 1249, 1265, 333, 16, 108, 577, 136, 136, 136, 136, - /* 230 */ 136, 136, 136, 307, 36, 482, 369, 593, 593, 593, - /* 240 */ 593, 652, 361, 630, 625, 650, 659, 663, 721, 722, - /* 250 */ 734, 681, 701, 702, 706, 752, 582, 496, 581, 720, - /* 260 */ 628, 724, 100, 725, 726, 744, 745, 751, 612, 737, - /* 270 */ 764, 785, 787, 791, 792, 816, 676, 1048, 1054, 995, - /* 280 */ 1058, 1021, 909, 1023, 1026, 1032, 912, 1072, 1042, 1043, - /* 290 */ 931, 1084, 1049, 1086, 1052, 1089, 1022, 951, 953, 991, - /* 300 */ 959, 1096, 1103, 1057, 970, 1112, 1114, 1035, 1117, 1118, - /* 310 */ 1120, 1122, 1124, 1125, 1128, 1129, 1130, 1131, 1132, 1133, - /* 320 */ 1134, 1024, 1140, 1141, 1148, 1150, 1151, 1152, 1135, 1153, - /* 330 */ 1155, 1156, 1158, 1160, 1161, 1165, 1166, 1169, 1127, 1171, - /* 340 */ 1126, 1172, 1175, 1138, 1142, 1146, 1177, 1191, 1192, 1193, - /* 350 */ 1119, 1123, 1164, 1136, 1174, 1198, 1168, 1170, 1178, 1179, - /* 360 */ 1136, 1180, 1181, 1207, 1188, 1212, 1202, 1197, 1213, 1208, - /* 370 */ 1199, 1243, 1219, 1244, 1223, 1227, 1246, 1121, 1106, 1216, - /* 380 */ 1258, 1116, 1238, 1139, 1143, 1262, 1266, 1147, 1280, 1215, - /* 390 */ 1242, 1183, 1224, 1228, 1137, 1233, 1229, 1234, 1217, 1225, - /* 400 */ 1236, 1250, 1245, 1230, 1256, 1260, 1154, 1267, 1268, 1247, - /* 410 */ 1162, 1276, 1254, 1274, 1279, 1173, 1344, 1311, 1317, 1319, - /* 420 */ 1320, 1322, 1323, 1360, 1210, 1282, 1299, 1302, 1303, 1304, - /* 430 */ 1305, 1307, 1308, 1252, 1309, 1373, 1340, 1259, 1316, 1310, - /* 440 */ 1306, 1312, 1364, 1321, 1314, 1318, 1353, 1354, 1326, 1328, - /* 450 */ 1361, 1331, 1332, 1363, 1334, 1335, 1366, 1337, 1338, 1369, - /* 460 */ 1341, 1315, 1324, 1325, 1327, 1389, 1330, 1345, 1375, 1313, - /* 470 */ 1346, 1347, 1382, 1136, 1400, 1376, 1378, 1401, 1388, 1390, - /* 480 */ 1391, 1392, 1393, 1394, 1395, 1405, 1396, 1136, 1397, 1398, - /* 490 */ 1399, 1402, 1403, 1404, 1406, 1407, 1438, 1408, 1411, 1409, - /* 500 */ 1439, 1410, 1412, 1443, 1450, 1429, 1432, 1433, 1434, 1436, - /* 510 */ 1440, + /* 0 */ 512, 0, 48, 62, 62, 62, 62, 76, 62, 62, + /* 10 */ 247, 405, 1, 234, 247, 247, 247, 247, 247, 247, + /* 20 */ 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + /* 30 */ 247, 247, 247, 247, 61, 61, 61, 124, 575, 575, + /* 40 */ 123, 57, 57, 102, 575, 73, 73, 57, 57, 57, + /* 50 */ 57, 57, 57, 41, 97, 238, 102, 97, 57, 57, + /* 60 */ 97, 57, 97, 97, 97, 57, 260, 243, 368, 407, + /* 70 */ 407, 306, 625, 816, 375, 816, 816, 816, 816, 816, + /* 80 */ 816, 816, 816, 816, 816, 816, 816, 816, 816, 816, + /* 90 */ 816, 816, 816, 816, 73, 36, 245, 66, 210, 210, + /* 100 */ 210, 451, 66, 353, 97, 97, 97, 357, 115, 222, + /* 110 */ 222, 222, 222, 222, 222, 644, 268, 52, 237, 87, + /* 120 */ 73, 119, 73, 141, 619, 501, 381, 161, 381, 664, + /* 130 */ 523, 174, 867, 861, 868, 773, 867, 867, 817, 820, + /* 140 */ 820, 867, 930, 932, 41, 353, 942, 41, 41, 867, + /* 150 */ 41, 952, 97, 97, 97, 97, 97, 97, 97, 97, + /* 160 */ 97, 97, 97, 868, 867, 952, 353, 930, 838, 932, + /* 170 */ 260, 353, 942, 260, 1011, 852, 858, 989, 852, 858, + /* 180 */ 989, 989, 871, 874, 888, 892, 894, 353, 1054, 960, + /* 190 */ 884, 893, 898, 1019, 97, 858, 989, 989, 858, 989, + /* 200 */ 977, 353, 942, 260, 357, 260, 353, 1048, 868, 115, + /* 210 */ 867, 260, 952, 1488, 1488, 1488, 1488, 1488, 134, 885, + /* 220 */ 1026, 428, 69, 1146, 331, 965, 1022, 540, 363, 363, + /* 230 */ 363, 363, 363, 363, 363, 213, 240, 370, 378, 466, + /* 240 */ 466, 466, 466, 656, 448, 622, 607, 668, 674, 701, + /* 250 */ 6, 737, 760, 747, 648, 717, 723, 795, 667, 334, + /* 260 */ 718, 759, 661, 761, 763, 783, 792, 793, 804, 832, + /* 270 */ 687, 772, 835, 840, 841, 848, 856, 873, 749, 799, + /* 280 */ 1147, 1151, 1091, 1153, 1116, 1002, 1118, 1123, 1125, 1017, + /* 290 */ 1164, 1133, 1134, 1020, 1175, 1138, 1177, 1140, 1180, 1111, + /* 300 */ 1040, 1042, 1080, 1047, 1188, 1189, 1142, 1057, 1190, 1194, + /* 310 */ 1114, 1198, 1203, 1205, 1206, 1207, 1209, 1210, 1215, 1216, + /* 320 */ 1217, 1218, 1219, 1222, 1106, 1224, 1225, 1226, 1228, 1229, + /* 330 */ 1231, 1211, 1234, 1235, 1236, 1238, 1239, 1240, 1242, 1243, + /* 340 */ 1244, 1204, 1246, 1200, 1254, 1255, 1223, 1233, 1221, 1265, + /* 350 */ 1267, 1270, 1271, 1192, 1197, 1241, 1208, 1256, 1280, 1248, + /* 360 */ 1249, 1250, 1251, 1213, 1208, 1252, 1253, 1297, 1278, 1301, + /* 370 */ 1281, 1268, 1304, 1284, 1273, 1308, 1290, 1314, 1294, 1298, + /* 380 */ 1317, 1191, 1171, 1283, 1322, 1179, 1303, 1195, 1199, 1339, + /* 390 */ 1340, 1214, 1342, 1274, 1305, 1227, 1282, 1285, 1166, 1286, + /* 400 */ 1288, 1287, 1289, 1291, 1296, 1306, 1293, 1269, 1299, 1309, + /* 410 */ 1174, 1307, 1310, 1300, 1220, 1312, 1311, 1315, 1313, 1186, + /* 420 */ 1372, 1346, 1348, 1350, 1352, 1353, 1354, 1391, 1245, 1316, + /* 430 */ 1323, 1325, 1327, 1328, 1329, 1332, 1333, 1279, 1341, 1410, + /* 440 */ 1368, 1292, 1343, 1334, 1330, 1335, 1394, 1349, 1344, 1345, + /* 450 */ 1383, 1384, 1356, 1351, 1386, 1357, 1358, 1387, 1360, 1361, + /* 460 */ 1396, 1364, 1365, 1398, 1367, 1336, 1347, 1355, 1359, 1407, + /* 470 */ 1362, 1369, 1401, 1338, 1370, 1371, 1409, 1208, 1423, 1400, + /* 480 */ 1402, 1399, 1381, 1388, 1414, 1416, 1419, 1420, 1421, 1422, + /* 490 */ 1424, 1439, 1411, 1213, 1425, 1208, 1426, 1428, 1429, 1430, + /* 500 */ 1431, 1432, 1433, 1472, 1435, 1438, 1434, 1475, 1440, 1442, + /* 510 */ 1476, 1480, 1459, 1461, 1462, 1463, 1465, 1467, }; -#define YY_REDUCE_COUNT (215) -#define YY_REDUCE_MIN (-226) -#define YY_REDUCE_MAX (1077) +#define YY_REDUCE_COUNT (217) +#define YY_REDUCE_MIN (-262) +#define YY_REDUCE_MAX (1139) static const short yy_reduce_ofst[] = { - /* 0 */ -180, 262, 495, -198, -58, 447, 538, 574, -129, 601, - /* 10 */ 656, -14, 617, 700, 705, 762, 176, 767, 803, 811, - /* 20 */ 837, 846, 873, 881, 917, 922, 958, 963, 969, 1010, - /* 30 */ 1025, 1036, 1051, 1077, -195, -170, -147, 197, -213, -204, - /* 40 */ 41, -209, -206, 247, -132, -208, -175, -1, 11, 111, - /* 50 */ 121, 318, -142, -176, 118, -62, -214, 189, 335, -6, - /* 60 */ 354, 232, -49, 97, 314, 355, -55, -201, -156, -156, - /* 70 */ -156, 171, -185, -107, 126, 106, 169, 208, 259, 308, - /* 80 */ 310, 339, 364, 371, 390, 391, 430, 434, 435, 436, - /* 90 */ 437, 438, 440, 441, 212, 329, 375, 413, 414, 469, - /* 100 */ -10, 370, 181, -149, 313, 80, -226, -221, 229, 362, - /* 110 */ 451, 459, 452, 503, 499, 445, 456, 505, 475, 557, - /* 120 */ 536, 509, 509, 509, 573, 511, 530, 613, 567, 615, - /* 130 */ 583, 634, 636, 600, 637, 638, 640, 622, 642, 635, - /* 140 */ 675, 657, 648, 683, 685, 690, 689, 699, 682, 686, - /* 150 */ 688, 692, 697, 698, 703, 704, 708, 709, 711, 710, - /* 160 */ 712, 696, 735, 695, 658, 660, 716, 693, 730, 713, - /* 170 */ 707, 731, 687, 667, 714, 727, 680, 728, 732, 736, - /* 180 */ 691, 715, 719, 717, 509, 749, 729, 718, 739, 723, - /* 190 */ 740, 741, 573, 748, 750, 754, 759, 755, 753, 766, - /* 200 */ 771, 808, 799, 810, 780, 806, 819, 824, 812, 814, - /* 210 */ 833, 793, 821, 825, 836, 849, + /* 0 */ 318, 356, 460, 239, 495, 537, 573, 224, 369, 616, + /* 10 */ 627, 669, -158, -202, 548, 697, 725, 754, 779, 813, + /* 20 */ 857, 863, 891, 899, 933, 945, 991, 1016, 1027, 1063, + /* 30 */ 1069, 1097, 1105, 1139, 392, -131, 588, 589, -233, -231, + /* 40 */ -244, -187, -128, 197, -227, -245, -230, -85, -65, 54, + /* 50 */ 149, 230, 235, -208, -190, -93, 159, 228, 266, 380, + /* 60 */ -150, 398, 295, -111, 411, 487, 56, -168, -262, -262, + /* 70 */ -262, -67, -214, -159, -177, 79, 181, 184, 223, 279, + /* 80 */ 298, 344, 345, 402, 445, 453, 469, 471, 488, 500, + /* 90 */ 506, 507, 508, 517, -189, 9, 254, 133, 326, 332, + /* 100 */ 415, 379, 302, 220, 364, 504, 511, 303, 171, 186, + /* 110 */ 248, 265, 289, 330, 397, 328, 447, 433, 468, 442, + /* 120 */ 542, 569, 582, 544, 628, 585, 595, 595, 595, 630, + /* 130 */ 580, 594, 678, 638, 686, 658, 712, 714, 696, 700, + /* 140 */ 706, 738, 691, 699, 744, 724, 721, 756, 757, 765, + /* 150 */ 769, 767, 758, 768, 770, 774, 776, 777, 780, 781, + /* 160 */ 782, 784, 788, 771, 778, 789, 752, 741, 739, 748, + /* 170 */ 809, 791, 794, 818, 775, 764, 810, 814, 787, 815, + /* 180 */ 819, 821, 785, 796, 786, 798, 595, 839, 825, 807, + /* 190 */ 790, 800, 797, 822, 630, 849, 851, 855, 859, 862, + /* 200 */ 860, 875, 869, 904, 890, 907, 882, 889, 918, 903, + /* 210 */ 923, 926, 935, 883, 916, 920, 936, 941, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 10 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 20 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 30 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 40 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 50 */ 1152, 1205, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 60 */ 1152, 1152, 1152, 1152, 1152, 1152, 1203, 1332, 1152, 1464, - /* 70 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 80 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 90 */ 1152, 1152, 1152, 1152, 1152, 1205, 1475, 1475, 1475, 1203, - /* 100 */ 1152, 1152, 1152, 1152, 1152, 1290, 1152, 1152, 1152, 1152, - /* 110 */ 1152, 1152, 1366, 1152, 1152, 1539, 1152, 1243, 1499, 1152, - /* 120 */ 1491, 1467, 1481, 1468, 1152, 1524, 1484, 1152, 1152, 1152, - /* 130 */ 1358, 1152, 1152, 1337, 1334, 1334, 1152, 1152, 1152, 1152, - /* 140 */ 1205, 1152, 1152, 1205, 1205, 1152, 1205, 1152, 1152, 1152, - /* 150 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 160 */ 1152, 1152, 1152, 1152, 1152, 1368, 1152, 1152, 1203, 1152, - /* 170 */ 1152, 1203, 1152, 1506, 1504, 1152, 1506, 1504, 1152, 1152, - /* 180 */ 1518, 1514, 1497, 1495, 1481, 1152, 1152, 1152, 1542, 1530, - /* 190 */ 1526, 1152, 1152, 1504, 1152, 1152, 1504, 1152, 1345, 1152, - /* 200 */ 1152, 1203, 1152, 1203, 1152, 1259, 1152, 1152, 1152, 1203, - /* 210 */ 1152, 1360, 1293, 1293, 1206, 1157, 1152, 1152, 1152, 1152, - /* 220 */ 1152, 1152, 1152, 1152, 1152, 1152, 1428, 1517, 1516, 1427, - /* 230 */ 1441, 1440, 1439, 1152, 1152, 1152, 1152, 1422, 1423, 1421, - /* 240 */ 1420, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 250 */ 1152, 1152, 1152, 1152, 1152, 1465, 1152, 1527, 1531, 1152, - /* 260 */ 1152, 1152, 1405, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 270 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 280 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 290 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 300 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 310 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 320 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 330 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 340 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 350 */ 1152, 1152, 1152, 1304, 1152, 1152, 1152, 1152, 1152, 1152, - /* 360 */ 1229, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 370 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 380 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 390 */ 1152, 1152, 1488, 1498, 1152, 1152, 1152, 1152, 1152, 1152, - /* 400 */ 1152, 1152, 1152, 1405, 1152, 1515, 1152, 1474, 1470, 1152, - /* 410 */ 1152, 1466, 1152, 1152, 1525, 1152, 1152, 1152, 1152, 1152, - /* 420 */ 1152, 1152, 1152, 1460, 1152, 1152, 1152, 1152, 1152, 1152, - /* 430 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 440 */ 1404, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1287, 1152, - /* 450 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 460 */ 1152, 1272, 1270, 1269, 1268, 1152, 1265, 1152, 1152, 1152, - /* 470 */ 1152, 1152, 1152, 1295, 1152, 1152, 1152, 1152, 1152, 1152, - /* 480 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1215, 1152, 1152, - /* 490 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 500 */ 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152, - /* 510 */ 1152, + /* 0 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 10 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 20 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 30 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 40 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 50 */ 1176, 1176, 1176, 1229, 1176, 1176, 1176, 1176, 1176, 1176, + /* 60 */ 1176, 1176, 1176, 1176, 1176, 1176, 1227, 1364, 1176, 1498, + /* 70 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 80 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 90 */ 1176, 1176, 1176, 1176, 1176, 1176, 1229, 1176, 1509, 1509, + /* 100 */ 1509, 1227, 1176, 1176, 1176, 1176, 1176, 1322, 1176, 1176, + /* 110 */ 1176, 1176, 1176, 1176, 1176, 1398, 1176, 1176, 1573, 1176, + /* 120 */ 1176, 1275, 1176, 1533, 1176, 1525, 1501, 1515, 1502, 1176, + /* 130 */ 1558, 1518, 1176, 1176, 1176, 1390, 1176, 1176, 1369, 1366, + /* 140 */ 1366, 1176, 1176, 1176, 1229, 1176, 1176, 1229, 1229, 1176, + /* 150 */ 1229, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 160 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1400, 1176, + /* 170 */ 1227, 1176, 1176, 1227, 1176, 1540, 1538, 1176, 1540, 1538, + /* 180 */ 1176, 1176, 1552, 1548, 1531, 1529, 1515, 1176, 1176, 1176, + /* 190 */ 1576, 1564, 1560, 1176, 1176, 1538, 1176, 1176, 1538, 1176, + /* 200 */ 1377, 1176, 1176, 1227, 1176, 1227, 1176, 1291, 1176, 1176, + /* 210 */ 1176, 1227, 1176, 1392, 1325, 1325, 1230, 1181, 1176, 1176, + /* 220 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1462, 1551, + /* 230 */ 1550, 1461, 1475, 1474, 1473, 1176, 1176, 1176, 1176, 1456, + /* 240 */ 1457, 1455, 1454, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 250 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1499, 1176, 1561, + /* 260 */ 1565, 1176, 1176, 1176, 1437, 1176, 1176, 1176, 1176, 1176, + /* 270 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 280 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 290 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 300 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 310 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 320 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 330 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 340 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 350 */ 1176, 1176, 1176, 1176, 1176, 1176, 1336, 1176, 1176, 1176, + /* 360 */ 1176, 1176, 1176, 1256, 1255, 1176, 1176, 1176, 1176, 1176, + /* 370 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 380 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 390 */ 1176, 1176, 1176, 1176, 1176, 1176, 1522, 1532, 1176, 1176, + /* 400 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1437, 1176, 1549, + /* 410 */ 1176, 1508, 1504, 1176, 1176, 1500, 1176, 1176, 1559, 1176, + /* 420 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1494, 1176, 1176, + /* 430 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 440 */ 1176, 1176, 1176, 1176, 1436, 1176, 1176, 1176, 1176, 1176, + /* 450 */ 1176, 1176, 1319, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 460 */ 1176, 1176, 1176, 1176, 1176, 1304, 1302, 1301, 1300, 1176, + /* 470 */ 1297, 1176, 1176, 1176, 1176, 1176, 1176, 1327, 1176, 1176, + /* 480 */ 1176, 1176, 1176, 1250, 1176, 1176, 1176, 1176, 1176, 1176, + /* 490 */ 1176, 1176, 1176, 1241, 1176, 1240, 1176, 1176, 1176, 1176, + /* 500 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, + /* 510 */ 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, }; /********** End of lemon-generated parsing tables *****************************/ @@ -825,256 +829,260 @@ static const char *const yyTokenName[] = { /* 51 */ "CACHELAST", /* 52 */ "COMP", /* 53 */ "DAYS", - /* 54 */ "FSYNC", - /* 55 */ "MAXROWS", - /* 56 */ "MINROWS", - /* 57 */ "KEEP", - /* 58 */ "PRECISION", - /* 59 */ "QUORUM", - /* 60 */ "REPLICA", - /* 61 */ "TTL", - /* 62 */ "WAL", - /* 63 */ "VGROUPS", - /* 64 */ "SINGLE_STABLE", - /* 65 */ "STREAM_MODE", - /* 66 */ "RETENTIONS", - /* 67 */ "NK_COMMA", - /* 68 */ "TABLE", - /* 69 */ "NK_LP", - /* 70 */ "NK_RP", - /* 71 */ "STABLE", - /* 72 */ "ADD", - /* 73 */ "COLUMN", - /* 74 */ "MODIFY", - /* 75 */ "RENAME", - /* 76 */ "TAG", - /* 77 */ "SET", - /* 78 */ "NK_EQ", - /* 79 */ "USING", - /* 80 */ "TAGS", - /* 81 */ "NK_DOT", - /* 82 */ "COMMENT", - /* 83 */ "BOOL", - /* 84 */ "TINYINT", - /* 85 */ "SMALLINT", - /* 86 */ "INT", - /* 87 */ "INTEGER", - /* 88 */ "BIGINT", - /* 89 */ "FLOAT", - /* 90 */ "DOUBLE", - /* 91 */ "BINARY", - /* 92 */ "TIMESTAMP", - /* 93 */ "NCHAR", - /* 94 */ "UNSIGNED", - /* 95 */ "JSON", - /* 96 */ "VARCHAR", - /* 97 */ "MEDIUMBLOB", - /* 98 */ "BLOB", - /* 99 */ "VARBINARY", - /* 100 */ "DECIMAL", - /* 101 */ "SMA", - /* 102 */ "ROLLUP", - /* 103 */ "FILE_FACTOR", - /* 104 */ "NK_FLOAT", - /* 105 */ "DELAY", - /* 106 */ "SHOW", - /* 107 */ "DATABASES", - /* 108 */ "TABLES", - /* 109 */ "STABLES", - /* 110 */ "MNODES", - /* 111 */ "MODULES", - /* 112 */ "QNODES", - /* 113 */ "FUNCTIONS", - /* 114 */ "INDEXES", - /* 115 */ "FROM", - /* 116 */ "ACCOUNTS", - /* 117 */ "APPS", - /* 118 */ "CONNECTIONS", - /* 119 */ "LICENCE", - /* 120 */ "QUERIES", - /* 121 */ "SCORES", - /* 122 */ "TOPICS", - /* 123 */ "VARIABLES", - /* 124 */ "LIKE", - /* 125 */ "INDEX", - /* 126 */ "FULLTEXT", - /* 127 */ "FUNCTION", - /* 128 */ "INTERVAL", - /* 129 */ "TOPIC", - /* 130 */ "AS", - /* 131 */ "DESC", - /* 132 */ "DESCRIBE", - /* 133 */ "RESET", - /* 134 */ "QUERY", - /* 135 */ "EXPLAIN", - /* 136 */ "ANALYZE", - /* 137 */ "VERBOSE", - /* 138 */ "NK_BOOL", - /* 139 */ "RATIO", - /* 140 */ "COMPACT", - /* 141 */ "VNODES", - /* 142 */ "IN", - /* 143 */ "OUTPUTTYPE", - /* 144 */ "AGGREGATE", - /* 145 */ "BUFSIZE", - /* 146 */ "STREAM", - /* 147 */ "INTO", - /* 148 */ "KILL", - /* 149 */ "CONNECTION", - /* 150 */ "MERGE", - /* 151 */ "VGROUP", - /* 152 */ "REDISTRIBUTE", - /* 153 */ "SPLIT", - /* 154 */ "SYNCDB", - /* 155 */ "NULL", - /* 156 */ "NK_VARIABLE", - /* 157 */ "NOW", - /* 158 */ "ROWTS", - /* 159 */ "TBNAME", - /* 160 */ "QSTARTTS", - /* 161 */ "QENDTS", - /* 162 */ "WSTARTTS", - /* 163 */ "WENDTS", - /* 164 */ "WDURATION", - /* 165 */ "BETWEEN", - /* 166 */ "IS", - /* 167 */ "NK_LT", - /* 168 */ "NK_GT", - /* 169 */ "NK_LE", - /* 170 */ "NK_GE", - /* 171 */ "NK_NE", - /* 172 */ "MATCH", - /* 173 */ "NMATCH", - /* 174 */ "JOIN", - /* 175 */ "INNER", - /* 176 */ "SELECT", - /* 177 */ "DISTINCT", - /* 178 */ "WHERE", - /* 179 */ "PARTITION", - /* 180 */ "BY", - /* 181 */ "SESSION", - /* 182 */ "STATE_WINDOW", - /* 183 */ "SLIDING", - /* 184 */ "FILL", - /* 185 */ "VALUE", - /* 186 */ "NONE", - /* 187 */ "PREV", - /* 188 */ "LINEAR", - /* 189 */ "NEXT", - /* 190 */ "GROUP", - /* 191 */ "HAVING", - /* 192 */ "ORDER", - /* 193 */ "SLIMIT", - /* 194 */ "SOFFSET", - /* 195 */ "LIMIT", - /* 196 */ "OFFSET", - /* 197 */ "ASC", - /* 198 */ "NULLS", - /* 199 */ "FIRST", - /* 200 */ "LAST", - /* 201 */ "cmd", - /* 202 */ "account_options", - /* 203 */ "alter_account_options", - /* 204 */ "literal", - /* 205 */ "alter_account_option", - /* 206 */ "user_name", - /* 207 */ "dnode_endpoint", - /* 208 */ "dnode_host_name", - /* 209 */ "not_exists_opt", - /* 210 */ "db_name", - /* 211 */ "db_options", - /* 212 */ "exists_opt", - /* 213 */ "alter_db_options", - /* 214 */ "integer_list", - /* 215 */ "alter_db_option", - /* 216 */ "full_table_name", - /* 217 */ "column_def_list", - /* 218 */ "tags_def_opt", - /* 219 */ "table_options", - /* 220 */ "multi_create_clause", - /* 221 */ "tags_def", - /* 222 */ "multi_drop_clause", - /* 223 */ "alter_table_clause", - /* 224 */ "alter_table_options", - /* 225 */ "column_name", - /* 226 */ "type_name", - /* 227 */ "create_subtable_clause", - /* 228 */ "specific_tags_opt", - /* 229 */ "literal_list", - /* 230 */ "drop_table_clause", - /* 231 */ "col_name_list", - /* 232 */ "table_name", - /* 233 */ "column_def", - /* 234 */ "func_name_list", - /* 235 */ "alter_table_option", - /* 236 */ "col_name", - /* 237 */ "db_name_cond_opt", - /* 238 */ "like_pattern_opt", - /* 239 */ "table_name_cond", - /* 240 */ "from_db_opt", - /* 241 */ "func_name", - /* 242 */ "function_name", - /* 243 */ "index_name", - /* 244 */ "index_options", - /* 245 */ "func_list", - /* 246 */ "duration_literal", - /* 247 */ "sliding_opt", - /* 248 */ "func", - /* 249 */ "expression_list", - /* 250 */ "topic_name", - /* 251 */ "query_expression", - /* 252 */ "analyze_opt", - /* 253 */ "explain_options", - /* 254 */ "agg_func_opt", - /* 255 */ "bufsize_opt", - /* 256 */ "stream_name", - /* 257 */ "dnode_list", - /* 258 */ "signed", - /* 259 */ "signed_literal", - /* 260 */ "table_alias", - /* 261 */ "column_alias", - /* 262 */ "expression", - /* 263 */ "pseudo_column", - /* 264 */ "column_reference", - /* 265 */ "subquery", - /* 266 */ "predicate", - /* 267 */ "compare_op", - /* 268 */ "in_op", - /* 269 */ "in_predicate_value", - /* 270 */ "boolean_value_expression", - /* 271 */ "boolean_primary", - /* 272 */ "common_expression", - /* 273 */ "from_clause", - /* 274 */ "table_reference_list", - /* 275 */ "table_reference", - /* 276 */ "table_primary", - /* 277 */ "joined_table", - /* 278 */ "alias_opt", - /* 279 */ "parenthesized_joined_table", - /* 280 */ "join_type", - /* 281 */ "search_condition", - /* 282 */ "query_specification", - /* 283 */ "set_quantifier_opt", - /* 284 */ "select_list", - /* 285 */ "where_clause_opt", - /* 286 */ "partition_by_clause_opt", - /* 287 */ "twindow_clause_opt", - /* 288 */ "group_by_clause_opt", - /* 289 */ "having_clause_opt", - /* 290 */ "select_sublist", - /* 291 */ "select_item", - /* 292 */ "fill_opt", - /* 293 */ "fill_mode", - /* 294 */ "group_by_list", - /* 295 */ "query_expression_body", - /* 296 */ "order_by_clause_opt", - /* 297 */ "slimit_clause_opt", - /* 298 */ "limit_clause_opt", - /* 299 */ "query_primary", - /* 300 */ "sort_specification_list", - /* 301 */ "sort_specification", - /* 302 */ "ordering_specification_opt", - /* 303 */ "null_ordering_opt", + /* 54 */ "NK_VARIABLE", + /* 55 */ "FSYNC", + /* 56 */ "MAXROWS", + /* 57 */ "MINROWS", + /* 58 */ "KEEP", + /* 59 */ "PRECISION", + /* 60 */ "QUORUM", + /* 61 */ "REPLICA", + /* 62 */ "TTL", + /* 63 */ "WAL", + /* 64 */ "VGROUPS", + /* 65 */ "SINGLE_STABLE", + /* 66 */ "STREAM_MODE", + /* 67 */ "RETENTIONS", + /* 68 */ "NK_COMMA", + /* 69 */ "NK_COLON", + /* 70 */ "TABLE", + /* 71 */ "NK_LP", + /* 72 */ "NK_RP", + /* 73 */ "STABLE", + /* 74 */ "ADD", + /* 75 */ "COLUMN", + /* 76 */ "MODIFY", + /* 77 */ "RENAME", + /* 78 */ "TAG", + /* 79 */ "SET", + /* 80 */ "NK_EQ", + /* 81 */ "USING", + /* 82 */ "TAGS", + /* 83 */ "NK_DOT", + /* 84 */ "COMMENT", + /* 85 */ "BOOL", + /* 86 */ "TINYINT", + /* 87 */ "SMALLINT", + /* 88 */ "INT", + /* 89 */ "INTEGER", + /* 90 */ "BIGINT", + /* 91 */ "FLOAT", + /* 92 */ "DOUBLE", + /* 93 */ "BINARY", + /* 94 */ "TIMESTAMP", + /* 95 */ "NCHAR", + /* 96 */ "UNSIGNED", + /* 97 */ "JSON", + /* 98 */ "VARCHAR", + /* 99 */ "MEDIUMBLOB", + /* 100 */ "BLOB", + /* 101 */ "VARBINARY", + /* 102 */ "DECIMAL", + /* 103 */ "SMA", + /* 104 */ "ROLLUP", + /* 105 */ "FILE_FACTOR", + /* 106 */ "NK_FLOAT", + /* 107 */ "DELAY", + /* 108 */ "SHOW", + /* 109 */ "DATABASES", + /* 110 */ "TABLES", + /* 111 */ "STABLES", + /* 112 */ "MNODES", + /* 113 */ "MODULES", + /* 114 */ "QNODES", + /* 115 */ "FUNCTIONS", + /* 116 */ "INDEXES", + /* 117 */ "FROM", + /* 118 */ "ACCOUNTS", + /* 119 */ "APPS", + /* 120 */ "CONNECTIONS", + /* 121 */ "LICENCE", + /* 122 */ "QUERIES", + /* 123 */ "SCORES", + /* 124 */ "TOPICS", + /* 125 */ "VARIABLES", + /* 126 */ "LIKE", + /* 127 */ "INDEX", + /* 128 */ "FULLTEXT", + /* 129 */ "FUNCTION", + /* 130 */ "INTERVAL", + /* 131 */ "TOPIC", + /* 132 */ "AS", + /* 133 */ "DESC", + /* 134 */ "DESCRIBE", + /* 135 */ "RESET", + /* 136 */ "QUERY", + /* 137 */ "EXPLAIN", + /* 138 */ "ANALYZE", + /* 139 */ "VERBOSE", + /* 140 */ "NK_BOOL", + /* 141 */ "RATIO", + /* 142 */ "COMPACT", + /* 143 */ "VNODES", + /* 144 */ "IN", + /* 145 */ "OUTPUTTYPE", + /* 146 */ "AGGREGATE", + /* 147 */ "BUFSIZE", + /* 148 */ "STREAM", + /* 149 */ "INTO", + /* 150 */ "KILL", + /* 151 */ "CONNECTION", + /* 152 */ "MERGE", + /* 153 */ "VGROUP", + /* 154 */ "REDISTRIBUTE", + /* 155 */ "SPLIT", + /* 156 */ "SYNCDB", + /* 157 */ "NULL", + /* 158 */ "FIRST", + /* 159 */ "LAST", + /* 160 */ "NOW", + /* 161 */ "ROWTS", + /* 162 */ "TBNAME", + /* 163 */ "QSTARTTS", + /* 164 */ "QENDTS", + /* 165 */ "WSTARTTS", + /* 166 */ "WENDTS", + /* 167 */ "WDURATION", + /* 168 */ "BETWEEN", + /* 169 */ "IS", + /* 170 */ "NK_LT", + /* 171 */ "NK_GT", + /* 172 */ "NK_LE", + /* 173 */ "NK_GE", + /* 174 */ "NK_NE", + /* 175 */ "MATCH", + /* 176 */ "NMATCH", + /* 177 */ "JOIN", + /* 178 */ "INNER", + /* 179 */ "SELECT", + /* 180 */ "DISTINCT", + /* 181 */ "WHERE", + /* 182 */ "PARTITION", + /* 183 */ "BY", + /* 184 */ "SESSION", + /* 185 */ "STATE_WINDOW", + /* 186 */ "SLIDING", + /* 187 */ "FILL", + /* 188 */ "VALUE", + /* 189 */ "NONE", + /* 190 */ "PREV", + /* 191 */ "LINEAR", + /* 192 */ "NEXT", + /* 193 */ "GROUP", + /* 194 */ "HAVING", + /* 195 */ "ORDER", + /* 196 */ "SLIMIT", + /* 197 */ "SOFFSET", + /* 198 */ "LIMIT", + /* 199 */ "OFFSET", + /* 200 */ "ASC", + /* 201 */ "NULLS", + /* 202 */ "cmd", + /* 203 */ "account_options", + /* 204 */ "alter_account_options", + /* 205 */ "literal", + /* 206 */ "alter_account_option", + /* 207 */ "user_name", + /* 208 */ "dnode_endpoint", + /* 209 */ "dnode_host_name", + /* 210 */ "not_exists_opt", + /* 211 */ "db_name", + /* 212 */ "db_options", + /* 213 */ "exists_opt", + /* 214 */ "alter_db_options", + /* 215 */ "integer_list", + /* 216 */ "variable_list", + /* 217 */ "retention_list", + /* 218 */ "alter_db_option", + /* 219 */ "retention", + /* 220 */ "full_table_name", + /* 221 */ "column_def_list", + /* 222 */ "tags_def_opt", + /* 223 */ "table_options", + /* 224 */ "multi_create_clause", + /* 225 */ "tags_def", + /* 226 */ "multi_drop_clause", + /* 227 */ "alter_table_clause", + /* 228 */ "alter_table_options", + /* 229 */ "column_name", + /* 230 */ "type_name", + /* 231 */ "create_subtable_clause", + /* 232 */ "specific_tags_opt", + /* 233 */ "literal_list", + /* 234 */ "drop_table_clause", + /* 235 */ "col_name_list", + /* 236 */ "table_name", + /* 237 */ "column_def", + /* 238 */ "func_name_list", + /* 239 */ "alter_table_option", + /* 240 */ "col_name", + /* 241 */ "db_name_cond_opt", + /* 242 */ "like_pattern_opt", + /* 243 */ "table_name_cond", + /* 244 */ "from_db_opt", + /* 245 */ "func_name", + /* 246 */ "function_name", + /* 247 */ "index_name", + /* 248 */ "index_options", + /* 249 */ "func_list", + /* 250 */ "duration_literal", + /* 251 */ "sliding_opt", + /* 252 */ "func", + /* 253 */ "expression_list", + /* 254 */ "topic_name", + /* 255 */ "query_expression", + /* 256 */ "analyze_opt", + /* 257 */ "explain_options", + /* 258 */ "agg_func_opt", + /* 259 */ "bufsize_opt", + /* 260 */ "stream_name", + /* 261 */ "dnode_list", + /* 262 */ "signed", + /* 263 */ "signed_literal", + /* 264 */ "table_alias", + /* 265 */ "column_alias", + /* 266 */ "expression", + /* 267 */ "pseudo_column", + /* 268 */ "column_reference", + /* 269 */ "subquery", + /* 270 */ "predicate", + /* 271 */ "compare_op", + /* 272 */ "in_op", + /* 273 */ "in_predicate_value", + /* 274 */ "boolean_value_expression", + /* 275 */ "boolean_primary", + /* 276 */ "common_expression", + /* 277 */ "from_clause", + /* 278 */ "table_reference_list", + /* 279 */ "table_reference", + /* 280 */ "table_primary", + /* 281 */ "joined_table", + /* 282 */ "alias_opt", + /* 283 */ "parenthesized_joined_table", + /* 284 */ "join_type", + /* 285 */ "search_condition", + /* 286 */ "query_specification", + /* 287 */ "set_quantifier_opt", + /* 288 */ "select_list", + /* 289 */ "where_clause_opt", + /* 290 */ "partition_by_clause_opt", + /* 291 */ "twindow_clause_opt", + /* 292 */ "group_by_clause_opt", + /* 293 */ "having_clause_opt", + /* 294 */ "select_sublist", + /* 295 */ "select_item", + /* 296 */ "fill_opt", + /* 297 */ "fill_mode", + /* 298 */ "group_by_list", + /* 299 */ "query_expression_body", + /* 300 */ "order_by_clause_opt", + /* 301 */ "slimit_clause_opt", + /* 302 */ "limit_clause_opt", + /* 303 */ "query_primary", + /* 304 */ "sort_specification_list", + /* 305 */ "sort_specification", + /* 306 */ "ordering_specification_opt", + /* 307 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1139,339 +1147,349 @@ static const char *const yyRuleName[] = { /* 54 */ "db_options ::= db_options CACHELAST NK_INTEGER", /* 55 */ "db_options ::= db_options COMP NK_INTEGER", /* 56 */ "db_options ::= db_options DAYS NK_INTEGER", - /* 57 */ "db_options ::= db_options FSYNC NK_INTEGER", - /* 58 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 59 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 60 */ "db_options ::= db_options KEEP integer_list", - /* 61 */ "db_options ::= db_options PRECISION NK_STRING", - /* 62 */ "db_options ::= db_options QUORUM NK_INTEGER", - /* 63 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 64 */ "db_options ::= db_options TTL NK_INTEGER", - /* 65 */ "db_options ::= db_options WAL NK_INTEGER", - /* 66 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 67 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 68 */ "db_options ::= db_options STREAM_MODE NK_INTEGER", - /* 69 */ "db_options ::= db_options RETENTIONS NK_STRING", - /* 70 */ "alter_db_options ::= alter_db_option", - /* 71 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 72 */ "alter_db_option ::= BLOCKS NK_INTEGER", - /* 73 */ "alter_db_option ::= FSYNC NK_INTEGER", - /* 74 */ "alter_db_option ::= KEEP integer_list", - /* 75 */ "alter_db_option ::= WAL NK_INTEGER", - /* 76 */ "alter_db_option ::= QUORUM NK_INTEGER", - /* 77 */ "alter_db_option ::= CACHELAST NK_INTEGER", - /* 78 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 79 */ "integer_list ::= NK_INTEGER", - /* 80 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 81 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 82 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 83 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 84 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 85 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 86 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 87 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 88 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 89 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 90 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 91 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 92 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 93 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 94 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 95 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 96 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 97 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", - /* 98 */ "multi_create_clause ::= create_subtable_clause", - /* 99 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 100 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", - /* 101 */ "multi_drop_clause ::= drop_table_clause", - /* 102 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", - /* 103 */ "drop_table_clause ::= exists_opt full_table_name", - /* 104 */ "specific_tags_opt ::=", - /* 105 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", - /* 106 */ "full_table_name ::= table_name", - /* 107 */ "full_table_name ::= db_name NK_DOT table_name", - /* 108 */ "column_def_list ::= column_def", - /* 109 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 110 */ "column_def ::= column_name type_name", - /* 111 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 112 */ "type_name ::= BOOL", - /* 113 */ "type_name ::= TINYINT", - /* 114 */ "type_name ::= SMALLINT", - /* 115 */ "type_name ::= INT", - /* 116 */ "type_name ::= INTEGER", - /* 117 */ "type_name ::= BIGINT", - /* 118 */ "type_name ::= FLOAT", - /* 119 */ "type_name ::= DOUBLE", - /* 120 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 121 */ "type_name ::= TIMESTAMP", - /* 122 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 123 */ "type_name ::= TINYINT UNSIGNED", - /* 124 */ "type_name ::= SMALLINT UNSIGNED", - /* 125 */ "type_name ::= INT UNSIGNED", - /* 126 */ "type_name ::= BIGINT UNSIGNED", - /* 127 */ "type_name ::= JSON", - /* 128 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 129 */ "type_name ::= MEDIUMBLOB", - /* 130 */ "type_name ::= BLOB", - /* 131 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 132 */ "type_name ::= DECIMAL", - /* 133 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 134 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 135 */ "tags_def_opt ::=", - /* 136 */ "tags_def_opt ::= tags_def", - /* 137 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 138 */ "table_options ::=", - /* 139 */ "table_options ::= table_options COMMENT NK_STRING", - /* 140 */ "table_options ::= table_options KEEP integer_list", - /* 141 */ "table_options ::= table_options TTL NK_INTEGER", - /* 142 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 143 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", - /* 144 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", - /* 145 */ "table_options ::= table_options DELAY NK_INTEGER", - /* 146 */ "alter_table_options ::= alter_table_option", - /* 147 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 148 */ "alter_table_option ::= COMMENT NK_STRING", - /* 149 */ "alter_table_option ::= KEEP integer_list", - /* 150 */ "alter_table_option ::= TTL NK_INTEGER", - /* 151 */ "col_name_list ::= col_name", - /* 152 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 153 */ "col_name ::= column_name", - /* 154 */ "cmd ::= SHOW DNODES", - /* 155 */ "cmd ::= SHOW USERS", - /* 156 */ "cmd ::= SHOW DATABASES", - /* 157 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 158 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 159 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 160 */ "cmd ::= SHOW MNODES", - /* 161 */ "cmd ::= SHOW MODULES", - /* 162 */ "cmd ::= SHOW QNODES", - /* 163 */ "cmd ::= SHOW FUNCTIONS", - /* 164 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 165 */ "cmd ::= SHOW STREAMS", - /* 166 */ "cmd ::= SHOW ACCOUNTS", - /* 167 */ "cmd ::= SHOW APPS", - /* 168 */ "cmd ::= SHOW CONNECTIONS", - /* 169 */ "cmd ::= SHOW LICENCE", - /* 170 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 171 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 172 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 173 */ "cmd ::= SHOW QUERIES", - /* 174 */ "cmd ::= SHOW SCORES", - /* 175 */ "cmd ::= SHOW TOPICS", - /* 176 */ "cmd ::= SHOW VARIABLES", - /* 177 */ "db_name_cond_opt ::=", - /* 178 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 179 */ "like_pattern_opt ::=", - /* 180 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 181 */ "table_name_cond ::= table_name", - /* 182 */ "from_db_opt ::=", - /* 183 */ "from_db_opt ::= FROM db_name", - /* 184 */ "func_name_list ::= func_name", - /* 185 */ "func_name_list ::= func_name_list NK_COMMA col_name", - /* 186 */ "func_name ::= function_name", - /* 187 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", - /* 188 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", - /* 189 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", - /* 190 */ "index_options ::=", - /* 191 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", - /* 192 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", - /* 193 */ "func_list ::= func", - /* 194 */ "func_list ::= func_list NK_COMMA func", - /* 195 */ "func ::= function_name NK_LP expression_list NK_RP", - /* 196 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", - /* 197 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", - /* 198 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 199 */ "cmd ::= DESC full_table_name", - /* 200 */ "cmd ::= DESCRIBE full_table_name", - /* 201 */ "cmd ::= RESET QUERY CACHE", - /* 202 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", - /* 203 */ "analyze_opt ::=", - /* 204 */ "analyze_opt ::= ANALYZE", - /* 205 */ "explain_options ::=", - /* 206 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 207 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 208 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 209 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 210 */ "cmd ::= DROP FUNCTION function_name", - /* 211 */ "agg_func_opt ::=", - /* 212 */ "agg_func_opt ::= AGGREGATE", - /* 213 */ "bufsize_opt ::=", - /* 214 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 215 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", - /* 216 */ "cmd ::= DROP STREAM stream_name", - /* 217 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 218 */ "cmd ::= KILL QUERY NK_INTEGER", - /* 219 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 220 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 221 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 222 */ "dnode_list ::= DNODE NK_INTEGER", - /* 223 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 224 */ "cmd ::= SYNCDB db_name REPLICA", - /* 225 */ "cmd ::= query_expression", - /* 226 */ "literal ::= NK_INTEGER", - /* 227 */ "literal ::= NK_FLOAT", - /* 228 */ "literal ::= NK_STRING", - /* 229 */ "literal ::= NK_BOOL", - /* 230 */ "literal ::= TIMESTAMP NK_STRING", - /* 231 */ "literal ::= duration_literal", - /* 232 */ "literal ::= NULL", - /* 233 */ "duration_literal ::= NK_VARIABLE", - /* 234 */ "signed ::= NK_INTEGER", - /* 235 */ "signed ::= NK_PLUS NK_INTEGER", - /* 236 */ "signed ::= NK_MINUS NK_INTEGER", - /* 237 */ "signed ::= NK_FLOAT", - /* 238 */ "signed ::= NK_PLUS NK_FLOAT", - /* 239 */ "signed ::= NK_MINUS NK_FLOAT", - /* 240 */ "signed_literal ::= signed", - /* 241 */ "signed_literal ::= NK_STRING", - /* 242 */ "signed_literal ::= NK_BOOL", - /* 243 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 244 */ "signed_literal ::= duration_literal", - /* 245 */ "signed_literal ::= NULL", - /* 246 */ "literal_list ::= signed_literal", - /* 247 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 248 */ "db_name ::= NK_ID", - /* 249 */ "table_name ::= NK_ID", - /* 250 */ "column_name ::= NK_ID", - /* 251 */ "function_name ::= NK_ID", - /* 252 */ "table_alias ::= NK_ID", - /* 253 */ "column_alias ::= NK_ID", - /* 254 */ "user_name ::= NK_ID", - /* 255 */ "index_name ::= NK_ID", - /* 256 */ "topic_name ::= NK_ID", - /* 257 */ "stream_name ::= NK_ID", - /* 258 */ "expression ::= literal", - /* 259 */ "expression ::= pseudo_column", - /* 260 */ "expression ::= column_reference", - /* 261 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 262 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 263 */ "expression ::= subquery", - /* 264 */ "expression ::= NK_LP expression NK_RP", - /* 265 */ "expression ::= NK_PLUS expression", - /* 266 */ "expression ::= NK_MINUS expression", - /* 267 */ "expression ::= expression NK_PLUS expression", - /* 268 */ "expression ::= expression NK_MINUS expression", - /* 269 */ "expression ::= expression NK_STAR expression", - /* 270 */ "expression ::= expression NK_SLASH expression", - /* 271 */ "expression ::= expression NK_REM expression", - /* 272 */ "expression_list ::= expression", - /* 273 */ "expression_list ::= expression_list NK_COMMA expression", - /* 274 */ "column_reference ::= column_name", - /* 275 */ "column_reference ::= table_name NK_DOT column_name", - /* 276 */ "pseudo_column ::= NOW", - /* 277 */ "pseudo_column ::= ROWTS", - /* 278 */ "pseudo_column ::= TBNAME", - /* 279 */ "pseudo_column ::= QSTARTTS", - /* 280 */ "pseudo_column ::= QENDTS", - /* 281 */ "pseudo_column ::= WSTARTTS", - /* 282 */ "pseudo_column ::= WENDTS", - /* 283 */ "pseudo_column ::= WDURATION", - /* 284 */ "predicate ::= expression compare_op expression", - /* 285 */ "predicate ::= expression BETWEEN expression AND expression", - /* 286 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 287 */ "predicate ::= expression IS NULL", - /* 288 */ "predicate ::= expression IS NOT NULL", - /* 289 */ "predicate ::= expression in_op in_predicate_value", - /* 290 */ "compare_op ::= NK_LT", - /* 291 */ "compare_op ::= NK_GT", - /* 292 */ "compare_op ::= NK_LE", - /* 293 */ "compare_op ::= NK_GE", - /* 294 */ "compare_op ::= NK_NE", - /* 295 */ "compare_op ::= NK_EQ", - /* 296 */ "compare_op ::= LIKE", - /* 297 */ "compare_op ::= NOT LIKE", - /* 298 */ "compare_op ::= MATCH", - /* 299 */ "compare_op ::= NMATCH", - /* 300 */ "in_op ::= IN", - /* 301 */ "in_op ::= NOT IN", - /* 302 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 303 */ "boolean_value_expression ::= boolean_primary", - /* 304 */ "boolean_value_expression ::= NOT boolean_primary", - /* 305 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 306 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 307 */ "boolean_primary ::= predicate", - /* 308 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 309 */ "common_expression ::= expression", - /* 310 */ "common_expression ::= boolean_value_expression", - /* 311 */ "from_clause ::= FROM table_reference_list", - /* 312 */ "table_reference_list ::= table_reference", - /* 313 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 314 */ "table_reference ::= table_primary", - /* 315 */ "table_reference ::= joined_table", - /* 316 */ "table_primary ::= table_name alias_opt", - /* 317 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 318 */ "table_primary ::= subquery alias_opt", - /* 319 */ "table_primary ::= parenthesized_joined_table", - /* 320 */ "alias_opt ::=", - /* 321 */ "alias_opt ::= table_alias", - /* 322 */ "alias_opt ::= AS table_alias", - /* 323 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 324 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 325 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 326 */ "join_type ::=", - /* 327 */ "join_type ::= INNER", - /* 328 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 329 */ "set_quantifier_opt ::=", - /* 330 */ "set_quantifier_opt ::= DISTINCT", - /* 331 */ "set_quantifier_opt ::= ALL", - /* 332 */ "select_list ::= NK_STAR", - /* 333 */ "select_list ::= select_sublist", - /* 334 */ "select_sublist ::= select_item", - /* 335 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 336 */ "select_item ::= common_expression", - /* 337 */ "select_item ::= common_expression column_alias", - /* 338 */ "select_item ::= common_expression AS column_alias", - /* 339 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 340 */ "where_clause_opt ::=", - /* 341 */ "where_clause_opt ::= WHERE search_condition", - /* 342 */ "partition_by_clause_opt ::=", - /* 343 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 344 */ "twindow_clause_opt ::=", - /* 345 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 346 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 347 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 348 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 349 */ "sliding_opt ::=", - /* 350 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 351 */ "fill_opt ::=", - /* 352 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 353 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 354 */ "fill_mode ::= NONE", - /* 355 */ "fill_mode ::= PREV", - /* 356 */ "fill_mode ::= NULL", - /* 357 */ "fill_mode ::= LINEAR", - /* 358 */ "fill_mode ::= NEXT", - /* 359 */ "group_by_clause_opt ::=", - /* 360 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 361 */ "group_by_list ::= expression", - /* 362 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 363 */ "having_clause_opt ::=", - /* 364 */ "having_clause_opt ::= HAVING search_condition", - /* 365 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 366 */ "query_expression_body ::= query_primary", - /* 367 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 368 */ "query_primary ::= query_specification", - /* 369 */ "order_by_clause_opt ::=", - /* 370 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 371 */ "slimit_clause_opt ::=", - /* 372 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 373 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 374 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 375 */ "limit_clause_opt ::=", - /* 376 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 377 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 378 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 379 */ "subquery ::= NK_LP query_expression NK_RP", - /* 380 */ "search_condition ::= common_expression", - /* 381 */ "sort_specification_list ::= sort_specification", - /* 382 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 383 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 384 */ "ordering_specification_opt ::=", - /* 385 */ "ordering_specification_opt ::= ASC", - /* 386 */ "ordering_specification_opt ::= DESC", - /* 387 */ "null_ordering_opt ::=", - /* 388 */ "null_ordering_opt ::= NULLS FIRST", - /* 389 */ "null_ordering_opt ::= NULLS LAST", + /* 57 */ "db_options ::= db_options DAYS NK_VARIABLE", + /* 58 */ "db_options ::= db_options FSYNC NK_INTEGER", + /* 59 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 60 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 61 */ "db_options ::= db_options KEEP integer_list", + /* 62 */ "db_options ::= db_options KEEP variable_list", + /* 63 */ "db_options ::= db_options PRECISION NK_STRING", + /* 64 */ "db_options ::= db_options QUORUM NK_INTEGER", + /* 65 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 66 */ "db_options ::= db_options TTL NK_INTEGER", + /* 67 */ "db_options ::= db_options WAL NK_INTEGER", + /* 68 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 69 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 70 */ "db_options ::= db_options STREAM_MODE NK_INTEGER", + /* 71 */ "db_options ::= db_options RETENTIONS retention_list", + /* 72 */ "alter_db_options ::= alter_db_option", + /* 73 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 74 */ "alter_db_option ::= BLOCKS NK_INTEGER", + /* 75 */ "alter_db_option ::= FSYNC NK_INTEGER", + /* 76 */ "alter_db_option ::= KEEP integer_list", + /* 77 */ "alter_db_option ::= KEEP variable_list", + /* 78 */ "alter_db_option ::= WAL NK_INTEGER", + /* 79 */ "alter_db_option ::= QUORUM NK_INTEGER", + /* 80 */ "alter_db_option ::= CACHELAST NK_INTEGER", + /* 81 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 82 */ "integer_list ::= NK_INTEGER", + /* 83 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 84 */ "variable_list ::= NK_VARIABLE", + /* 85 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 86 */ "retention_list ::= retention", + /* 87 */ "retention_list ::= retention_list NK_COMMA retention", + /* 88 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 89 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 90 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 91 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 92 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 93 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 94 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 95 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 96 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 97 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 98 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 99 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 100 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 101 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 102 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 103 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 104 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 105 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal", + /* 106 */ "multi_create_clause ::= create_subtable_clause", + /* 107 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 108 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", + /* 109 */ "multi_drop_clause ::= drop_table_clause", + /* 110 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 111 */ "drop_table_clause ::= exists_opt full_table_name", + /* 112 */ "specific_tags_opt ::=", + /* 113 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", + /* 114 */ "full_table_name ::= table_name", + /* 115 */ "full_table_name ::= db_name NK_DOT table_name", + /* 116 */ "column_def_list ::= column_def", + /* 117 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 118 */ "column_def ::= column_name type_name", + /* 119 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 120 */ "type_name ::= BOOL", + /* 121 */ "type_name ::= TINYINT", + /* 122 */ "type_name ::= SMALLINT", + /* 123 */ "type_name ::= INT", + /* 124 */ "type_name ::= INTEGER", + /* 125 */ "type_name ::= BIGINT", + /* 126 */ "type_name ::= FLOAT", + /* 127 */ "type_name ::= DOUBLE", + /* 128 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 129 */ "type_name ::= TIMESTAMP", + /* 130 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 131 */ "type_name ::= TINYINT UNSIGNED", + /* 132 */ "type_name ::= SMALLINT UNSIGNED", + /* 133 */ "type_name ::= INT UNSIGNED", + /* 134 */ "type_name ::= BIGINT UNSIGNED", + /* 135 */ "type_name ::= JSON", + /* 136 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 137 */ "type_name ::= MEDIUMBLOB", + /* 138 */ "type_name ::= BLOB", + /* 139 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 140 */ "type_name ::= DECIMAL", + /* 141 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 142 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 143 */ "tags_def_opt ::=", + /* 144 */ "tags_def_opt ::= tags_def", + /* 145 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 146 */ "table_options ::=", + /* 147 */ "table_options ::= table_options COMMENT NK_STRING", + /* 148 */ "table_options ::= table_options KEEP integer_list", + /* 149 */ "table_options ::= table_options TTL NK_INTEGER", + /* 150 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 151 */ "table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP", + /* 152 */ "table_options ::= table_options FILE_FACTOR NK_FLOAT", + /* 153 */ "table_options ::= table_options DELAY NK_INTEGER", + /* 154 */ "alter_table_options ::= alter_table_option", + /* 155 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 156 */ "alter_table_option ::= COMMENT NK_STRING", + /* 157 */ "alter_table_option ::= KEEP integer_list", + /* 158 */ "alter_table_option ::= TTL NK_INTEGER", + /* 159 */ "col_name_list ::= col_name", + /* 160 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 161 */ "col_name ::= column_name", + /* 162 */ "cmd ::= SHOW DNODES", + /* 163 */ "cmd ::= SHOW USERS", + /* 164 */ "cmd ::= SHOW DATABASES", + /* 165 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 166 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 167 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 168 */ "cmd ::= SHOW MNODES", + /* 169 */ "cmd ::= SHOW MODULES", + /* 170 */ "cmd ::= SHOW QNODES", + /* 171 */ "cmd ::= SHOW FUNCTIONS", + /* 172 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 173 */ "cmd ::= SHOW STREAMS", + /* 174 */ "cmd ::= SHOW ACCOUNTS", + /* 175 */ "cmd ::= SHOW APPS", + /* 176 */ "cmd ::= SHOW CONNECTIONS", + /* 177 */ "cmd ::= SHOW LICENCE", + /* 178 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 179 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 180 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 181 */ "cmd ::= SHOW QUERIES", + /* 182 */ "cmd ::= SHOW SCORES", + /* 183 */ "cmd ::= SHOW TOPICS", + /* 184 */ "cmd ::= SHOW VARIABLES", + /* 185 */ "db_name_cond_opt ::=", + /* 186 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 187 */ "like_pattern_opt ::=", + /* 188 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 189 */ "table_name_cond ::= table_name", + /* 190 */ "from_db_opt ::=", + /* 191 */ "from_db_opt ::= FROM db_name", + /* 192 */ "func_name_list ::= func_name", + /* 193 */ "func_name_list ::= func_name_list NK_COMMA col_name", + /* 194 */ "func_name ::= function_name", + /* 195 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", + /* 196 */ "cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP", + /* 197 */ "cmd ::= DROP INDEX exists_opt index_name ON table_name", + /* 198 */ "index_options ::=", + /* 199 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt", + /* 200 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt", + /* 201 */ "func_list ::= func", + /* 202 */ "func_list ::= func_list NK_COMMA func", + /* 203 */ "func ::= function_name NK_LP expression_list NK_RP", + /* 204 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression", + /* 205 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name", + /* 206 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 207 */ "cmd ::= DESC full_table_name", + /* 208 */ "cmd ::= DESCRIBE full_table_name", + /* 209 */ "cmd ::= RESET QUERY CACHE", + /* 210 */ "cmd ::= EXPLAIN analyze_opt explain_options query_expression", + /* 211 */ "analyze_opt ::=", + /* 212 */ "analyze_opt ::= ANALYZE", + /* 213 */ "explain_options ::=", + /* 214 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 215 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 216 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", + /* 217 */ "cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 218 */ "cmd ::= DROP FUNCTION function_name", + /* 219 */ "agg_func_opt ::=", + /* 220 */ "agg_func_opt ::= AGGREGATE", + /* 221 */ "bufsize_opt ::=", + /* 222 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 223 */ "cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression", + /* 224 */ "cmd ::= DROP STREAM stream_name", + /* 225 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 226 */ "cmd ::= KILL QUERY NK_INTEGER", + /* 227 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 228 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 229 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 230 */ "dnode_list ::= DNODE NK_INTEGER", + /* 231 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 232 */ "cmd ::= SYNCDB db_name REPLICA", + /* 233 */ "cmd ::= query_expression", + /* 234 */ "literal ::= NK_INTEGER", + /* 235 */ "literal ::= NK_FLOAT", + /* 236 */ "literal ::= NK_STRING", + /* 237 */ "literal ::= NK_BOOL", + /* 238 */ "literal ::= TIMESTAMP NK_STRING", + /* 239 */ "literal ::= duration_literal", + /* 240 */ "literal ::= NULL", + /* 241 */ "duration_literal ::= NK_VARIABLE", + /* 242 */ "signed ::= NK_INTEGER", + /* 243 */ "signed ::= NK_PLUS NK_INTEGER", + /* 244 */ "signed ::= NK_MINUS NK_INTEGER", + /* 245 */ "signed ::= NK_FLOAT", + /* 246 */ "signed ::= NK_PLUS NK_FLOAT", + /* 247 */ "signed ::= NK_MINUS NK_FLOAT", + /* 248 */ "signed_literal ::= signed", + /* 249 */ "signed_literal ::= NK_STRING", + /* 250 */ "signed_literal ::= NK_BOOL", + /* 251 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 252 */ "signed_literal ::= duration_literal", + /* 253 */ "signed_literal ::= NULL", + /* 254 */ "literal_list ::= signed_literal", + /* 255 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 256 */ "db_name ::= NK_ID", + /* 257 */ "table_name ::= NK_ID", + /* 258 */ "column_name ::= NK_ID", + /* 259 */ "function_name ::= NK_ID", + /* 260 */ "function_name ::= FIRST", + /* 261 */ "function_name ::= LAST", + /* 262 */ "table_alias ::= NK_ID", + /* 263 */ "column_alias ::= NK_ID", + /* 264 */ "user_name ::= NK_ID", + /* 265 */ "index_name ::= NK_ID", + /* 266 */ "topic_name ::= NK_ID", + /* 267 */ "stream_name ::= NK_ID", + /* 268 */ "expression ::= literal", + /* 269 */ "expression ::= pseudo_column", + /* 270 */ "expression ::= column_reference", + /* 271 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 272 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 273 */ "expression ::= subquery", + /* 274 */ "expression ::= NK_LP expression NK_RP", + /* 275 */ "expression ::= NK_PLUS expression", + /* 276 */ "expression ::= NK_MINUS expression", + /* 277 */ "expression ::= expression NK_PLUS expression", + /* 278 */ "expression ::= expression NK_MINUS expression", + /* 279 */ "expression ::= expression NK_STAR expression", + /* 280 */ "expression ::= expression NK_SLASH expression", + /* 281 */ "expression ::= expression NK_REM expression", + /* 282 */ "expression_list ::= expression", + /* 283 */ "expression_list ::= expression_list NK_COMMA expression", + /* 284 */ "column_reference ::= column_name", + /* 285 */ "column_reference ::= table_name NK_DOT column_name", + /* 286 */ "pseudo_column ::= NOW", + /* 287 */ "pseudo_column ::= ROWTS", + /* 288 */ "pseudo_column ::= TBNAME", + /* 289 */ "pseudo_column ::= QSTARTTS", + /* 290 */ "pseudo_column ::= QENDTS", + /* 291 */ "pseudo_column ::= WSTARTTS", + /* 292 */ "pseudo_column ::= WENDTS", + /* 293 */ "pseudo_column ::= WDURATION", + /* 294 */ "predicate ::= expression compare_op expression", + /* 295 */ "predicate ::= expression BETWEEN expression AND expression", + /* 296 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 297 */ "predicate ::= expression IS NULL", + /* 298 */ "predicate ::= expression IS NOT NULL", + /* 299 */ "predicate ::= expression in_op in_predicate_value", + /* 300 */ "compare_op ::= NK_LT", + /* 301 */ "compare_op ::= NK_GT", + /* 302 */ "compare_op ::= NK_LE", + /* 303 */ "compare_op ::= NK_GE", + /* 304 */ "compare_op ::= NK_NE", + /* 305 */ "compare_op ::= NK_EQ", + /* 306 */ "compare_op ::= LIKE", + /* 307 */ "compare_op ::= NOT LIKE", + /* 308 */ "compare_op ::= MATCH", + /* 309 */ "compare_op ::= NMATCH", + /* 310 */ "in_op ::= IN", + /* 311 */ "in_op ::= NOT IN", + /* 312 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 313 */ "boolean_value_expression ::= boolean_primary", + /* 314 */ "boolean_value_expression ::= NOT boolean_primary", + /* 315 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 316 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 317 */ "boolean_primary ::= predicate", + /* 318 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 319 */ "common_expression ::= expression", + /* 320 */ "common_expression ::= boolean_value_expression", + /* 321 */ "from_clause ::= FROM table_reference_list", + /* 322 */ "table_reference_list ::= table_reference", + /* 323 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 324 */ "table_reference ::= table_primary", + /* 325 */ "table_reference ::= joined_table", + /* 326 */ "table_primary ::= table_name alias_opt", + /* 327 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 328 */ "table_primary ::= subquery alias_opt", + /* 329 */ "table_primary ::= parenthesized_joined_table", + /* 330 */ "alias_opt ::=", + /* 331 */ "alias_opt ::= table_alias", + /* 332 */ "alias_opt ::= AS table_alias", + /* 333 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 334 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 335 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 336 */ "join_type ::=", + /* 337 */ "join_type ::= INNER", + /* 338 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 339 */ "set_quantifier_opt ::=", + /* 340 */ "set_quantifier_opt ::= DISTINCT", + /* 341 */ "set_quantifier_opt ::= ALL", + /* 342 */ "select_list ::= NK_STAR", + /* 343 */ "select_list ::= select_sublist", + /* 344 */ "select_sublist ::= select_item", + /* 345 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 346 */ "select_item ::= common_expression", + /* 347 */ "select_item ::= common_expression column_alias", + /* 348 */ "select_item ::= common_expression AS column_alias", + /* 349 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 350 */ "where_clause_opt ::=", + /* 351 */ "where_clause_opt ::= WHERE search_condition", + /* 352 */ "partition_by_clause_opt ::=", + /* 353 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 354 */ "twindow_clause_opt ::=", + /* 355 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 356 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 357 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 358 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 359 */ "sliding_opt ::=", + /* 360 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 361 */ "fill_opt ::=", + /* 362 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 363 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 364 */ "fill_mode ::= NONE", + /* 365 */ "fill_mode ::= PREV", + /* 366 */ "fill_mode ::= NULL", + /* 367 */ "fill_mode ::= LINEAR", + /* 368 */ "fill_mode ::= NEXT", + /* 369 */ "group_by_clause_opt ::=", + /* 370 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 371 */ "group_by_list ::= expression", + /* 372 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 373 */ "having_clause_opt ::=", + /* 374 */ "having_clause_opt ::= HAVING search_condition", + /* 375 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 376 */ "query_expression_body ::= query_primary", + /* 377 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 378 */ "query_primary ::= query_specification", + /* 379 */ "order_by_clause_opt ::=", + /* 380 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 381 */ "slimit_clause_opt ::=", + /* 382 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 383 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 384 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 385 */ "limit_clause_opt ::=", + /* 386 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 387 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 388 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 389 */ "subquery ::= NK_LP query_expression NK_RP", + /* 390 */ "search_condition ::= common_expression", + /* 391 */ "sort_specification_list ::= sort_specification", + /* 392 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 393 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 394 */ "ordering_specification_opt ::=", + /* 395 */ "ordering_specification_opt ::= ASC", + /* 396 */ "ordering_specification_opt ::= DESC", + /* 397 */ "null_ordering_opt ::=", + /* 398 */ "null_ordering_opt ::= NULLS FIRST", + /* 399 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1598,153 +1616,156 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 201: /* cmd */ - case 204: /* literal */ - case 211: /* db_options */ - case 213: /* alter_db_options */ - case 216: /* full_table_name */ - case 219: /* table_options */ - case 223: /* alter_table_clause */ - case 224: /* alter_table_options */ - case 227: /* create_subtable_clause */ - case 230: /* drop_table_clause */ - case 233: /* column_def */ - case 236: /* col_name */ - case 237: /* db_name_cond_opt */ - case 238: /* like_pattern_opt */ - case 239: /* table_name_cond */ - case 240: /* from_db_opt */ - case 241: /* func_name */ - case 244: /* index_options */ - case 246: /* duration_literal */ - case 247: /* sliding_opt */ - case 248: /* func */ - case 251: /* query_expression */ - case 253: /* explain_options */ - case 258: /* signed */ - case 259: /* signed_literal */ - case 262: /* expression */ - case 263: /* pseudo_column */ - case 264: /* column_reference */ - case 265: /* subquery */ - case 266: /* predicate */ - case 269: /* in_predicate_value */ - case 270: /* boolean_value_expression */ - case 271: /* boolean_primary */ - case 272: /* common_expression */ - case 273: /* from_clause */ - case 274: /* table_reference_list */ - case 275: /* table_reference */ - case 276: /* table_primary */ - case 277: /* joined_table */ - case 279: /* parenthesized_joined_table */ - case 281: /* search_condition */ - case 282: /* query_specification */ - case 285: /* where_clause_opt */ - case 287: /* twindow_clause_opt */ - case 289: /* having_clause_opt */ - case 291: /* select_item */ - case 292: /* fill_opt */ - case 295: /* query_expression_body */ - case 297: /* slimit_clause_opt */ - case 298: /* limit_clause_opt */ - case 299: /* query_primary */ - case 301: /* sort_specification */ + case 202: /* cmd */ + case 205: /* literal */ + case 212: /* db_options */ + case 214: /* alter_db_options */ + case 219: /* retention */ + case 220: /* full_table_name */ + case 223: /* table_options */ + case 227: /* alter_table_clause */ + case 228: /* alter_table_options */ + case 231: /* create_subtable_clause */ + case 234: /* drop_table_clause */ + case 237: /* column_def */ + case 240: /* col_name */ + case 241: /* db_name_cond_opt */ + case 242: /* like_pattern_opt */ + case 243: /* table_name_cond */ + case 244: /* from_db_opt */ + case 245: /* func_name */ + case 248: /* index_options */ + case 250: /* duration_literal */ + case 251: /* sliding_opt */ + case 252: /* func */ + case 255: /* query_expression */ + case 257: /* explain_options */ + case 262: /* signed */ + case 263: /* signed_literal */ + case 266: /* expression */ + case 267: /* pseudo_column */ + case 268: /* column_reference */ + case 269: /* subquery */ + case 270: /* predicate */ + case 273: /* in_predicate_value */ + case 274: /* boolean_value_expression */ + case 275: /* boolean_primary */ + case 276: /* common_expression */ + case 277: /* from_clause */ + case 278: /* table_reference_list */ + case 279: /* table_reference */ + case 280: /* table_primary */ + case 281: /* joined_table */ + case 283: /* parenthesized_joined_table */ + case 285: /* search_condition */ + case 286: /* query_specification */ + case 289: /* where_clause_opt */ + case 291: /* twindow_clause_opt */ + case 293: /* having_clause_opt */ + case 295: /* select_item */ + case 296: /* fill_opt */ + case 299: /* query_expression_body */ + case 301: /* slimit_clause_opt */ + case 302: /* limit_clause_opt */ + case 303: /* query_primary */ + case 305: /* sort_specification */ { - nodesDestroyNode((yypminor->yy104)); + nodesDestroyNode((yypminor->yy168)); } break; - case 202: /* account_options */ - case 203: /* alter_account_options */ - case 205: /* alter_account_option */ - case 255: /* bufsize_opt */ + case 203: /* account_options */ + case 204: /* alter_account_options */ + case 206: /* alter_account_option */ + case 259: /* bufsize_opt */ { } break; - case 206: /* user_name */ - case 207: /* dnode_endpoint */ - case 208: /* dnode_host_name */ - case 210: /* db_name */ - case 225: /* column_name */ - case 232: /* table_name */ - case 242: /* function_name */ - case 243: /* index_name */ - case 250: /* topic_name */ - case 256: /* stream_name */ - case 260: /* table_alias */ - case 261: /* column_alias */ - case 278: /* alias_opt */ + case 207: /* user_name */ + case 208: /* dnode_endpoint */ + case 209: /* dnode_host_name */ + case 211: /* db_name */ + case 229: /* column_name */ + case 236: /* table_name */ + case 246: /* function_name */ + case 247: /* index_name */ + case 254: /* topic_name */ + case 260: /* stream_name */ + case 264: /* table_alias */ + case 265: /* column_alias */ + case 282: /* alias_opt */ { } break; - case 209: /* not_exists_opt */ - case 212: /* exists_opt */ - case 252: /* analyze_opt */ - case 254: /* agg_func_opt */ - case 283: /* set_quantifier_opt */ + case 210: /* not_exists_opt */ + case 213: /* exists_opt */ + case 256: /* analyze_opt */ + case 258: /* agg_func_opt */ + case 287: /* set_quantifier_opt */ { } break; - case 214: /* integer_list */ - case 217: /* column_def_list */ - case 218: /* tags_def_opt */ - case 220: /* multi_create_clause */ - case 221: /* tags_def */ - case 222: /* multi_drop_clause */ - case 228: /* specific_tags_opt */ - case 229: /* literal_list */ - case 231: /* col_name_list */ - case 234: /* func_name_list */ - case 245: /* func_list */ - case 249: /* expression_list */ - case 257: /* dnode_list */ - case 284: /* select_list */ - case 286: /* partition_by_clause_opt */ - case 288: /* group_by_clause_opt */ - case 290: /* select_sublist */ - case 294: /* group_by_list */ - case 296: /* order_by_clause_opt */ - case 300: /* sort_specification_list */ + case 215: /* integer_list */ + case 216: /* variable_list */ + case 217: /* retention_list */ + case 221: /* column_def_list */ + case 222: /* tags_def_opt */ + case 224: /* multi_create_clause */ + case 225: /* tags_def */ + case 226: /* multi_drop_clause */ + case 232: /* specific_tags_opt */ + case 233: /* literal_list */ + case 235: /* col_name_list */ + case 238: /* func_name_list */ + case 249: /* func_list */ + case 253: /* expression_list */ + case 261: /* dnode_list */ + case 288: /* select_list */ + case 290: /* partition_by_clause_opt */ + case 292: /* group_by_clause_opt */ + case 294: /* select_sublist */ + case 298: /* group_by_list */ + case 300: /* order_by_clause_opt */ + case 304: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy312)); + nodesDestroyList((yypminor->yy376)); } break; - case 215: /* alter_db_option */ - case 235: /* alter_table_option */ + case 218: /* alter_db_option */ + case 239: /* alter_table_option */ { } break; - case 226: /* type_name */ + case 230: /* type_name */ { } break; - case 267: /* compare_op */ - case 268: /* in_op */ + case 271: /* compare_op */ + case 272: /* in_op */ { } break; - case 280: /* join_type */ + case 284: /* join_type */ { } break; - case 293: /* fill_mode */ + case 297: /* fill_mode */ { } break; - case 302: /* ordering_specification_opt */ + case 306: /* ordering_specification_opt */ { } break; - case 303: /* null_ordering_opt */ + case 307: /* null_ordering_opt */ { } @@ -2043,396 +2064,406 @@ 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[] = { - { 201, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 201, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 202, 0 }, /* (2) account_options ::= */ - { 202, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 202, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 202, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 202, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 202, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 202, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 202, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 202, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 202, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 203, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 203, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 205, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 205, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 205, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 205, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 205, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 205, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 205, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 205, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 205, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 205, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 201, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ - { 201, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 201, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ - { 201, -3 }, /* (27) cmd ::= DROP USER user_name */ - { 201, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ - { 201, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ - { 201, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ - { 201, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ - { 201, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 201, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 201, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ - { 201, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 207, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ - { 208, -1 }, /* (37) dnode_host_name ::= NK_ID */ - { 208, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ - { 201, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ - { 201, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 201, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 201, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 201, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 201, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ - { 201, -2 }, /* (45) cmd ::= USE db_name */ - { 201, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 209, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ - { 209, 0 }, /* (48) not_exists_opt ::= */ - { 212, -2 }, /* (49) exists_opt ::= IF EXISTS */ - { 212, 0 }, /* (50) exists_opt ::= */ - { 211, 0 }, /* (51) db_options ::= */ - { 211, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ - { 211, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ - { 211, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ - { 211, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ - { 211, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ - { 211, -3 }, /* (57) db_options ::= db_options FSYNC NK_INTEGER */ - { 211, -3 }, /* (58) db_options ::= db_options MAXROWS NK_INTEGER */ - { 211, -3 }, /* (59) db_options ::= db_options MINROWS NK_INTEGER */ - { 211, -3 }, /* (60) db_options ::= db_options KEEP integer_list */ - { 211, -3 }, /* (61) db_options ::= db_options PRECISION NK_STRING */ - { 211, -3 }, /* (62) db_options ::= db_options QUORUM NK_INTEGER */ - { 211, -3 }, /* (63) db_options ::= db_options REPLICA NK_INTEGER */ - { 211, -3 }, /* (64) db_options ::= db_options TTL NK_INTEGER */ - { 211, -3 }, /* (65) db_options ::= db_options WAL NK_INTEGER */ - { 211, -3 }, /* (66) db_options ::= db_options VGROUPS NK_INTEGER */ - { 211, -3 }, /* (67) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 211, -3 }, /* (68) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 211, -3 }, /* (69) db_options ::= db_options RETENTIONS NK_STRING */ - { 213, -1 }, /* (70) alter_db_options ::= alter_db_option */ - { 213, -2 }, /* (71) alter_db_options ::= alter_db_options alter_db_option */ - { 215, -2 }, /* (72) alter_db_option ::= BLOCKS NK_INTEGER */ - { 215, -2 }, /* (73) alter_db_option ::= FSYNC NK_INTEGER */ - { 215, -2 }, /* (74) alter_db_option ::= KEEP integer_list */ - { 215, -2 }, /* (75) alter_db_option ::= WAL NK_INTEGER */ - { 215, -2 }, /* (76) alter_db_option ::= QUORUM NK_INTEGER */ - { 215, -2 }, /* (77) alter_db_option ::= CACHELAST NK_INTEGER */ - { 215, -2 }, /* (78) alter_db_option ::= REPLICA NK_INTEGER */ - { 214, -1 }, /* (79) integer_list ::= NK_INTEGER */ - { 214, -3 }, /* (80) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 201, -9 }, /* (81) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 201, -3 }, /* (82) cmd ::= CREATE TABLE multi_create_clause */ - { 201, -9 }, /* (83) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 201, -3 }, /* (84) cmd ::= DROP TABLE multi_drop_clause */ - { 201, -4 }, /* (85) cmd ::= DROP STABLE exists_opt full_table_name */ - { 201, -3 }, /* (86) cmd ::= ALTER TABLE alter_table_clause */ - { 201, -3 }, /* (87) cmd ::= ALTER STABLE alter_table_clause */ - { 223, -2 }, /* (88) alter_table_clause ::= full_table_name alter_table_options */ - { 223, -5 }, /* (89) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 223, -4 }, /* (90) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 223, -5 }, /* (91) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 223, -5 }, /* (92) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 223, -5 }, /* (93) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 223, -4 }, /* (94) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 223, -5 }, /* (95) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 223, -5 }, /* (96) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 223, -6 }, /* (97) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ - { 220, -1 }, /* (98) multi_create_clause ::= create_subtable_clause */ - { 220, -2 }, /* (99) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 227, -9 }, /* (100) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 222, -1 }, /* (101) multi_drop_clause ::= drop_table_clause */ - { 222, -2 }, /* (102) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 230, -2 }, /* (103) drop_table_clause ::= exists_opt full_table_name */ - { 228, 0 }, /* (104) specific_tags_opt ::= */ - { 228, -3 }, /* (105) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 216, -1 }, /* (106) full_table_name ::= table_name */ - { 216, -3 }, /* (107) full_table_name ::= db_name NK_DOT table_name */ - { 217, -1 }, /* (108) column_def_list ::= column_def */ - { 217, -3 }, /* (109) column_def_list ::= column_def_list NK_COMMA column_def */ - { 233, -2 }, /* (110) column_def ::= column_name type_name */ - { 233, -4 }, /* (111) column_def ::= column_name type_name COMMENT NK_STRING */ - { 226, -1 }, /* (112) type_name ::= BOOL */ - { 226, -1 }, /* (113) type_name ::= TINYINT */ - { 226, -1 }, /* (114) type_name ::= SMALLINT */ - { 226, -1 }, /* (115) type_name ::= INT */ - { 226, -1 }, /* (116) type_name ::= INTEGER */ - { 226, -1 }, /* (117) type_name ::= BIGINT */ - { 226, -1 }, /* (118) type_name ::= FLOAT */ - { 226, -1 }, /* (119) type_name ::= DOUBLE */ - { 226, -4 }, /* (120) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 226, -1 }, /* (121) type_name ::= TIMESTAMP */ - { 226, -4 }, /* (122) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 226, -2 }, /* (123) type_name ::= TINYINT UNSIGNED */ - { 226, -2 }, /* (124) type_name ::= SMALLINT UNSIGNED */ - { 226, -2 }, /* (125) type_name ::= INT UNSIGNED */ - { 226, -2 }, /* (126) type_name ::= BIGINT UNSIGNED */ - { 226, -1 }, /* (127) type_name ::= JSON */ - { 226, -4 }, /* (128) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 226, -1 }, /* (129) type_name ::= MEDIUMBLOB */ - { 226, -1 }, /* (130) type_name ::= BLOB */ - { 226, -4 }, /* (131) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 226, -1 }, /* (132) type_name ::= DECIMAL */ - { 226, -4 }, /* (133) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 226, -6 }, /* (134) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 218, 0 }, /* (135) tags_def_opt ::= */ - { 218, -1 }, /* (136) tags_def_opt ::= tags_def */ - { 221, -4 }, /* (137) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 219, 0 }, /* (138) table_options ::= */ - { 219, -3 }, /* (139) table_options ::= table_options COMMENT NK_STRING */ - { 219, -3 }, /* (140) table_options ::= table_options KEEP integer_list */ - { 219, -3 }, /* (141) table_options ::= table_options TTL NK_INTEGER */ - { 219, -5 }, /* (142) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 219, -5 }, /* (143) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ - { 219, -3 }, /* (144) table_options ::= table_options FILE_FACTOR NK_FLOAT */ - { 219, -3 }, /* (145) table_options ::= table_options DELAY NK_INTEGER */ - { 224, -1 }, /* (146) alter_table_options ::= alter_table_option */ - { 224, -2 }, /* (147) alter_table_options ::= alter_table_options alter_table_option */ - { 235, -2 }, /* (148) alter_table_option ::= COMMENT NK_STRING */ - { 235, -2 }, /* (149) alter_table_option ::= KEEP integer_list */ - { 235, -2 }, /* (150) alter_table_option ::= TTL NK_INTEGER */ - { 231, -1 }, /* (151) col_name_list ::= col_name */ - { 231, -3 }, /* (152) col_name_list ::= col_name_list NK_COMMA col_name */ - { 236, -1 }, /* (153) col_name ::= column_name */ - { 201, -2 }, /* (154) cmd ::= SHOW DNODES */ - { 201, -2 }, /* (155) cmd ::= SHOW USERS */ - { 201, -2 }, /* (156) cmd ::= SHOW DATABASES */ - { 201, -4 }, /* (157) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 201, -4 }, /* (158) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 201, -3 }, /* (159) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 201, -2 }, /* (160) cmd ::= SHOW MNODES */ - { 201, -2 }, /* (161) cmd ::= SHOW MODULES */ - { 201, -2 }, /* (162) cmd ::= SHOW QNODES */ - { 201, -2 }, /* (163) cmd ::= SHOW FUNCTIONS */ - { 201, -5 }, /* (164) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 201, -2 }, /* (165) cmd ::= SHOW STREAMS */ - { 201, -2 }, /* (166) cmd ::= SHOW ACCOUNTS */ - { 201, -2 }, /* (167) cmd ::= SHOW APPS */ - { 201, -2 }, /* (168) cmd ::= SHOW CONNECTIONS */ - { 201, -2 }, /* (169) cmd ::= SHOW LICENCE */ - { 201, -4 }, /* (170) cmd ::= SHOW CREATE DATABASE db_name */ - { 201, -4 }, /* (171) cmd ::= SHOW CREATE TABLE full_table_name */ - { 201, -4 }, /* (172) cmd ::= SHOW CREATE STABLE full_table_name */ - { 201, -2 }, /* (173) cmd ::= SHOW QUERIES */ - { 201, -2 }, /* (174) cmd ::= SHOW SCORES */ - { 201, -2 }, /* (175) cmd ::= SHOW TOPICS */ - { 201, -2 }, /* (176) cmd ::= SHOW VARIABLES */ - { 237, 0 }, /* (177) db_name_cond_opt ::= */ - { 237, -2 }, /* (178) db_name_cond_opt ::= db_name NK_DOT */ - { 238, 0 }, /* (179) like_pattern_opt ::= */ - { 238, -2 }, /* (180) like_pattern_opt ::= LIKE NK_STRING */ - { 239, -1 }, /* (181) table_name_cond ::= table_name */ - { 240, 0 }, /* (182) from_db_opt ::= */ - { 240, -2 }, /* (183) from_db_opt ::= FROM db_name */ - { 234, -1 }, /* (184) func_name_list ::= func_name */ - { 234, -3 }, /* (185) func_name_list ::= func_name_list NK_COMMA col_name */ - { 241, -1 }, /* (186) func_name ::= function_name */ - { 201, -8 }, /* (187) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 201, -10 }, /* (188) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ - { 201, -6 }, /* (189) cmd ::= DROP INDEX exists_opt index_name ON table_name */ - { 244, 0 }, /* (190) index_options ::= */ - { 244, -9 }, /* (191) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ - { 244, -11 }, /* (192) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ - { 245, -1 }, /* (193) func_list ::= func */ - { 245, -3 }, /* (194) func_list ::= func_list NK_COMMA func */ - { 248, -4 }, /* (195) func ::= function_name NK_LP expression_list NK_RP */ - { 201, -6 }, /* (196) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 201, -6 }, /* (197) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ - { 201, -4 }, /* (198) cmd ::= DROP TOPIC exists_opt topic_name */ - { 201, -2 }, /* (199) cmd ::= DESC full_table_name */ - { 201, -2 }, /* (200) cmd ::= DESCRIBE full_table_name */ - { 201, -3 }, /* (201) cmd ::= RESET QUERY CACHE */ - { 201, -4 }, /* (202) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 252, 0 }, /* (203) analyze_opt ::= */ - { 252, -1 }, /* (204) analyze_opt ::= ANALYZE */ - { 253, 0 }, /* (205) explain_options ::= */ - { 253, -3 }, /* (206) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 253, -3 }, /* (207) explain_options ::= explain_options RATIO NK_FLOAT */ - { 201, -6 }, /* (208) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 201, -9 }, /* (209) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 201, -3 }, /* (210) cmd ::= DROP FUNCTION function_name */ - { 254, 0 }, /* (211) agg_func_opt ::= */ - { 254, -1 }, /* (212) agg_func_opt ::= AGGREGATE */ - { 255, 0 }, /* (213) bufsize_opt ::= */ - { 255, -2 }, /* (214) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 201, -7 }, /* (215) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ - { 201, -3 }, /* (216) cmd ::= DROP STREAM stream_name */ - { 201, -3 }, /* (217) cmd ::= KILL CONNECTION NK_INTEGER */ - { 201, -3 }, /* (218) cmd ::= KILL QUERY NK_INTEGER */ - { 201, -4 }, /* (219) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 201, -4 }, /* (220) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 201, -3 }, /* (221) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 257, -2 }, /* (222) dnode_list ::= DNODE NK_INTEGER */ - { 257, -3 }, /* (223) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 201, -3 }, /* (224) cmd ::= SYNCDB db_name REPLICA */ - { 201, -1 }, /* (225) cmd ::= query_expression */ - { 204, -1 }, /* (226) literal ::= NK_INTEGER */ - { 204, -1 }, /* (227) literal ::= NK_FLOAT */ - { 204, -1 }, /* (228) literal ::= NK_STRING */ - { 204, -1 }, /* (229) literal ::= NK_BOOL */ - { 204, -2 }, /* (230) literal ::= TIMESTAMP NK_STRING */ - { 204, -1 }, /* (231) literal ::= duration_literal */ - { 204, -1 }, /* (232) literal ::= NULL */ - { 246, -1 }, /* (233) duration_literal ::= NK_VARIABLE */ - { 258, -1 }, /* (234) signed ::= NK_INTEGER */ - { 258, -2 }, /* (235) signed ::= NK_PLUS NK_INTEGER */ - { 258, -2 }, /* (236) signed ::= NK_MINUS NK_INTEGER */ - { 258, -1 }, /* (237) signed ::= NK_FLOAT */ - { 258, -2 }, /* (238) signed ::= NK_PLUS NK_FLOAT */ - { 258, -2 }, /* (239) signed ::= NK_MINUS NK_FLOAT */ - { 259, -1 }, /* (240) signed_literal ::= signed */ - { 259, -1 }, /* (241) signed_literal ::= NK_STRING */ - { 259, -1 }, /* (242) signed_literal ::= NK_BOOL */ - { 259, -2 }, /* (243) signed_literal ::= TIMESTAMP NK_STRING */ - { 259, -1 }, /* (244) signed_literal ::= duration_literal */ - { 259, -1 }, /* (245) signed_literal ::= NULL */ - { 229, -1 }, /* (246) literal_list ::= signed_literal */ - { 229, -3 }, /* (247) literal_list ::= literal_list NK_COMMA signed_literal */ - { 210, -1 }, /* (248) db_name ::= NK_ID */ - { 232, -1 }, /* (249) table_name ::= NK_ID */ - { 225, -1 }, /* (250) column_name ::= NK_ID */ - { 242, -1 }, /* (251) function_name ::= NK_ID */ - { 260, -1 }, /* (252) table_alias ::= NK_ID */ - { 261, -1 }, /* (253) column_alias ::= NK_ID */ - { 206, -1 }, /* (254) user_name ::= NK_ID */ - { 243, -1 }, /* (255) index_name ::= NK_ID */ - { 250, -1 }, /* (256) topic_name ::= NK_ID */ - { 256, -1 }, /* (257) stream_name ::= NK_ID */ - { 262, -1 }, /* (258) expression ::= literal */ - { 262, -1 }, /* (259) expression ::= pseudo_column */ - { 262, -1 }, /* (260) expression ::= column_reference */ - { 262, -4 }, /* (261) expression ::= function_name NK_LP expression_list NK_RP */ - { 262, -4 }, /* (262) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 262, -1 }, /* (263) expression ::= subquery */ - { 262, -3 }, /* (264) expression ::= NK_LP expression NK_RP */ - { 262, -2 }, /* (265) expression ::= NK_PLUS expression */ - { 262, -2 }, /* (266) expression ::= NK_MINUS expression */ - { 262, -3 }, /* (267) expression ::= expression NK_PLUS expression */ - { 262, -3 }, /* (268) expression ::= expression NK_MINUS expression */ - { 262, -3 }, /* (269) expression ::= expression NK_STAR expression */ - { 262, -3 }, /* (270) expression ::= expression NK_SLASH expression */ - { 262, -3 }, /* (271) expression ::= expression NK_REM expression */ - { 249, -1 }, /* (272) expression_list ::= expression */ - { 249, -3 }, /* (273) expression_list ::= expression_list NK_COMMA expression */ - { 264, -1 }, /* (274) column_reference ::= column_name */ - { 264, -3 }, /* (275) column_reference ::= table_name NK_DOT column_name */ - { 263, -1 }, /* (276) pseudo_column ::= NOW */ - { 263, -1 }, /* (277) pseudo_column ::= ROWTS */ - { 263, -1 }, /* (278) pseudo_column ::= TBNAME */ - { 263, -1 }, /* (279) pseudo_column ::= QSTARTTS */ - { 263, -1 }, /* (280) pseudo_column ::= QENDTS */ - { 263, -1 }, /* (281) pseudo_column ::= WSTARTTS */ - { 263, -1 }, /* (282) pseudo_column ::= WENDTS */ - { 263, -1 }, /* (283) pseudo_column ::= WDURATION */ - { 266, -3 }, /* (284) predicate ::= expression compare_op expression */ - { 266, -5 }, /* (285) predicate ::= expression BETWEEN expression AND expression */ - { 266, -6 }, /* (286) predicate ::= expression NOT BETWEEN expression AND expression */ - { 266, -3 }, /* (287) predicate ::= expression IS NULL */ - { 266, -4 }, /* (288) predicate ::= expression IS NOT NULL */ - { 266, -3 }, /* (289) predicate ::= expression in_op in_predicate_value */ - { 267, -1 }, /* (290) compare_op ::= NK_LT */ - { 267, -1 }, /* (291) compare_op ::= NK_GT */ - { 267, -1 }, /* (292) compare_op ::= NK_LE */ - { 267, -1 }, /* (293) compare_op ::= NK_GE */ - { 267, -1 }, /* (294) compare_op ::= NK_NE */ - { 267, -1 }, /* (295) compare_op ::= NK_EQ */ - { 267, -1 }, /* (296) compare_op ::= LIKE */ - { 267, -2 }, /* (297) compare_op ::= NOT LIKE */ - { 267, -1 }, /* (298) compare_op ::= MATCH */ - { 267, -1 }, /* (299) compare_op ::= NMATCH */ - { 268, -1 }, /* (300) in_op ::= IN */ - { 268, -2 }, /* (301) in_op ::= NOT IN */ - { 269, -3 }, /* (302) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 270, -1 }, /* (303) boolean_value_expression ::= boolean_primary */ - { 270, -2 }, /* (304) boolean_value_expression ::= NOT boolean_primary */ - { 270, -3 }, /* (305) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 270, -3 }, /* (306) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 271, -1 }, /* (307) boolean_primary ::= predicate */ - { 271, -3 }, /* (308) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 272, -1 }, /* (309) common_expression ::= expression */ - { 272, -1 }, /* (310) common_expression ::= boolean_value_expression */ - { 273, -2 }, /* (311) from_clause ::= FROM table_reference_list */ - { 274, -1 }, /* (312) table_reference_list ::= table_reference */ - { 274, -3 }, /* (313) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 275, -1 }, /* (314) table_reference ::= table_primary */ - { 275, -1 }, /* (315) table_reference ::= joined_table */ - { 276, -2 }, /* (316) table_primary ::= table_name alias_opt */ - { 276, -4 }, /* (317) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 276, -2 }, /* (318) table_primary ::= subquery alias_opt */ - { 276, -1 }, /* (319) table_primary ::= parenthesized_joined_table */ - { 278, 0 }, /* (320) alias_opt ::= */ - { 278, -1 }, /* (321) alias_opt ::= table_alias */ - { 278, -2 }, /* (322) alias_opt ::= AS table_alias */ - { 279, -3 }, /* (323) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 279, -3 }, /* (324) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 277, -6 }, /* (325) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 280, 0 }, /* (326) join_type ::= */ - { 280, -1 }, /* (327) join_type ::= INNER */ - { 282, -9 }, /* (328) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 283, 0 }, /* (329) set_quantifier_opt ::= */ - { 283, -1 }, /* (330) set_quantifier_opt ::= DISTINCT */ - { 283, -1 }, /* (331) set_quantifier_opt ::= ALL */ - { 284, -1 }, /* (332) select_list ::= NK_STAR */ - { 284, -1 }, /* (333) select_list ::= select_sublist */ - { 290, -1 }, /* (334) select_sublist ::= select_item */ - { 290, -3 }, /* (335) select_sublist ::= select_sublist NK_COMMA select_item */ - { 291, -1 }, /* (336) select_item ::= common_expression */ - { 291, -2 }, /* (337) select_item ::= common_expression column_alias */ - { 291, -3 }, /* (338) select_item ::= common_expression AS column_alias */ - { 291, -3 }, /* (339) select_item ::= table_name NK_DOT NK_STAR */ - { 285, 0 }, /* (340) where_clause_opt ::= */ - { 285, -2 }, /* (341) where_clause_opt ::= WHERE search_condition */ - { 286, 0 }, /* (342) partition_by_clause_opt ::= */ - { 286, -3 }, /* (343) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 287, 0 }, /* (344) twindow_clause_opt ::= */ - { 287, -6 }, /* (345) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 287, -4 }, /* (346) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 287, -6 }, /* (347) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 287, -8 }, /* (348) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 247, 0 }, /* (349) sliding_opt ::= */ - { 247, -4 }, /* (350) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 292, 0 }, /* (351) fill_opt ::= */ - { 292, -4 }, /* (352) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 292, -6 }, /* (353) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 293, -1 }, /* (354) fill_mode ::= NONE */ - { 293, -1 }, /* (355) fill_mode ::= PREV */ - { 293, -1 }, /* (356) fill_mode ::= NULL */ - { 293, -1 }, /* (357) fill_mode ::= LINEAR */ - { 293, -1 }, /* (358) fill_mode ::= NEXT */ - { 288, 0 }, /* (359) group_by_clause_opt ::= */ - { 288, -3 }, /* (360) group_by_clause_opt ::= GROUP BY group_by_list */ - { 294, -1 }, /* (361) group_by_list ::= expression */ - { 294, -3 }, /* (362) group_by_list ::= group_by_list NK_COMMA expression */ - { 289, 0 }, /* (363) having_clause_opt ::= */ - { 289, -2 }, /* (364) having_clause_opt ::= HAVING search_condition */ - { 251, -4 }, /* (365) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 295, -1 }, /* (366) query_expression_body ::= query_primary */ - { 295, -4 }, /* (367) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 299, -1 }, /* (368) query_primary ::= query_specification */ - { 296, 0 }, /* (369) order_by_clause_opt ::= */ - { 296, -3 }, /* (370) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 297, 0 }, /* (371) slimit_clause_opt ::= */ - { 297, -2 }, /* (372) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 297, -4 }, /* (373) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 297, -4 }, /* (374) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 298, 0 }, /* (375) limit_clause_opt ::= */ - { 298, -2 }, /* (376) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 298, -4 }, /* (377) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 298, -4 }, /* (378) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 265, -3 }, /* (379) subquery ::= NK_LP query_expression NK_RP */ - { 281, -1 }, /* (380) search_condition ::= common_expression */ - { 300, -1 }, /* (381) sort_specification_list ::= sort_specification */ - { 300, -3 }, /* (382) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 301, -3 }, /* (383) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 302, 0 }, /* (384) ordering_specification_opt ::= */ - { 302, -1 }, /* (385) ordering_specification_opt ::= ASC */ - { 302, -1 }, /* (386) ordering_specification_opt ::= DESC */ - { 303, 0 }, /* (387) null_ordering_opt ::= */ - { 303, -2 }, /* (388) null_ordering_opt ::= NULLS FIRST */ - { 303, -2 }, /* (389) null_ordering_opt ::= NULLS LAST */ + { 202, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 202, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 203, 0 }, /* (2) account_options ::= */ + { 203, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 203, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 203, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 203, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 203, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 203, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 203, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 203, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 203, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 204, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 204, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 206, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 206, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 206, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 206, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 206, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 206, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 206, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 206, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 206, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 206, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 202, -5 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 202, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 202, -5 }, /* (26) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 202, -3 }, /* (27) cmd ::= DROP USER user_name */ + { 202, -3 }, /* (28) cmd ::= CREATE DNODE dnode_endpoint */ + { 202, -5 }, /* (29) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 202, -3 }, /* (30) cmd ::= DROP DNODE NK_INTEGER */ + { 202, -3 }, /* (31) cmd ::= DROP DNODE dnode_endpoint */ + { 202, -4 }, /* (32) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 202, -5 }, /* (33) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 202, -4 }, /* (34) cmd ::= ALTER ALL DNODES NK_STRING */ + { 202, -5 }, /* (35) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 208, -1 }, /* (36) dnode_endpoint ::= NK_STRING */ + { 209, -1 }, /* (37) dnode_host_name ::= NK_ID */ + { 209, -1 }, /* (38) dnode_host_name ::= NK_IPTOKEN */ + { 202, -3 }, /* (39) cmd ::= ALTER LOCAL NK_STRING */ + { 202, -4 }, /* (40) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 202, -5 }, /* (41) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 202, -5 }, /* (42) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 202, -5 }, /* (43) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 202, -4 }, /* (44) cmd ::= DROP DATABASE exists_opt db_name */ + { 202, -2 }, /* (45) cmd ::= USE db_name */ + { 202, -4 }, /* (46) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 210, -3 }, /* (47) not_exists_opt ::= IF NOT EXISTS */ + { 210, 0 }, /* (48) not_exists_opt ::= */ + { 213, -2 }, /* (49) exists_opt ::= IF EXISTS */ + { 213, 0 }, /* (50) exists_opt ::= */ + { 212, 0 }, /* (51) db_options ::= */ + { 212, -3 }, /* (52) db_options ::= db_options BLOCKS NK_INTEGER */ + { 212, -3 }, /* (53) db_options ::= db_options CACHE NK_INTEGER */ + { 212, -3 }, /* (54) db_options ::= db_options CACHELAST NK_INTEGER */ + { 212, -3 }, /* (55) db_options ::= db_options COMP NK_INTEGER */ + { 212, -3 }, /* (56) db_options ::= db_options DAYS NK_INTEGER */ + { 212, -3 }, /* (57) db_options ::= db_options DAYS NK_VARIABLE */ + { 212, -3 }, /* (58) db_options ::= db_options FSYNC NK_INTEGER */ + { 212, -3 }, /* (59) db_options ::= db_options MAXROWS NK_INTEGER */ + { 212, -3 }, /* (60) db_options ::= db_options MINROWS NK_INTEGER */ + { 212, -3 }, /* (61) db_options ::= db_options KEEP integer_list */ + { 212, -3 }, /* (62) db_options ::= db_options KEEP variable_list */ + { 212, -3 }, /* (63) db_options ::= db_options PRECISION NK_STRING */ + { 212, -3 }, /* (64) db_options ::= db_options QUORUM NK_INTEGER */ + { 212, -3 }, /* (65) db_options ::= db_options REPLICA NK_INTEGER */ + { 212, -3 }, /* (66) db_options ::= db_options TTL NK_INTEGER */ + { 212, -3 }, /* (67) db_options ::= db_options WAL NK_INTEGER */ + { 212, -3 }, /* (68) db_options ::= db_options VGROUPS NK_INTEGER */ + { 212, -3 }, /* (69) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 212, -3 }, /* (70) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 212, -3 }, /* (71) db_options ::= db_options RETENTIONS retention_list */ + { 214, -1 }, /* (72) alter_db_options ::= alter_db_option */ + { 214, -2 }, /* (73) alter_db_options ::= alter_db_options alter_db_option */ + { 218, -2 }, /* (74) alter_db_option ::= BLOCKS NK_INTEGER */ + { 218, -2 }, /* (75) alter_db_option ::= FSYNC NK_INTEGER */ + { 218, -2 }, /* (76) alter_db_option ::= KEEP integer_list */ + { 218, -2 }, /* (77) alter_db_option ::= KEEP variable_list */ + { 218, -2 }, /* (78) alter_db_option ::= WAL NK_INTEGER */ + { 218, -2 }, /* (79) alter_db_option ::= QUORUM NK_INTEGER */ + { 218, -2 }, /* (80) alter_db_option ::= CACHELAST NK_INTEGER */ + { 218, -2 }, /* (81) alter_db_option ::= REPLICA NK_INTEGER */ + { 215, -1 }, /* (82) integer_list ::= NK_INTEGER */ + { 215, -3 }, /* (83) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 216, -1 }, /* (84) variable_list ::= NK_VARIABLE */ + { 216, -3 }, /* (85) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 217, -1 }, /* (86) retention_list ::= retention */ + { 217, -3 }, /* (87) retention_list ::= retention_list NK_COMMA retention */ + { 219, -3 }, /* (88) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 202, -9 }, /* (89) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 202, -3 }, /* (90) cmd ::= CREATE TABLE multi_create_clause */ + { 202, -9 }, /* (91) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 202, -3 }, /* (92) cmd ::= DROP TABLE multi_drop_clause */ + { 202, -4 }, /* (93) cmd ::= DROP STABLE exists_opt full_table_name */ + { 202, -3 }, /* (94) cmd ::= ALTER TABLE alter_table_clause */ + { 202, -3 }, /* (95) cmd ::= ALTER STABLE alter_table_clause */ + { 227, -2 }, /* (96) alter_table_clause ::= full_table_name alter_table_options */ + { 227, -5 }, /* (97) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 227, -4 }, /* (98) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 227, -5 }, /* (99) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 227, -5 }, /* (100) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 227, -5 }, /* (101) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 227, -4 }, /* (102) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 227, -5 }, /* (103) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 227, -5 }, /* (104) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 227, -6 }, /* (105) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ + { 224, -1 }, /* (106) multi_create_clause ::= create_subtable_clause */ + { 224, -2 }, /* (107) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 231, -9 }, /* (108) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 226, -1 }, /* (109) multi_drop_clause ::= drop_table_clause */ + { 226, -2 }, /* (110) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 234, -2 }, /* (111) drop_table_clause ::= exists_opt full_table_name */ + { 232, 0 }, /* (112) specific_tags_opt ::= */ + { 232, -3 }, /* (113) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 220, -1 }, /* (114) full_table_name ::= table_name */ + { 220, -3 }, /* (115) full_table_name ::= db_name NK_DOT table_name */ + { 221, -1 }, /* (116) column_def_list ::= column_def */ + { 221, -3 }, /* (117) column_def_list ::= column_def_list NK_COMMA column_def */ + { 237, -2 }, /* (118) column_def ::= column_name type_name */ + { 237, -4 }, /* (119) column_def ::= column_name type_name COMMENT NK_STRING */ + { 230, -1 }, /* (120) type_name ::= BOOL */ + { 230, -1 }, /* (121) type_name ::= TINYINT */ + { 230, -1 }, /* (122) type_name ::= SMALLINT */ + { 230, -1 }, /* (123) type_name ::= INT */ + { 230, -1 }, /* (124) type_name ::= INTEGER */ + { 230, -1 }, /* (125) type_name ::= BIGINT */ + { 230, -1 }, /* (126) type_name ::= FLOAT */ + { 230, -1 }, /* (127) type_name ::= DOUBLE */ + { 230, -4 }, /* (128) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 230, -1 }, /* (129) type_name ::= TIMESTAMP */ + { 230, -4 }, /* (130) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 230, -2 }, /* (131) type_name ::= TINYINT UNSIGNED */ + { 230, -2 }, /* (132) type_name ::= SMALLINT UNSIGNED */ + { 230, -2 }, /* (133) type_name ::= INT UNSIGNED */ + { 230, -2 }, /* (134) type_name ::= BIGINT UNSIGNED */ + { 230, -1 }, /* (135) type_name ::= JSON */ + { 230, -4 }, /* (136) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 230, -1 }, /* (137) type_name ::= MEDIUMBLOB */ + { 230, -1 }, /* (138) type_name ::= BLOB */ + { 230, -4 }, /* (139) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 230, -1 }, /* (140) type_name ::= DECIMAL */ + { 230, -4 }, /* (141) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 230, -6 }, /* (142) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 222, 0 }, /* (143) tags_def_opt ::= */ + { 222, -1 }, /* (144) tags_def_opt ::= tags_def */ + { 225, -4 }, /* (145) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 223, 0 }, /* (146) table_options ::= */ + { 223, -3 }, /* (147) table_options ::= table_options COMMENT NK_STRING */ + { 223, -3 }, /* (148) table_options ::= table_options KEEP integer_list */ + { 223, -3 }, /* (149) table_options ::= table_options TTL NK_INTEGER */ + { 223, -5 }, /* (150) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 223, -5 }, /* (151) table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ + { 223, -3 }, /* (152) table_options ::= table_options FILE_FACTOR NK_FLOAT */ + { 223, -3 }, /* (153) table_options ::= table_options DELAY NK_INTEGER */ + { 228, -1 }, /* (154) alter_table_options ::= alter_table_option */ + { 228, -2 }, /* (155) alter_table_options ::= alter_table_options alter_table_option */ + { 239, -2 }, /* (156) alter_table_option ::= COMMENT NK_STRING */ + { 239, -2 }, /* (157) alter_table_option ::= KEEP integer_list */ + { 239, -2 }, /* (158) alter_table_option ::= TTL NK_INTEGER */ + { 235, -1 }, /* (159) col_name_list ::= col_name */ + { 235, -3 }, /* (160) col_name_list ::= col_name_list NK_COMMA col_name */ + { 240, -1 }, /* (161) col_name ::= column_name */ + { 202, -2 }, /* (162) cmd ::= SHOW DNODES */ + { 202, -2 }, /* (163) cmd ::= SHOW USERS */ + { 202, -2 }, /* (164) cmd ::= SHOW DATABASES */ + { 202, -4 }, /* (165) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 202, -4 }, /* (166) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 202, -3 }, /* (167) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 202, -2 }, /* (168) cmd ::= SHOW MNODES */ + { 202, -2 }, /* (169) cmd ::= SHOW MODULES */ + { 202, -2 }, /* (170) cmd ::= SHOW QNODES */ + { 202, -2 }, /* (171) cmd ::= SHOW FUNCTIONS */ + { 202, -5 }, /* (172) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 202, -2 }, /* (173) cmd ::= SHOW STREAMS */ + { 202, -2 }, /* (174) cmd ::= SHOW ACCOUNTS */ + { 202, -2 }, /* (175) cmd ::= SHOW APPS */ + { 202, -2 }, /* (176) cmd ::= SHOW CONNECTIONS */ + { 202, -2 }, /* (177) cmd ::= SHOW LICENCE */ + { 202, -4 }, /* (178) cmd ::= SHOW CREATE DATABASE db_name */ + { 202, -4 }, /* (179) cmd ::= SHOW CREATE TABLE full_table_name */ + { 202, -4 }, /* (180) cmd ::= SHOW CREATE STABLE full_table_name */ + { 202, -2 }, /* (181) cmd ::= SHOW QUERIES */ + { 202, -2 }, /* (182) cmd ::= SHOW SCORES */ + { 202, -2 }, /* (183) cmd ::= SHOW TOPICS */ + { 202, -2 }, /* (184) cmd ::= SHOW VARIABLES */ + { 241, 0 }, /* (185) db_name_cond_opt ::= */ + { 241, -2 }, /* (186) db_name_cond_opt ::= db_name NK_DOT */ + { 242, 0 }, /* (187) like_pattern_opt ::= */ + { 242, -2 }, /* (188) like_pattern_opt ::= LIKE NK_STRING */ + { 243, -1 }, /* (189) table_name_cond ::= table_name */ + { 244, 0 }, /* (190) from_db_opt ::= */ + { 244, -2 }, /* (191) from_db_opt ::= FROM db_name */ + { 238, -1 }, /* (192) func_name_list ::= func_name */ + { 238, -3 }, /* (193) func_name_list ::= func_name_list NK_COMMA col_name */ + { 245, -1 }, /* (194) func_name ::= function_name */ + { 202, -8 }, /* (195) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 202, -10 }, /* (196) cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ + { 202, -6 }, /* (197) cmd ::= DROP INDEX exists_opt index_name ON table_name */ + { 248, 0 }, /* (198) index_options ::= */ + { 248, -9 }, /* (199) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ + { 248, -11 }, /* (200) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ + { 249, -1 }, /* (201) func_list ::= func */ + { 249, -3 }, /* (202) func_list ::= func_list NK_COMMA func */ + { 252, -4 }, /* (203) func ::= function_name NK_LP expression_list NK_RP */ + { 202, -6 }, /* (204) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 202, -6 }, /* (205) cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ + { 202, -4 }, /* (206) cmd ::= DROP TOPIC exists_opt topic_name */ + { 202, -2 }, /* (207) cmd ::= DESC full_table_name */ + { 202, -2 }, /* (208) cmd ::= DESCRIBE full_table_name */ + { 202, -3 }, /* (209) cmd ::= RESET QUERY CACHE */ + { 202, -4 }, /* (210) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 256, 0 }, /* (211) analyze_opt ::= */ + { 256, -1 }, /* (212) analyze_opt ::= ANALYZE */ + { 257, 0 }, /* (213) explain_options ::= */ + { 257, -3 }, /* (214) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 257, -3 }, /* (215) explain_options ::= explain_options RATIO NK_FLOAT */ + { 202, -6 }, /* (216) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ + { 202, -9 }, /* (217) cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 202, -3 }, /* (218) cmd ::= DROP FUNCTION function_name */ + { 258, 0 }, /* (219) agg_func_opt ::= */ + { 258, -1 }, /* (220) agg_func_opt ::= AGGREGATE */ + { 259, 0 }, /* (221) bufsize_opt ::= */ + { 259, -2 }, /* (222) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 202, -7 }, /* (223) cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ + { 202, -3 }, /* (224) cmd ::= DROP STREAM stream_name */ + { 202, -3 }, /* (225) cmd ::= KILL CONNECTION NK_INTEGER */ + { 202, -3 }, /* (226) cmd ::= KILL QUERY NK_INTEGER */ + { 202, -4 }, /* (227) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 202, -4 }, /* (228) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 202, -3 }, /* (229) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 261, -2 }, /* (230) dnode_list ::= DNODE NK_INTEGER */ + { 261, -3 }, /* (231) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 202, -3 }, /* (232) cmd ::= SYNCDB db_name REPLICA */ + { 202, -1 }, /* (233) cmd ::= query_expression */ + { 205, -1 }, /* (234) literal ::= NK_INTEGER */ + { 205, -1 }, /* (235) literal ::= NK_FLOAT */ + { 205, -1 }, /* (236) literal ::= NK_STRING */ + { 205, -1 }, /* (237) literal ::= NK_BOOL */ + { 205, -2 }, /* (238) literal ::= TIMESTAMP NK_STRING */ + { 205, -1 }, /* (239) literal ::= duration_literal */ + { 205, -1 }, /* (240) literal ::= NULL */ + { 250, -1 }, /* (241) duration_literal ::= NK_VARIABLE */ + { 262, -1 }, /* (242) signed ::= NK_INTEGER */ + { 262, -2 }, /* (243) signed ::= NK_PLUS NK_INTEGER */ + { 262, -2 }, /* (244) signed ::= NK_MINUS NK_INTEGER */ + { 262, -1 }, /* (245) signed ::= NK_FLOAT */ + { 262, -2 }, /* (246) signed ::= NK_PLUS NK_FLOAT */ + { 262, -2 }, /* (247) signed ::= NK_MINUS NK_FLOAT */ + { 263, -1 }, /* (248) signed_literal ::= signed */ + { 263, -1 }, /* (249) signed_literal ::= NK_STRING */ + { 263, -1 }, /* (250) signed_literal ::= NK_BOOL */ + { 263, -2 }, /* (251) signed_literal ::= TIMESTAMP NK_STRING */ + { 263, -1 }, /* (252) signed_literal ::= duration_literal */ + { 263, -1 }, /* (253) signed_literal ::= NULL */ + { 233, -1 }, /* (254) literal_list ::= signed_literal */ + { 233, -3 }, /* (255) literal_list ::= literal_list NK_COMMA signed_literal */ + { 211, -1 }, /* (256) db_name ::= NK_ID */ + { 236, -1 }, /* (257) table_name ::= NK_ID */ + { 229, -1 }, /* (258) column_name ::= NK_ID */ + { 246, -1 }, /* (259) function_name ::= NK_ID */ + { 246, -1 }, /* (260) function_name ::= FIRST */ + { 246, -1 }, /* (261) function_name ::= LAST */ + { 264, -1 }, /* (262) table_alias ::= NK_ID */ + { 265, -1 }, /* (263) column_alias ::= NK_ID */ + { 207, -1 }, /* (264) user_name ::= NK_ID */ + { 247, -1 }, /* (265) index_name ::= NK_ID */ + { 254, -1 }, /* (266) topic_name ::= NK_ID */ + { 260, -1 }, /* (267) stream_name ::= NK_ID */ + { 266, -1 }, /* (268) expression ::= literal */ + { 266, -1 }, /* (269) expression ::= pseudo_column */ + { 266, -1 }, /* (270) expression ::= column_reference */ + { 266, -4 }, /* (271) expression ::= function_name NK_LP expression_list NK_RP */ + { 266, -4 }, /* (272) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 266, -1 }, /* (273) expression ::= subquery */ + { 266, -3 }, /* (274) expression ::= NK_LP expression NK_RP */ + { 266, -2 }, /* (275) expression ::= NK_PLUS expression */ + { 266, -2 }, /* (276) expression ::= NK_MINUS expression */ + { 266, -3 }, /* (277) expression ::= expression NK_PLUS expression */ + { 266, -3 }, /* (278) expression ::= expression NK_MINUS expression */ + { 266, -3 }, /* (279) expression ::= expression NK_STAR expression */ + { 266, -3 }, /* (280) expression ::= expression NK_SLASH expression */ + { 266, -3 }, /* (281) expression ::= expression NK_REM expression */ + { 253, -1 }, /* (282) expression_list ::= expression */ + { 253, -3 }, /* (283) expression_list ::= expression_list NK_COMMA expression */ + { 268, -1 }, /* (284) column_reference ::= column_name */ + { 268, -3 }, /* (285) column_reference ::= table_name NK_DOT column_name */ + { 267, -1 }, /* (286) pseudo_column ::= NOW */ + { 267, -1 }, /* (287) pseudo_column ::= ROWTS */ + { 267, -1 }, /* (288) pseudo_column ::= TBNAME */ + { 267, -1 }, /* (289) pseudo_column ::= QSTARTTS */ + { 267, -1 }, /* (290) pseudo_column ::= QENDTS */ + { 267, -1 }, /* (291) pseudo_column ::= WSTARTTS */ + { 267, -1 }, /* (292) pseudo_column ::= WENDTS */ + { 267, -1 }, /* (293) pseudo_column ::= WDURATION */ + { 270, -3 }, /* (294) predicate ::= expression compare_op expression */ + { 270, -5 }, /* (295) predicate ::= expression BETWEEN expression AND expression */ + { 270, -6 }, /* (296) predicate ::= expression NOT BETWEEN expression AND expression */ + { 270, -3 }, /* (297) predicate ::= expression IS NULL */ + { 270, -4 }, /* (298) predicate ::= expression IS NOT NULL */ + { 270, -3 }, /* (299) predicate ::= expression in_op in_predicate_value */ + { 271, -1 }, /* (300) compare_op ::= NK_LT */ + { 271, -1 }, /* (301) compare_op ::= NK_GT */ + { 271, -1 }, /* (302) compare_op ::= NK_LE */ + { 271, -1 }, /* (303) compare_op ::= NK_GE */ + { 271, -1 }, /* (304) compare_op ::= NK_NE */ + { 271, -1 }, /* (305) compare_op ::= NK_EQ */ + { 271, -1 }, /* (306) compare_op ::= LIKE */ + { 271, -2 }, /* (307) compare_op ::= NOT LIKE */ + { 271, -1 }, /* (308) compare_op ::= MATCH */ + { 271, -1 }, /* (309) compare_op ::= NMATCH */ + { 272, -1 }, /* (310) in_op ::= IN */ + { 272, -2 }, /* (311) in_op ::= NOT IN */ + { 273, -3 }, /* (312) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 274, -1 }, /* (313) boolean_value_expression ::= boolean_primary */ + { 274, -2 }, /* (314) boolean_value_expression ::= NOT boolean_primary */ + { 274, -3 }, /* (315) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 274, -3 }, /* (316) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 275, -1 }, /* (317) boolean_primary ::= predicate */ + { 275, -3 }, /* (318) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 276, -1 }, /* (319) common_expression ::= expression */ + { 276, -1 }, /* (320) common_expression ::= boolean_value_expression */ + { 277, -2 }, /* (321) from_clause ::= FROM table_reference_list */ + { 278, -1 }, /* (322) table_reference_list ::= table_reference */ + { 278, -3 }, /* (323) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 279, -1 }, /* (324) table_reference ::= table_primary */ + { 279, -1 }, /* (325) table_reference ::= joined_table */ + { 280, -2 }, /* (326) table_primary ::= table_name alias_opt */ + { 280, -4 }, /* (327) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 280, -2 }, /* (328) table_primary ::= subquery alias_opt */ + { 280, -1 }, /* (329) table_primary ::= parenthesized_joined_table */ + { 282, 0 }, /* (330) alias_opt ::= */ + { 282, -1 }, /* (331) alias_opt ::= table_alias */ + { 282, -2 }, /* (332) alias_opt ::= AS table_alias */ + { 283, -3 }, /* (333) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 283, -3 }, /* (334) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 281, -6 }, /* (335) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 284, 0 }, /* (336) join_type ::= */ + { 284, -1 }, /* (337) join_type ::= INNER */ + { 286, -9 }, /* (338) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 287, 0 }, /* (339) set_quantifier_opt ::= */ + { 287, -1 }, /* (340) set_quantifier_opt ::= DISTINCT */ + { 287, -1 }, /* (341) set_quantifier_opt ::= ALL */ + { 288, -1 }, /* (342) select_list ::= NK_STAR */ + { 288, -1 }, /* (343) select_list ::= select_sublist */ + { 294, -1 }, /* (344) select_sublist ::= select_item */ + { 294, -3 }, /* (345) select_sublist ::= select_sublist NK_COMMA select_item */ + { 295, -1 }, /* (346) select_item ::= common_expression */ + { 295, -2 }, /* (347) select_item ::= common_expression column_alias */ + { 295, -3 }, /* (348) select_item ::= common_expression AS column_alias */ + { 295, -3 }, /* (349) select_item ::= table_name NK_DOT NK_STAR */ + { 289, 0 }, /* (350) where_clause_opt ::= */ + { 289, -2 }, /* (351) where_clause_opt ::= WHERE search_condition */ + { 290, 0 }, /* (352) partition_by_clause_opt ::= */ + { 290, -3 }, /* (353) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 291, 0 }, /* (354) twindow_clause_opt ::= */ + { 291, -6 }, /* (355) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 291, -4 }, /* (356) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 291, -6 }, /* (357) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 291, -8 }, /* (358) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 251, 0 }, /* (359) sliding_opt ::= */ + { 251, -4 }, /* (360) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 296, 0 }, /* (361) fill_opt ::= */ + { 296, -4 }, /* (362) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 296, -6 }, /* (363) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 297, -1 }, /* (364) fill_mode ::= NONE */ + { 297, -1 }, /* (365) fill_mode ::= PREV */ + { 297, -1 }, /* (366) fill_mode ::= NULL */ + { 297, -1 }, /* (367) fill_mode ::= LINEAR */ + { 297, -1 }, /* (368) fill_mode ::= NEXT */ + { 292, 0 }, /* (369) group_by_clause_opt ::= */ + { 292, -3 }, /* (370) group_by_clause_opt ::= GROUP BY group_by_list */ + { 298, -1 }, /* (371) group_by_list ::= expression */ + { 298, -3 }, /* (372) group_by_list ::= group_by_list NK_COMMA expression */ + { 293, 0 }, /* (373) having_clause_opt ::= */ + { 293, -2 }, /* (374) having_clause_opt ::= HAVING search_condition */ + { 255, -4 }, /* (375) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 299, -1 }, /* (376) query_expression_body ::= query_primary */ + { 299, -4 }, /* (377) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 303, -1 }, /* (378) query_primary ::= query_specification */ + { 300, 0 }, /* (379) order_by_clause_opt ::= */ + { 300, -3 }, /* (380) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 301, 0 }, /* (381) slimit_clause_opt ::= */ + { 301, -2 }, /* (382) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 301, -4 }, /* (383) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 301, -4 }, /* (384) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 302, 0 }, /* (385) limit_clause_opt ::= */ + { 302, -2 }, /* (386) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 302, -4 }, /* (387) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 302, -4 }, /* (388) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 269, -3 }, /* (389) subquery ::= NK_LP query_expression NK_RP */ + { 285, -1 }, /* (390) search_condition ::= common_expression */ + { 304, -1 }, /* (391) sort_specification_list ::= sort_specification */ + { 304, -3 }, /* (392) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 305, -3 }, /* (393) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 306, 0 }, /* (394) ordering_specification_opt ::= */ + { 306, -1 }, /* (395) ordering_specification_opt ::= ASC */ + { 306, -1 }, /* (396) ordering_specification_opt ::= DESC */ + { 307, 0 }, /* (397) null_ordering_opt ::= */ + { 307, -2 }, /* (398) null_ordering_opt ::= NULLS FIRST */ + { 307, -2 }, /* (399) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -2521,11 +2552,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,202,&yymsp[0].minor); + yy_destructor(yypParser,203,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,203,&yymsp[0].minor); + yy_destructor(yypParser,204,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -2539,20 +2570,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,202,&yymsp[-2].minor); +{ yy_destructor(yypParser,203,&yymsp[-2].minor); { } - yy_destructor(yypParser,204,&yymsp[0].minor); + yy_destructor(yypParser,205,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,205,&yymsp[0].minor); +{ yy_destructor(yypParser,206,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,203,&yymsp[-1].minor); +{ yy_destructor(yypParser,204,&yymsp[-1].minor); { } - yy_destructor(yypParser,205,&yymsp[0].minor); + yy_destructor(yypParser,206,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -2566,31 +2597,31 @@ 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,204,&yymsp[0].minor); + yy_destructor(yypParser,205,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy0); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy393, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy393, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy129); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy393); } break; case 28: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy129, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy393, NULL); } break; case 29: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy0); } break; case 30: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 31: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy129); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy393); } break; case 32: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -2607,18 +2638,20 @@ static YYACTIONTYPE yy_reduce( case 36: /* dnode_endpoint ::= NK_STRING */ case 37: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==37); case 38: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==38); - case 248: /* db_name ::= NK_ID */ yytestcase(yyruleno==248); - case 249: /* table_name ::= NK_ID */ yytestcase(yyruleno==249); - case 250: /* column_name ::= NK_ID */ yytestcase(yyruleno==250); - case 251: /* function_name ::= NK_ID */ yytestcase(yyruleno==251); - case 252: /* table_alias ::= NK_ID */ yytestcase(yyruleno==252); - case 253: /* column_alias ::= NK_ID */ yytestcase(yyruleno==253); - case 254: /* user_name ::= NK_ID */ yytestcase(yyruleno==254); - case 255: /* index_name ::= NK_ID */ yytestcase(yyruleno==255); - case 256: /* topic_name ::= NK_ID */ yytestcase(yyruleno==256); - case 257: /* stream_name ::= NK_ID */ yytestcase(yyruleno==257); -{ yylhsminor.yy129 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy129 = yylhsminor.yy129; + case 256: /* db_name ::= NK_ID */ yytestcase(yyruleno==256); + case 257: /* table_name ::= NK_ID */ yytestcase(yyruleno==257); + case 258: /* column_name ::= NK_ID */ yytestcase(yyruleno==258); + case 259: /* function_name ::= NK_ID */ yytestcase(yyruleno==259); + case 260: /* function_name ::= FIRST */ yytestcase(yyruleno==260); + case 261: /* function_name ::= LAST */ yytestcase(yyruleno==261); + case 262: /* table_alias ::= NK_ID */ yytestcase(yyruleno==262); + case 263: /* column_alias ::= NK_ID */ yytestcase(yyruleno==263); + case 264: /* user_name ::= NK_ID */ yytestcase(yyruleno==264); + case 265: /* index_name ::= NK_ID */ yytestcase(yyruleno==265); + case 266: /* topic_name ::= NK_ID */ yytestcase(yyruleno==266); + case 267: /* stream_name ::= NK_ID */ yytestcase(yyruleno==267); +{ yylhsminor.yy393 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy393 = yylhsminor.yy393; break; case 39: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -2633,1057 +2666,1077 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropQnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy129, yymsp[0].minor.yy104); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy537, &yymsp[-1].minor.yy393, yymsp[0].minor.yy168); } break; case 44: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy185, &yymsp[0].minor.yy129); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy537, &yymsp[0].minor.yy393); } break; case 45: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy393); } break; case 46: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy104); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy393, yymsp[0].minor.yy168); } break; case 47: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy185 = true; } +{ yymsp[-2].minor.yy537 = true; } break; case 48: /* not_exists_opt ::= */ case 50: /* exists_opt ::= */ yytestcase(yyruleno==50); - case 203: /* analyze_opt ::= */ yytestcase(yyruleno==203); - case 211: /* agg_func_opt ::= */ yytestcase(yyruleno==211); - case 329: /* set_quantifier_opt ::= */ yytestcase(yyruleno==329); -{ yymsp[1].minor.yy185 = false; } + case 211: /* analyze_opt ::= */ yytestcase(yyruleno==211); + case 219: /* agg_func_opt ::= */ yytestcase(yyruleno==219); + case 339: /* set_quantifier_opt ::= */ yytestcase(yyruleno==339); +{ yymsp[1].minor.yy537 = false; } break; case 49: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy185 = true; } +{ yymsp[-1].minor.yy537 = true; } break; case 51: /* db_options ::= */ -{ yymsp[1].minor.yy104 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy168 = createDatabaseOptions(pCxt); } break; case 52: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pNumOfBlocks = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; case 53: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pCacheBlockSize = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; case 54: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pCachelast = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; case 55: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pCompressionLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; case 56: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 57: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 58: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 59: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 60: /* db_options ::= db_options KEEP integer_list */ -{ yylhsminor.yy104 = setDatabaseKeepOption(pCxt, yymsp[-2].minor.yy104, yymsp[0].minor.yy312); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 61: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 62: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 63: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 64: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 65: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 66: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 67: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 68: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_STREAM_MODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 69: /* db_options ::= db_options RETENTIONS NK_STRING */ -{ yylhsminor.yy104 = setDatabaseOption(pCxt, yymsp[-2].minor.yy104, DB_OPTION_RETENTIONS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 70: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy104 = createDefaultAlterDatabaseOptions(pCxt); yylhsminor.yy104 = setDatabaseAlterOption(pCxt, yylhsminor.yy104, &yymsp[0].minor.yy253); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 71: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy104 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy104, &yymsp[0].minor.yy253); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; - break; - case 72: /* alter_db_option ::= BLOCKS NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } - break; - case 73: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } - break; - case 74: /* alter_db_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_KEEP; yymsp[-1].minor.yy253.pKeep = yymsp[0].minor.yy312; } +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pDaysPerFile = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 75: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_WAL; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } + case 57: /* db_options ::= db_options DAYS NK_VARIABLE */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pDaysPerFile = (SValueNode*)createDurationValueNode(pCxt, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 76: /* alter_db_option ::= QUORUM NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } + case 58: /* db_options ::= db_options FSYNC NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pFsyncPeriod = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 77: /* alter_db_option ::= CACHELAST NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } - break; - case 78: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } - break; - case 79: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy312 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy312 = yylhsminor.yy312; - break; - case 80: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 223: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==223); -{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy312 = yylhsminor.yy312; - break; - case 81: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 83: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==83); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy185, yymsp[-5].minor.yy104, yymsp[-3].minor.yy312, yymsp[-1].minor.yy312, yymsp[0].minor.yy104); } - break; - case 82: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy312); } - break; - case 84: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy312); } - break; - case 85: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy185, yymsp[0].minor.yy104); } - break; - case 86: /* cmd ::= ALTER TABLE alter_table_clause */ - case 87: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==87); - case 225: /* cmd ::= query_expression */ yytestcase(yyruleno==225); -{ pCxt->pRootNode = yymsp[0].minor.yy104; } - break; - case 88: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy104 = createAlterTableOption(pCxt, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; - break; - case 89: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; - break; - case 90: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy104 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy104, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy129); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; - break; - case 91: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; - break; - case 92: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy104 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 59: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pMaxRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 93: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 60: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pMinRowsPerBlock = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 61: /* db_options ::= db_options KEEP integer_list */ + case 62: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==62); +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pKeep = yymsp[0].minor.yy376; yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 63: /* db_options ::= db_options PRECISION NK_STRING */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pPrecision = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 64: /* db_options ::= db_options QUORUM NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pQuorum = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 65: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pReplica = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 66: /* db_options ::= db_options TTL NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 67: /* db_options ::= db_options WAL NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pWalLevel = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 68: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pNumOfVgroups = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 69: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pSingleStable = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 70: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pStreamMode = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 71: /* db_options ::= db_options RETENTIONS retention_list */ +{ ((SDatabaseOptions*)yymsp[-2].minor.yy168)->pRetentions = yymsp[0].minor.yy376; yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 72: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy168 = createDatabaseOptions(pCxt); yylhsminor.yy168 = setDatabaseAlterOption(pCxt, yylhsminor.yy168, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 73: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy168 = setDatabaseAlterOption(pCxt, yymsp[-1].minor.yy168, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; + break; + case 74: /* alter_db_option ::= BLOCKS NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_BLOCKS; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 75: /* alter_db_option ::= FSYNC NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 76: /* alter_db_option ::= KEEP integer_list */ + case 77: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==77); +{ yymsp[-1].minor.yy277.type = DB_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy376; } + break; + case 78: /* alter_db_option ::= WAL NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_WAL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 79: /* alter_db_option ::= QUORUM NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_QUORUM; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 80: /* alter_db_option ::= CACHELAST NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_CACHELAST; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 81: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 82: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy376 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy376 = yylhsminor.yy376; + break; + case 83: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 231: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==231); +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-2].minor.yy376, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy376 = yylhsminor.yy376; + break; + case 84: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy376 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy376 = yylhsminor.yy376; + break; + case 85: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-2].minor.yy376, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy376 = yylhsminor.yy376; + break; + case 86: /* retention_list ::= retention */ + case 106: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==106); + case 109: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==109); + case 116: /* column_def_list ::= column_def */ yytestcase(yyruleno==116); + case 159: /* col_name_list ::= col_name */ yytestcase(yyruleno==159); + case 192: /* func_name_list ::= func_name */ yytestcase(yyruleno==192); + case 201: /* func_list ::= func */ yytestcase(yyruleno==201); + case 254: /* literal_list ::= signed_literal */ yytestcase(yyruleno==254); + case 344: /* select_sublist ::= select_item */ yytestcase(yyruleno==344); + case 391: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==391); +{ yylhsminor.yy376 = createNodeList(pCxt, yymsp[0].minor.yy168); } + yymsp[0].minor.yy376 = yylhsminor.yy376; + break; + case 87: /* retention_list ::= retention_list NK_COMMA retention */ + case 117: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==117); + case 160: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==160); + case 193: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==193); + case 202: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==202); + case 255: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==255); + case 345: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==345); + case 392: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==392); +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-2].minor.yy376, yymsp[0].minor.yy168); } + yymsp[-2].minor.yy376 = yylhsminor.yy376; + break; + case 88: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy168 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 89: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 91: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==91); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy537, yymsp[-5].minor.yy168, yymsp[-3].minor.yy376, yymsp[-1].minor.yy376, yymsp[0].minor.yy168); } + break; + case 90: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy376); } + break; + case 92: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy376); } + break; + case 93: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy537, yymsp[0].minor.yy168); } + break; + case 94: /* cmd ::= ALTER TABLE alter_table_clause */ + case 95: /* cmd ::= ALTER STABLE alter_table_clause */ yytestcase(yyruleno==95); + case 233: /* cmd ::= query_expression */ yytestcase(yyruleno==233); +{ pCxt->pRootNode = yymsp[0].minor.yy168; } + break; + case 96: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy168 = createAlterTableOption(pCxt, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; + break; + case 97: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy168 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy393, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; + break; + case 98: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy168 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy168, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy393); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; + break; + case 99: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy168 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy393, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 94: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy104 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy104, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy129); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 100: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy168 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy393, &yymsp[0].minor.yy393); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 95: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy104 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 101: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy168 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy393, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 96: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy104 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy104, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 102: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy168 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy168, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy393); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 97: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ -{ yylhsminor.yy104 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy104, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104); } - yymsp[-5].minor.yy104 = yylhsminor.yy104; + case 103: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy168 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy393, yymsp[0].minor.yy224); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 98: /* multi_create_clause ::= create_subtable_clause */ - case 101: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==101); - case 108: /* column_def_list ::= column_def */ yytestcase(yyruleno==108); - case 151: /* col_name_list ::= col_name */ yytestcase(yyruleno==151); - case 184: /* func_name_list ::= func_name */ yytestcase(yyruleno==184); - case 193: /* func_list ::= func */ yytestcase(yyruleno==193); - case 246: /* literal_list ::= signed_literal */ yytestcase(yyruleno==246); - case 334: /* select_sublist ::= select_item */ yytestcase(yyruleno==334); - case 381: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==381); -{ yylhsminor.yy312 = createNodeList(pCxt, yymsp[0].minor.yy104); } - yymsp[0].minor.yy312 = yylhsminor.yy312; + case 104: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy168 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy168, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy393, &yymsp[0].minor.yy393); } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 99: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 102: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==102); -{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-1].minor.yy312, yymsp[0].minor.yy104); } - yymsp[-1].minor.yy312 = yylhsminor.yy312; + case 105: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ literal */ +{ yylhsminor.yy168 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy168, &yymsp[-2].minor.yy393, yymsp[0].minor.yy168); } + yymsp[-5].minor.yy168 = yylhsminor.yy168; break; - case 100: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy104 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy185, yymsp[-7].minor.yy104, yymsp[-5].minor.yy104, yymsp[-4].minor.yy312, yymsp[-1].minor.yy312); } - yymsp[-8].minor.yy104 = yylhsminor.yy104; + case 107: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 110: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==110); +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-1].minor.yy376, yymsp[0].minor.yy168); } + yymsp[-1].minor.yy376 = yylhsminor.yy376; break; - case 103: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy104 = createDropTableClause(pCxt, yymsp[-1].minor.yy185, yymsp[0].minor.yy104); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 108: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ +{ yylhsminor.yy168 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy537, yymsp[-7].minor.yy168, yymsp[-5].minor.yy168, yymsp[-4].minor.yy376, yymsp[-1].minor.yy376); } + yymsp[-8].minor.yy168 = yylhsminor.yy168; break; - case 104: /* specific_tags_opt ::= */ - case 135: /* tags_def_opt ::= */ yytestcase(yyruleno==135); - case 342: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==342); - case 359: /* group_by_clause_opt ::= */ yytestcase(yyruleno==359); - case 369: /* order_by_clause_opt ::= */ yytestcase(yyruleno==369); -{ yymsp[1].minor.yy312 = NULL; } + case 111: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy168 = createDropTableClause(pCxt, yymsp[-1].minor.yy537, yymsp[0].minor.yy168); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 105: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy312 = yymsp[-1].minor.yy312; } + case 112: /* specific_tags_opt ::= */ + case 143: /* tags_def_opt ::= */ yytestcase(yyruleno==143); + case 352: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==352); + case 369: /* group_by_clause_opt ::= */ yytestcase(yyruleno==369); + case 379: /* order_by_clause_opt ::= */ yytestcase(yyruleno==379); +{ yymsp[1].minor.yy376 = NULL; } break; - case 106: /* full_table_name ::= table_name */ -{ yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy129, NULL); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 113: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy376 = yymsp[-1].minor.yy376; } break; - case 107: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, NULL); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 114: /* full_table_name ::= table_name */ +{ yylhsminor.yy168 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy393, NULL); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 109: /* column_def_list ::= column_def_list NK_COMMA column_def */ - case 152: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==152); - case 185: /* func_name_list ::= func_name_list NK_COMMA col_name */ yytestcase(yyruleno==185); - case 194: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==194); - case 247: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==247); - case 335: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==335); - case 382: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==382); -{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, yymsp[0].minor.yy104); } - yymsp[-2].minor.yy312 = yylhsminor.yy312; + case 115: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy168 = createRealTableNode(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy393, NULL); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 110: /* column_def ::= column_name type_name */ -{ yylhsminor.yy104 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy336, NULL); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 118: /* column_def ::= column_name type_name */ +{ yylhsminor.yy168 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy393, yymsp[0].minor.yy224, NULL); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 111: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy104 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-2].minor.yy336, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 119: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy168 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy393, yymsp[-2].minor.yy224, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 112: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 120: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 113: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 121: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 114: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 122: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 115: /* type_name ::= INT */ - case 116: /* type_name ::= INTEGER */ yytestcase(yyruleno==116); -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_INT); } + case 123: /* type_name ::= INT */ + case 124: /* type_name ::= INTEGER */ yytestcase(yyruleno==124); +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 117: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 125: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 118: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 126: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 119: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 127: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 120: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 128: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 121: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 129: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 122: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 130: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 123: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 131: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 124: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 132: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 125: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UINT); } + case 133: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 126: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy336 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 134: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy224 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 127: /* type_name ::= JSON */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_JSON); } + case 135: /* type_name ::= JSON */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 128: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 136: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 129: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 137: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 130: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 138: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 131: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy336 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 139: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 132: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 140: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 133: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 141: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 134: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy336 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 142: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy224 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 136: /* tags_def_opt ::= tags_def */ - case 333: /* select_list ::= select_sublist */ yytestcase(yyruleno==333); -{ yylhsminor.yy312 = yymsp[0].minor.yy312; } - yymsp[0].minor.yy312 = yylhsminor.yy312; + case 144: /* tags_def_opt ::= tags_def */ + case 343: /* select_list ::= select_sublist */ yytestcase(yyruleno==343); +{ yylhsminor.yy376 = yymsp[0].minor.yy376; } + yymsp[0].minor.yy376 = yylhsminor.yy376; break; - case 137: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy312 = yymsp[-1].minor.yy312; } + case 145: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy376 = yymsp[-1].minor.yy376; } break; - case 138: /* table_options ::= */ -{ yymsp[1].minor.yy104 = createDefaultTableOptions(pCxt); } + case 146: /* table_options ::= */ +{ yymsp[1].minor.yy168 = createTableOptions(pCxt); } break; - case 139: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 147: /* table_options ::= table_options COMMENT NK_STRING */ +{ ((STableOptions*)yymsp[-2].minor.yy168)->pComments = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 140: /* table_options ::= table_options KEEP integer_list */ -{ yylhsminor.yy104 = setTableKeepOption(pCxt, yymsp[-2].minor.yy104, yymsp[0].minor.yy312); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 148: /* table_options ::= table_options KEEP integer_list */ +{ ((STableOptions*)yymsp[-2].minor.yy168)->pKeep = yymsp[0].minor.yy376; yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 141: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 149: /* table_options ::= table_options TTL NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy168)->pTtl = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 142: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy104 = setTableSmaOption(pCxt, yymsp[-4].minor.yy104, yymsp[-1].minor.yy312); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 150: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy168)->pSma = yymsp[-1].minor.yy376; yylhsminor.yy168 = yymsp[-4].minor.yy168; } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 143: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ -{ yylhsminor.yy104 = setTableRollupOption(pCxt, yymsp[-4].minor.yy104, yymsp[-1].minor.yy312); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + case 151: /* table_options ::= table_options ROLLUP NK_LP func_name_list NK_RP */ +{ ((STableOptions*)yymsp[-4].minor.yy168)->pFuncs = yymsp[-1].minor.yy376; yylhsminor.yy168 = yymsp[-4].minor.yy168; } + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 144: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ -{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_FILE_FACTOR, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 152: /* table_options ::= table_options FILE_FACTOR NK_FLOAT */ +{ ((STableOptions*)yymsp[-2].minor.yy168)->pFilesFactor = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 145: /* table_options ::= table_options DELAY NK_INTEGER */ -{ yylhsminor.yy104 = setTableOption(pCxt, yymsp[-2].minor.yy104, TABLE_OPTION_DELAY, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 153: /* table_options ::= table_options DELAY NK_INTEGER */ +{ ((STableOptions*)yymsp[-2].minor.yy168)->pDelay = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); yylhsminor.yy168 = yymsp[-2].minor.yy168; } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 146: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy104 = createDefaultAlterTableOptions(pCxt); yylhsminor.yy104 = setTableAlterOption(pCxt, yylhsminor.yy104, &yymsp[0].minor.yy253); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 154: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy168 = createTableOptions(pCxt); yylhsminor.yy168 = setTableAlterOption(pCxt, yylhsminor.yy168, &yymsp[0].minor.yy277); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 147: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy104 = setTableAlterOption(pCxt, yymsp[-1].minor.yy104, &yymsp[0].minor.yy253); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 155: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy168 = setTableAlterOption(pCxt, yymsp[-1].minor.yy168, &yymsp[0].minor.yy277); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 148: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy253.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } + case 156: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 149: /* alter_table_option ::= KEEP integer_list */ -{ yymsp[-1].minor.yy253.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy253.pKeep = yymsp[0].minor.yy312; } + case 157: /* alter_table_option ::= KEEP integer_list */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_KEEP; yymsp[-1].minor.yy277.pList = yymsp[0].minor.yy376; } break; - case 150: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy253.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy253.val = yymsp[0].minor.yy0; } + case 158: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy277.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy277.pVal = (SValueNode*)createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } break; - case 153: /* col_name ::= column_name */ -{ yylhsminor.yy104 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 161: /* col_name ::= column_name */ +{ yylhsminor.yy168 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy393); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 154: /* cmd ::= SHOW DNODES */ + case 162: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT, NULL, NULL); } break; - case 155: /* cmd ::= SHOW USERS */ + case 163: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT, NULL, NULL); } break; - case 156: /* cmd ::= SHOW DATABASES */ + case 164: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT, NULL, NULL); } break; - case 157: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } + case 165: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); } break; - case 158: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } + case 166: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); } break; - case 159: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy104, NULL); } + case 167: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy168, NULL); } break; - case 160: /* cmd ::= SHOW MNODES */ + case 168: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT, NULL, NULL); } break; - case 161: /* cmd ::= SHOW MODULES */ + case 169: /* cmd ::= SHOW MODULES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT, NULL, NULL); } break; - case 162: /* cmd ::= SHOW QNODES */ + case 170: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT, NULL, NULL); } break; - case 163: /* cmd ::= SHOW FUNCTIONS */ + case 171: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT, NULL, NULL); } break; - case 164: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } + case 172: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); } break; - case 165: /* cmd ::= SHOW STREAMS */ + case 173: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT, NULL, NULL); } break; - case 166: /* cmd ::= SHOW ACCOUNTS */ + case 174: /* cmd ::= SHOW ACCOUNTS */ { pCxt->valid = false; generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 167: /* cmd ::= SHOW APPS */ + case 175: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT, NULL, NULL); } break; - case 168: /* cmd ::= SHOW CONNECTIONS */ + case 176: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT, NULL, NULL); } break; - case 169: /* cmd ::= SHOW LICENCE */ + case 177: /* cmd ::= SHOW LICENCE */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT, NULL, NULL); } break; - case 170: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } + case 178: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy393); } break; - case 171: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy104); } + case 179: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy168); } break; - case 172: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy104); } + case 180: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy168); } break; - case 173: /* cmd ::= SHOW QUERIES */ + case 181: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT, NULL, NULL); } break; - case 174: /* cmd ::= SHOW SCORES */ + case 182: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT, NULL, NULL); } break; - case 175: /* cmd ::= SHOW TOPICS */ + case 183: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT, NULL, NULL); } break; - case 176: /* cmd ::= SHOW VARIABLES */ + case 184: /* cmd ::= SHOW VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLE_STMT, NULL, NULL); } break; - case 177: /* db_name_cond_opt ::= */ - case 182: /* from_db_opt ::= */ yytestcase(yyruleno==182); -{ yymsp[1].minor.yy104 = createDefaultDatabaseCondValue(pCxt); } + case 185: /* db_name_cond_opt ::= */ + case 190: /* from_db_opt ::= */ yytestcase(yyruleno==190); +{ yymsp[1].minor.yy168 = createDefaultDatabaseCondValue(pCxt); } break; - case 178: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy129); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 186: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy393); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 179: /* like_pattern_opt ::= */ - case 190: /* index_options ::= */ yytestcase(yyruleno==190); - case 340: /* where_clause_opt ::= */ yytestcase(yyruleno==340); - case 344: /* twindow_clause_opt ::= */ yytestcase(yyruleno==344); - case 349: /* sliding_opt ::= */ yytestcase(yyruleno==349); - case 351: /* fill_opt ::= */ yytestcase(yyruleno==351); - case 363: /* having_clause_opt ::= */ yytestcase(yyruleno==363); - case 371: /* slimit_clause_opt ::= */ yytestcase(yyruleno==371); - case 375: /* limit_clause_opt ::= */ yytestcase(yyruleno==375); -{ yymsp[1].minor.yy104 = NULL; } + case 187: /* like_pattern_opt ::= */ + case 198: /* index_options ::= */ yytestcase(yyruleno==198); + case 350: /* where_clause_opt ::= */ yytestcase(yyruleno==350); + case 354: /* twindow_clause_opt ::= */ yytestcase(yyruleno==354); + case 359: /* sliding_opt ::= */ yytestcase(yyruleno==359); + case 361: /* fill_opt ::= */ yytestcase(yyruleno==361); + case 373: /* having_clause_opt ::= */ yytestcase(yyruleno==373); + case 381: /* slimit_clause_opt ::= */ yytestcase(yyruleno==381); + case 385: /* limit_clause_opt ::= */ yytestcase(yyruleno==385); +{ yymsp[1].minor.yy168 = NULL; } break; - case 180: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 188: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 181: /* table_name_cond ::= table_name */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 189: /* table_name_cond ::= table_name */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy393); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 183: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } + case 191: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy393); } break; - case 186: /* func_name ::= function_name */ -{ yylhsminor.yy104 = createFunctionNode(pCxt, &yymsp[0].minor.yy129, NULL); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 194: /* func_name ::= function_name */ +{ yylhsminor.yy168 = createFunctionNode(pCxt, &yymsp[0].minor.yy393, NULL); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 187: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, NULL, yymsp[0].minor.yy104); } + case 195: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy537, &yymsp[-3].minor.yy393, &yymsp[-1].minor.yy393, NULL, yymsp[0].minor.yy168); } break; - case 188: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy185, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312, NULL); } + case 196: /* cmd ::= CREATE FULLTEXT INDEX not_exists_opt index_name ON table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, yymsp[-6].minor.yy537, &yymsp[-5].minor.yy393, &yymsp[-3].minor.yy393, yymsp[-1].minor.yy376, NULL); } break; - case 189: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); } + case 197: /* cmd ::= DROP INDEX exists_opt index_name ON table_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-3].minor.yy537, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy393); } break; - case 191: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ -{ yymsp[-8].minor.yy104 = createIndexOption(pCxt, yymsp[-6].minor.yy312, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL, yymsp[0].minor.yy104); } + case 199: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt */ +{ yymsp[-8].minor.yy168 = createIndexOption(pCxt, yymsp[-6].minor.yy376, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), NULL, yymsp[0].minor.yy168); } break; - case 192: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ -{ yymsp[-10].minor.yy104 = createIndexOption(pCxt, yymsp[-8].minor.yy312, releaseRawExprNode(pCxt, yymsp[-4].minor.yy104), releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[0].minor.yy104); } + case 200: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt */ +{ yymsp[-10].minor.yy168 = createIndexOption(pCxt, yymsp[-8].minor.yy376, releaseRawExprNode(pCxt, yymsp[-4].minor.yy168), releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), yymsp[0].minor.yy168); } break; - case 195: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy104 = createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 203: /* func ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy168 = createFunctionNode(pCxt, &yymsp[-3].minor.yy393, yymsp[-1].minor.yy376); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 196: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104, NULL); } + case 204: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy537, &yymsp[-2].minor.yy393, yymsp[0].minor.yy168, NULL); } break; - case 197: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ -{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy185, &yymsp[-2].minor.yy129, NULL, &yymsp[0].minor.yy129); } + case 205: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS db_name */ +{ pCxt->pRootNode = createCreateTopicStmt(pCxt, yymsp[-3].minor.yy537, &yymsp[-2].minor.yy393, NULL, &yymsp[0].minor.yy393); } break; - case 198: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy185, &yymsp[0].minor.yy129); } + case 206: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy537, &yymsp[0].minor.yy393); } break; - case 199: /* cmd ::= DESC full_table_name */ - case 200: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==200); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy104); } + case 207: /* cmd ::= DESC full_table_name */ + case 208: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==208); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy168); } break; - case 201: /* cmd ::= RESET QUERY CACHE */ + case 209: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 202: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy185, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } + case 210: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy537, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); } break; - case 204: /* analyze_opt ::= ANALYZE */ - case 212: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==212); - case 330: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==330); -{ yymsp[0].minor.yy185 = true; } + case 212: /* analyze_opt ::= ANALYZE */ + case 220: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==220); + case 340: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==340); +{ yymsp[0].minor.yy537 = true; } break; - case 205: /* explain_options ::= */ -{ yymsp[1].minor.yy104 = createDefaultExplainOptions(pCxt); } + case 213: /* explain_options ::= */ +{ yymsp[1].minor.yy168 = createDefaultExplainOptions(pCxt); } break; - case 206: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy104 = setExplainVerbose(pCxt, yymsp[-2].minor.yy104, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 214: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy168 = setExplainVerbose(pCxt, yymsp[-2].minor.yy168, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 207: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy104 = setExplainRatio(pCxt, yymsp[-2].minor.yy104, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 215: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy168 = setExplainRatio(pCxt, yymsp[-2].minor.yy168, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 208: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy312); } + case 216: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ +{ pCxt->pRootNode = createCompactStmt(pCxt, yymsp[-1].minor.yy376); } break; - case 209: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy185, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy336, yymsp[0].minor.yy196); } + case 217: /* cmd ::= CREATE agg_func_opt FUNCTION function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy537, &yymsp[-5].minor.yy393, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy224, yymsp[0].minor.yy508); } break; - case 210: /* cmd ::= DROP FUNCTION function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy129); } + case 218: /* cmd ::= DROP FUNCTION function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, &yymsp[0].minor.yy393); } break; - case 213: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy196 = 0; } + case 221: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy508 = 0; } break; - case 214: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy196 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } + case 222: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy508 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 215: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy129, &yymsp[-2].minor.yy129, yymsp[0].minor.yy104); } + case 223: /* cmd ::= CREATE STREAM stream_name INTO table_name AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, &yymsp[-4].minor.yy393, &yymsp[-2].minor.yy393, yymsp[0].minor.yy168); } break; - case 216: /* cmd ::= DROP STREAM stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy129); } + case 224: /* cmd ::= DROP STREAM stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, &yymsp[0].minor.yy393); } break; - case 217: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 225: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 218: /* cmd ::= KILL QUERY NK_INTEGER */ + case 226: /* cmd ::= KILL QUERY NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_QUERY_STMT, &yymsp[0].minor.yy0); } break; - case 219: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 227: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 220: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy312); } + case 228: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy376); } break; - case 221: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 229: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 222: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy312 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - break; - case 224: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy129); } - break; - case 226: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 227: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 228: /* literal ::= NK_STRING */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 229: /* literal ::= NK_BOOL */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 230: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; - break; - case 231: /* literal ::= duration_literal */ - case 240: /* signed_literal ::= signed */ yytestcase(yyruleno==240); - case 258: /* expression ::= literal */ yytestcase(yyruleno==258); - case 259: /* expression ::= pseudo_column */ yytestcase(yyruleno==259); - case 260: /* expression ::= column_reference */ yytestcase(yyruleno==260); - case 263: /* expression ::= subquery */ yytestcase(yyruleno==263); - case 303: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==303); - case 307: /* boolean_primary ::= predicate */ yytestcase(yyruleno==307); - case 309: /* common_expression ::= expression */ yytestcase(yyruleno==309); - case 310: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==310); - case 312: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==312); - case 314: /* table_reference ::= table_primary */ yytestcase(yyruleno==314); - case 315: /* table_reference ::= joined_table */ yytestcase(yyruleno==315); - case 319: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==319); - case 366: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==366); - case 368: /* query_primary ::= query_specification */ yytestcase(yyruleno==368); -{ yylhsminor.yy104 = yymsp[0].minor.yy104; } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 232: /* literal ::= NULL */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 233: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 234: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 235: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 236: /* signed ::= NK_MINUS NK_INTEGER */ + case 230: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy376 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + break; + case 232: /* cmd ::= SYNCDB db_name REPLICA */ +{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy393); } + break; + case 234: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 235: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 236: /* literal ::= NK_STRING */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 237: /* literal ::= NK_BOOL */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 238: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; + break; + case 239: /* literal ::= duration_literal */ + case 248: /* signed_literal ::= signed */ yytestcase(yyruleno==248); + case 268: /* expression ::= literal */ yytestcase(yyruleno==268); + case 269: /* expression ::= pseudo_column */ yytestcase(yyruleno==269); + case 270: /* expression ::= column_reference */ yytestcase(yyruleno==270); + case 273: /* expression ::= subquery */ yytestcase(yyruleno==273); + case 313: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==313); + case 317: /* boolean_primary ::= predicate */ yytestcase(yyruleno==317); + case 319: /* common_expression ::= expression */ yytestcase(yyruleno==319); + case 320: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==320); + case 322: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==322); + case 324: /* table_reference ::= table_primary */ yytestcase(yyruleno==324); + case 325: /* table_reference ::= joined_table */ yytestcase(yyruleno==325); + case 329: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==329); + case 376: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==376); + case 378: /* query_primary ::= query_specification */ yytestcase(yyruleno==378); +{ yylhsminor.yy168 = yymsp[0].minor.yy168; } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 240: /* literal ::= NULL */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 241: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 242: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 243: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 244: /* 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.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 237: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 245: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 238: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 246: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 239: /* signed ::= NK_MINUS NK_FLOAT */ + case 247: /* 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.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 241: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 249: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 242: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 250: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 243: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 251: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 244: /* signed_literal ::= duration_literal */ - case 380: /* search_condition ::= common_expression */ yytestcase(yyruleno==380); -{ yylhsminor.yy104 = releaseRawExprNode(pCxt, yymsp[0].minor.yy104); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + case 252: /* signed_literal ::= duration_literal */ + case 390: /* search_condition ::= common_expression */ yytestcase(yyruleno==390); +{ yylhsminor.yy168 = releaseRawExprNode(pCxt, yymsp[0].minor.yy168); } + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 245: /* signed_literal ::= NULL */ -{ yymsp[0].minor.yy104 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } + case 253: /* signed_literal ::= NULL */ +{ yymsp[0].minor.yy168 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, NULL); } break; - case 261: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy312)); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 271: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy393, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy393, yymsp[-1].minor.yy376)); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 262: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 272: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy393, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy393, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 264: /* expression ::= NK_LP expression NK_RP */ - case 308: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==308); -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 274: /* expression ::= NK_LP expression NK_RP */ + case 318: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==318); +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168)); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 265: /* expression ::= NK_PLUS expression */ + case 275: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 266: /* expression ::= NK_MINUS expression */ + case 276: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy168), NULL)); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 267: /* expression ::= expression NK_PLUS expression */ + case 277: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 268: /* expression ::= expression NK_MINUS expression */ + case 278: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 269: /* expression ::= expression NK_STAR expression */ + case 279: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 270: /* expression ::= expression NK_SLASH expression */ + case 280: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 271: /* expression ::= expression NK_REM expression */ + case 281: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 272: /* expression_list ::= expression */ -{ yylhsminor.yy312 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } - yymsp[0].minor.yy312 = yylhsminor.yy312; - break; - case 273: /* expression_list ::= expression_list NK_COMMA expression */ -{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, releaseRawExprNode(pCxt, yymsp[0].minor.yy104)); } - yymsp[-2].minor.yy312 = yylhsminor.yy312; - break; - case 274: /* column_reference ::= column_name */ -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 275: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; - break; - case 276: /* pseudo_column ::= NOW */ - case 277: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==277); - case 278: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==278); - case 279: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==279); - case 280: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==280); - case 281: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==281); - case 282: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==282); - case 283: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==283); -{ yylhsminor.yy104 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy104 = yylhsminor.yy104; - break; - case 284: /* predicate ::= expression compare_op expression */ - case 289: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==289); + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 282: /* expression_list ::= expression */ +{ yylhsminor.yy376 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); } + yymsp[0].minor.yy376 = yylhsminor.yy376; + break; + case 283: /* expression_list ::= expression_list NK_COMMA expression */ +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-2].minor.yy376, releaseRawExprNode(pCxt, yymsp[0].minor.yy168)); } + yymsp[-2].minor.yy376 = yylhsminor.yy376; + break; + case 284: /* column_reference ::= column_name */ +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy393, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy393)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 285: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy393, createColumnNode(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy393)); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; + break; + case 286: /* pseudo_column ::= NOW */ + case 287: /* pseudo_column ::= ROWTS */ yytestcase(yyruleno==287); + case 288: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==288); + case 289: /* pseudo_column ::= QSTARTTS */ yytestcase(yyruleno==289); + case 290: /* pseudo_column ::= QENDTS */ yytestcase(yyruleno==290); + case 291: /* pseudo_column ::= WSTARTTS */ yytestcase(yyruleno==291); + case 292: /* pseudo_column ::= WENDTS */ yytestcase(yyruleno==292); + case 293: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==293); +{ yylhsminor.yy168 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy168 = yylhsminor.yy168; + break; + case 294: /* predicate ::= expression compare_op expression */ + case 299: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==299); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy436, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 285: /* predicate ::= expression BETWEEN expression AND expression */ + case 295: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy104), releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy168), releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-4].minor.yy104 = yylhsminor.yy104; + yymsp[-4].minor.yy168 = yylhsminor.yy168; break; - case 286: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 296: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[-5].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-5].minor.yy104 = yylhsminor.yy104; + yymsp[-5].minor.yy168 = yylhsminor.yy168; break; - case 287: /* predicate ::= expression IS NULL */ + case 297: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), NULL)); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 288: /* predicate ::= expression IS NOT NULL */ + case 298: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), NULL)); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 290: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } + case 300: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy436 = OP_TYPE_LOWER_THAN; } break; - case 291: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } + case 301: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy436 = OP_TYPE_GREATER_THAN; } break; - case 292: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } + case 302: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy436 = OP_TYPE_LOWER_EQUAL; } break; - case 293: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } + case 303: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy436 = OP_TYPE_GREATER_EQUAL; } break; - case 294: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } + case 304: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy436 = OP_TYPE_NOT_EQUAL; } break; - case 295: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } + case 305: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy436 = OP_TYPE_EQUAL; } break; - case 296: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy60 = OP_TYPE_LIKE; } + case 306: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy436 = OP_TYPE_LIKE; } break; - case 297: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } + case 307: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy436 = OP_TYPE_NOT_LIKE; } break; - case 298: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy60 = OP_TYPE_MATCH; } + case 308: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy436 = OP_TYPE_MATCH; } break; - case 299: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } + case 309: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy436 = OP_TYPE_NMATCH; } break; - case 300: /* in_op ::= IN */ -{ yymsp[0].minor.yy60 = OP_TYPE_IN; } + case 310: /* in_op ::= IN */ +{ yymsp[0].minor.yy436 = OP_TYPE_IN; } break; - case 301: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } + case 311: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy436 = OP_TYPE_NOT_IN; } break; - case 302: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 312: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy376)); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 304: /* boolean_value_expression ::= NOT boolean_primary */ + case 314: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy168), NULL)); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 305: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 315: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 306: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 316: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy104); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy168); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 311: /* from_clause ::= FROM table_reference_list */ - case 341: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==341); - case 364: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==364); -{ yymsp[-1].minor.yy104 = yymsp[0].minor.yy104; } + case 321: /* from_clause ::= FROM table_reference_list */ + case 351: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==351); + case 374: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==374); +{ yymsp[-1].minor.yy168 = yymsp[0].minor.yy168; } break; - case 313: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy104 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy104, yymsp[0].minor.yy104, NULL); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 323: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy168 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy168, yymsp[0].minor.yy168, NULL); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 316: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy104 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 326: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy168 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy393, &yymsp[0].minor.yy393); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 317: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy104 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 327: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy168 = createRealTableNode(pCxt, &yymsp[-3].minor.yy393, &yymsp[-1].minor.yy393, &yymsp[0].minor.yy393); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 318: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy104 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 328: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy168 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168), &yymsp[0].minor.yy393); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 320: /* alias_opt ::= */ -{ yymsp[1].minor.yy129 = nil_token; } + case 330: /* alias_opt ::= */ +{ yymsp[1].minor.yy393 = nil_token; } break; - case 321: /* alias_opt ::= table_alias */ -{ yylhsminor.yy129 = yymsp[0].minor.yy129; } - yymsp[0].minor.yy129 = yylhsminor.yy129; + case 331: /* alias_opt ::= table_alias */ +{ yylhsminor.yy393 = yymsp[0].minor.yy393; } + yymsp[0].minor.yy393 = yylhsminor.yy393; break; - case 322: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } + case 332: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy393 = yymsp[0].minor.yy393; } break; - case 323: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 324: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==324); -{ yymsp[-2].minor.yy104 = yymsp[-1].minor.yy104; } + case 333: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 334: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==334); +{ yymsp[-2].minor.yy168 = yymsp[-1].minor.yy168; } break; - case 325: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy104 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy104, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); } - yymsp[-5].minor.yy104 = yylhsminor.yy104; + case 335: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy168 = createJoinTableNode(pCxt, yymsp[-4].minor.yy596, yymsp[-5].minor.yy168, yymsp[-2].minor.yy168, yymsp[0].minor.yy168); } + yymsp[-5].minor.yy168 = yylhsminor.yy168; break; - case 326: /* join_type ::= */ -{ yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } + case 336: /* join_type ::= */ +{ yymsp[1].minor.yy596 = JOIN_TYPE_INNER; } break; - case 327: /* join_type ::= INNER */ -{ yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } + case 337: /* join_type ::= INNER */ +{ yymsp[0].minor.yy596 = JOIN_TYPE_INNER; } break; - case 328: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 338: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy104 = createSelectStmt(pCxt, yymsp[-7].minor.yy185, yymsp[-6].minor.yy312, yymsp[-5].minor.yy104); - yymsp[-8].minor.yy104 = addWhereClause(pCxt, yymsp[-8].minor.yy104, yymsp[-4].minor.yy104); - yymsp[-8].minor.yy104 = addPartitionByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-3].minor.yy312); - yymsp[-8].minor.yy104 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy104, yymsp[-2].minor.yy104); - yymsp[-8].minor.yy104 = addGroupByClause(pCxt, yymsp[-8].minor.yy104, yymsp[-1].minor.yy312); - yymsp[-8].minor.yy104 = addHavingClause(pCxt, yymsp[-8].minor.yy104, yymsp[0].minor.yy104); + yymsp[-8].minor.yy168 = createSelectStmt(pCxt, yymsp[-7].minor.yy537, yymsp[-6].minor.yy376, yymsp[-5].minor.yy168); + yymsp[-8].minor.yy168 = addWhereClause(pCxt, yymsp[-8].minor.yy168, yymsp[-4].minor.yy168); + yymsp[-8].minor.yy168 = addPartitionByClause(pCxt, yymsp[-8].minor.yy168, yymsp[-3].minor.yy376); + yymsp[-8].minor.yy168 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy168, yymsp[-2].minor.yy168); + yymsp[-8].minor.yy168 = addGroupByClause(pCxt, yymsp[-8].minor.yy168, yymsp[-1].minor.yy376); + yymsp[-8].minor.yy168 = addHavingClause(pCxt, yymsp[-8].minor.yy168, yymsp[0].minor.yy168); } break; - case 331: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy185 = false; } + case 341: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy537 = false; } break; - case 332: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy312 = NULL; } + case 342: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy376 = NULL; } break; - case 336: /* select_item ::= common_expression */ + case 346: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy104); - yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy168); + yylhsminor.yy168 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy168), &t); } - yymsp[0].minor.yy104 = yylhsminor.yy104; + yymsp[0].minor.yy168 = yylhsminor.yy168; break; - case 337: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104), &yymsp[0].minor.yy129); } - yymsp[-1].minor.yy104 = yylhsminor.yy104; + case 347: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy168 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168), &yymsp[0].minor.yy393); } + yymsp[-1].minor.yy168 = yylhsminor.yy168; break; - case 338: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy104 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), &yymsp[0].minor.yy129); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 348: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy168 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), &yymsp[0].minor.yy393); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 339: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy104 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 349: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy168 = createColumnNode(pCxt, &yymsp[-2].minor.yy393, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 343: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 360: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==360); - case 370: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==370); -{ yymsp[-2].minor.yy312 = yymsp[0].minor.yy312; } + case 353: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 370: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==370); + case 380: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==380); +{ yymsp[-2].minor.yy376 = yymsp[0].minor.yy376; } break; - case 345: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy104 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } + case 355: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy168 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), releaseRawExprNode(pCxt, yymsp[-1].minor.yy168)); } break; - case 346: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy104 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy104)); } + case 356: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy168 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy168)); } break; - case 347: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), NULL, yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } + case 357: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy168 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), NULL, yymsp[-1].minor.yy168, yymsp[0].minor.yy168); } break; - case 348: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy104 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy104), releaseRawExprNode(pCxt, yymsp[-3].minor.yy104), yymsp[-1].minor.yy104, yymsp[0].minor.yy104); } + case 358: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy168 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy168), releaseRawExprNode(pCxt, yymsp[-3].minor.yy168), yymsp[-1].minor.yy168, yymsp[0].minor.yy168); } break; - case 350: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy104 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy104); } + case 360: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy168 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy168); } break; - case 352: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy104 = createFillNode(pCxt, yymsp[-1].minor.yy550, NULL); } + case 362: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy168 = createFillNode(pCxt, yymsp[-1].minor.yy382, NULL); } break; - case 353: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy104 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy312)); } + case 363: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy168 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy376)); } break; - case 354: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy550 = FILL_MODE_NONE; } + case 364: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy382 = FILL_MODE_NONE; } break; - case 355: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy550 = FILL_MODE_PREV; } + case 365: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy382 = FILL_MODE_PREV; } break; - case 356: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy550 = FILL_MODE_NULL; } + case 366: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy382 = FILL_MODE_NULL; } break; - case 357: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy550 = FILL_MODE_LINEAR; } + case 367: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy382 = FILL_MODE_LINEAR; } break; - case 358: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy550 = FILL_MODE_NEXT; } + case 368: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy382 = FILL_MODE_NEXT; } break; - case 361: /* group_by_list ::= expression */ -{ yylhsminor.yy312 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[0].minor.yy312 = yylhsminor.yy312; + case 371: /* group_by_list ::= expression */ +{ yylhsminor.yy376 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } + yymsp[0].minor.yy376 = yylhsminor.yy376; break; - case 362: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy312 = addNodeToList(pCxt, yymsp[-2].minor.yy312, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy104))); } - yymsp[-2].minor.yy312 = yylhsminor.yy312; + case 372: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy376 = addNodeToList(pCxt, yymsp[-2].minor.yy376, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy168))); } + yymsp[-2].minor.yy376 = yylhsminor.yy376; break; - case 365: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 375: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy104 = addOrderByClause(pCxt, yymsp[-3].minor.yy104, yymsp[-2].minor.yy312); - yylhsminor.yy104 = addSlimitClause(pCxt, yylhsminor.yy104, yymsp[-1].minor.yy104); - yylhsminor.yy104 = addLimitClause(pCxt, yylhsminor.yy104, yymsp[0].minor.yy104); + yylhsminor.yy168 = addOrderByClause(pCxt, yymsp[-3].minor.yy168, yymsp[-2].minor.yy376); + yylhsminor.yy168 = addSlimitClause(pCxt, yylhsminor.yy168, yymsp[-1].minor.yy168); + yylhsminor.yy168 = addLimitClause(pCxt, yylhsminor.yy168, yymsp[0].minor.yy168); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 367: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy104 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy104, yymsp[0].minor.yy104); } - yymsp[-3].minor.yy104 = yylhsminor.yy104; + case 377: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy168 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy168, yymsp[0].minor.yy168); } + yymsp[-3].minor.yy168 = yylhsminor.yy168; break; - case 372: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 376: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==376); -{ yymsp[-1].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 382: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 386: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==386); +{ yymsp[-1].minor.yy168 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 373: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 377: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==377); -{ yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 383: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 387: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==387); +{ yymsp[-3].minor.yy168 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 374: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 378: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==378); -{ yymsp[-3].minor.yy104 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 384: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 388: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==388); +{ yymsp[-3].minor.yy168 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 379: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy104 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy104); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 389: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy168 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy168); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 383: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy104 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy104), yymsp[-1].minor.yy354, yymsp[0].minor.yy489); } - yymsp[-2].minor.yy104 = yylhsminor.yy104; + case 393: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy168 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy168), yymsp[-1].minor.yy554, yymsp[0].minor.yy81); } + yymsp[-2].minor.yy168 = yylhsminor.yy168; break; - case 384: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy354 = ORDER_ASC; } + case 394: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy554 = ORDER_ASC; } break; - case 385: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy354 = ORDER_ASC; } + case 395: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy554 = ORDER_ASC; } break; - case 386: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy354 = ORDER_DESC; } + case 396: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy554 = ORDER_DESC; } break; - case 387: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy489 = NULL_ORDER_DEFAULT; } + case 397: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy81 = NULL_ORDER_DEFAULT; } break; - case 388: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy489 = NULL_ORDER_FIRST; } + case 398: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy81 = NULL_ORDER_FIRST; } break; - case 389: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy489 = NULL_ORDER_LAST; } + case 399: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy81 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parserAstTest.cpp b/source/libs/parser/test/parserAstTest.cpp index 8b19701c52d921572ce86b51677b81b1e6d417fc..87582f9eba6e11c5c79c94f40fc30b8f72f3506b 100644 --- a/source/libs/parser/test/parserAstTest.cpp +++ b/source/libs/parser/test/parserAstTest.cpp @@ -446,6 +446,12 @@ TEST_F(ParserTest, createDatabase) { "RETENTIONS '15s:7d,1m:21d,15m:5y'" ); ASSERT_TRUE(run()); + + bind("create database if not exists wxy_db " + "DAYS 100m " + "KEEP 200m,300h,400d " + ); + ASSERT_TRUE(run()); } TEST_F(ParserTest, alterDatabase) { diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 819eb6d699320d5797c7fffe5289775911c46b85..6832cdce7a2b38fb44bbe0e32ff7d25bc88ea676 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -701,7 +701,7 @@ static int32_t createDistinctLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSe // rewrite the expression in subsequent clauses if (TSDB_CODE_SUCCESS == code) { - code = rewriteExpr(pAgg->pGroupKeys, pSelect, SQL_CLAUSE_SELECT); + code = rewriteExpr(pAgg->pGroupKeys, pSelect, SQL_CLAUSE_DISTINCT); } // set the output diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 965c5c957935f4a4a361caf2b12b093aa02ccaf5..0c2cffa399844bb218b16ed1b7b058eec16e29f8 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -928,8 +928,12 @@ static int32_t createSortPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren if (TSDB_CODE_SUCCESS == code) { code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pSortKeys, &pSort->pSortKeys); + } + + if (TSDB_CODE_SUCCESS == code) { + code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pSortLogicNode->node.pTargets, &pSort->pTargets); if (TSDB_CODE_SUCCESS == code) { - code = addDataBlockSlots(pCxt, pSort->pSortKeys, pSort->node.pOutputDataBlockDesc); + code = addDataBlockSlots(pCxt, pSort->pTargets, pSort->node.pOutputDataBlockDesc); } } @@ -963,8 +967,12 @@ static int32_t createPartitionPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi if (TSDB_CODE_SUCCESS == code) { code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPartitionKeys, &pPart->pPartitionKeys); + } + + if (TSDB_CODE_SUCCESS == code) { + code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPartLogicNode->node.pTargets, &pPart->pTargets); if (TSDB_CODE_SUCCESS == code) { - code = addDataBlockSlots(pCxt, pPart->pPartitionKeys, pPart->node.pOutputDataBlockDesc); + code = addDataBlockSlots(pCxt, pPart->pTargets, pPart->node.pOutputDataBlockDesc); } } diff --git a/source/libs/planner/test/plannerTest.cpp b/source/libs/planner/test/plannerTest.cpp index 7f79fc6a5a4750b746591888796acaf2321f0d25..5f84eec36a5f922bb5ac539c770515da3330892b 100644 --- a/source/libs/planner/test/plannerTest.cpp +++ b/source/libs/planner/test/plannerTest.cpp @@ -254,6 +254,9 @@ TEST_F(PlannerTest, orderBy) { bind("SELECT * FROM t1 order by c1 + 10, c2"); ASSERT_TRUE(run()); + + bind("SELECT * FROM t1 order by c1 desc nulls first"); + ASSERT_TRUE(run()); } TEST_F(PlannerTest, distinct) { diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 576bf7de12d0a481c816d5fcb26b7cd111201826..716a3d8283ab9105a8501d7283a91da2771c460d 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -31,6 +31,7 @@ ./test.sh -f tsim/query/interval.sim ./test.sh -f tsim/query/interval-offset.sim ./test.sh -f tsim/query/scalarFunction.sim +./test.sh -f tsim/query/charScalarFunction.sim # ---- show ./test.sh -f tsim/show/basic.sim diff --git a/tests/script/tsim/query/charScalarFunction.sim b/tests/script/tsim/query/charScalarFunction.sim new file mode 100644 index 0000000000000000000000000000000000000000..d7b1139b5ba714c0f3be467837588b41fbb73885 --- /dev/null +++ b/tests/script/tsim/query/charScalarFunction.sim @@ -0,0 +1,518 @@ +#### length, char_length, lower, upper, ltrim, rtrim, concat, concat_ws, substr. + +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 +system sh/exec.sh -n dnode1 -s start + +$loop_cnt = 0 +check_dnode_ready: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi +sql show dnodes +print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 +if $data00 != 1 then + return -1 +endi +if $data04 != ready then + goto check_dnode_ready +endi + +sql connect + +$vgroups = 4 +$dbNamme = db + +print =============== create database $dbNamme vgroups $vgroups +sql create database $dbNamme vgroups $vgroups +sql show databases +print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 +print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19 +#print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29 + +sql use $dbNamme + +print =============== create super table +sql create table stb (ts timestamp, c1 binary(128), c2 nchar(128)) tags (t1 binary(128), t2 nchar(128)) + +print =============== create child table and normal table, insert data +sql create table ctb0 using stb tags("tag-binary-0" , "tag-nchar-0" ) +sql create table ntb0 (ts timestamp, c1 binary(128), c2 nchar(128)) +sql insert into ctb0 values ("2022-01-01 00:00:00.000" , "lenByte0=11" , "lenByte0=44" ) +sql insert into ntb0 values ("2022-01-01 00:00:00.000" , "lenByte0=11" , "lenByte0=44" ) +sql insert into ctb0 values ("2022-01-01 00:00:00.001" , "lenByte01=12" , "lenByte01=48" ) +sql insert into ntb0 values ("2022-01-01 00:00:00.001" , "lenByte01=12" , "lenByte01=48" ) +sql insert into ctb0 values ("2022-01-01 00:00:00.002" , "lenChar01=12" , "lenChar01=48" ) +sql insert into ntb0 values ("2022-01-01 00:00:00.002" , "lenChar01=12" , "lenChar01=48" ) +sql insert into ctb0 values ("2022-01-01 00:00:00.003" , "lenChar0001=14" , "lenChar0001=56" ) +sql insert into ntb0 values ("2022-01-01 00:00:00.003" , "lenChar0001=14" , "lenChar0001=56" ) + +sql create table ctb1 using stb tags("tag-binary-1" , "tag-nchar-1" ) +sql create table ntb1 (ts timestamp, c1 binary(128), c2 nchar(128)) +sql insert into ctb1 values ("2022-01-01 00:00:00.000" , "ABCD1234" , "ABCD1234" ) +sql insert into ntb1 values ("2022-01-01 00:00:00.000" , "ABCD1234" , "ABCD1234" ) +sql insert into ctb1 values ("2022-01-01 00:00:00.001" , "AaBbCcDd1234" , "AaBbCcDd1234" ) +sql insert into ntb1 values ("2022-01-01 00:00:00.001" , "AaBbCcDd1234" , "AaBbCcDd1234" ) + +sql create table ctb2 using stb tags("tag-binary-2" , "tag-nchar-2" ) +sql create table ntb2 (ts timestamp, c1 binary(128), c2 nchar(128)) +sql insert into ctb2 values ("2022-01-01 00:00:00.000" , "abcd1234" , "abcd1234" ) +sql insert into ntb2 values ("2022-01-01 00:00:00.000" , "abcd1234" , "abcd1234" ) +sql insert into ctb2 values ("2022-01-01 00:00:00.001" , "AaBbCcDd1234" , "AaBbCcDd1234" ) +sql insert into ntb2 values ("2022-01-01 00:00:00.001" , "AaBbCcDd1234" , "AaBbCcDd1234" ) + +sql create table ctb3 using stb tags("tag-binary-3" , "tag-nchar-3" ) +sql create table ntb3 (ts timestamp, c1 binary(128), c2 nchar(128)) +sql insert into ctb3 values ("2022-01-01 00:00:00.000" , " abcd 1234 " , " abcd 1234 " ) +sql insert into ntb3 values ("2022-01-01 00:00:00.000" , " abcd 1234 " , " abcd 1234 " ) + +sql create table stb2 (ts timestamp, c1 binary(128), c2 nchar(128), c3 binary(128), c4 nchar(128)) tags (t1 binary(128), t2 nchar(128), t3 binary(128), t4 nchar(128)) +sql create table ctb4 using stb2 tags("tag-binary-4" , "tag-nchar-4", "tag-binary-4" , "tag-nchar-4") +sql create table ntb4 (ts timestamp, c1 binary(128), c2 nchar(128), c3 binary(128), c4 nchar(128)) +sql insert into ctb4 values ("2022-01-01 00:00:00.000" , " ab 12 " , " ab 12 " , " cd 34 " , " cd 34 " ) +sql insert into ntb4 values ("2022-01-01 00:00:00.000" , " ab 12 " , " ab 12 " , " cd 34 " , " cd 34 " ) + +sql create table ctb5 using stb tags("tag-binary-5" , "tag-nchar-5") +sql create table ntb5 (ts timestamp, c1 binary(128), c2 nchar(128)) +sql insert into ctb5 values ("2022-01-01 00:00:00.000" , "0123456789" , "0123456789" ) +sql insert into ntb5 values ("2022-01-01 00:00:00.000" , "0123456789" , "0123456789" ) +sql insert into ctb5 values ("2022-01-01 00:00:00.001" , NULL , NULL ) +sql insert into ntb5 values ("2022-01-01 00:00:00.001" , NULL , NULL ) + +$loop_test = 0 +loop_test_pos: + +print ====> length +print ====> select c1, length(c1), c2, length(c2) from ctb0 +sql select c1, length(c1), c2, length(c2) from ctb0 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data01 != 11 then + return -1 +endi +if $data03 != 44 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data13 != 48 then + return -1 +endi + +print ====> select c1, length(c1), c2, length(c2) from ntb0 +sql select c1, length(c1), c2, length(c2) from ntb0 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data01 != 11 then + return -1 +endi +if $data03 != 44 then + return -1 +endi +if $data11 != 12 then + return -1 +endi +if $data13 != 48 then + return -1 +endi + +print ====> select length("abcd1234"), char_length("abcd1234=-+*") from ntb0 +sql select length("abcd1234"), char_length("abcd1234=-+*") from ntb0 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data00 != 8 then + return -1 +endi +if $data01 != 12 then + return -1 +endi + +#sql_error select c1, length(t1), c2, length(t2) from ctb0 + +print ====> char_length +print ====> select c1, char_length(c1), c2, char_length(c2) from ctb0 +sql select c1, char_length(c1), c2, char_length(c2) from ctb0 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data23 != 12 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data33 != 14 then + return -1 +endi + +print ====> select c1, char_length(c1), c2, char_length(c2) from ntb0 +sql select c1, char_length(c1), c2, char_length(c2) from ntb0 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +print ====> $data20 $data21 $data22 $data23 $data24 $data25 +print ====> $data30 $data31 $data32 $data33 $data34 $data35 +if $rows != 4 then + return -1 +endi +if $data21 != 12 then + return -1 +endi +if $data23 != 12 then + return -1 +endi +if $data31 != 14 then + return -1 +endi +if $data33 != 14 then + return -1 +endi + +#sql_error select c1, char_length(t1), c2, char_length(t2) from ctb0 + +print ====> lower +sql select c1, lower(c1), c2, lower(c2), lower("abcdEFGH=-*&%") from ntb1 +print ====> select c1, lower(c1), c2, lower(c2), lower("abcdEFGH=-*&%") from ctb1 +sql select c1, lower(c1), c2, lower(c2), lower("abcdEFGH=-*&%") from ctb1 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data01 != abcd1234 then + return -1 +endi +if $data03 != abcd1234 then + return -1 +endi +if $data04 != abcdefgh=-*&% then + return -1 +endi +if $data11 != aabbccdd1234 then + return -1 +endi +if $data13 != aabbccdd1234 then + return -1 +endi +if $data14 != abcdefgh=-*&% then + return -1 +endi + +#sql_error select c1, lower(t1), c2, lower(t2) from ctb1 + +print ====> upper +sql select c1, upper(c1), c2, upper(c2), upper("abcdEFGH=-*&%") from ntb2 +print ====> select c1, upper(c1), c2, upper(c2), upper("abcdEFGH=-*&%") from ctb2 +sql select c1, upper(c1), c2, upper(c2), upper("abcdEFGH=-*&%") from ctb2 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 2 then + return -1 +endi +if $data01 != ABCD1234 then + return -1 +endi +if $data03 != ABCD1234 then + return -1 +endi +if $data04 != ABCDEFGH=-*&% then + return -1 +endi +if $data11 != AABBCCDD1234 then + return -1 +endi +if $data13 != AABBCCDD1234 then + return -1 +endi +if $data14 != ABCDEFGH=-*&% then + return -1 +endi + +#sql_error select c1, upper(t1), c2, upper(t2) from ctb2 + +print ====> ltrim +sql select c1, ltrim(c1), c2, ltrim(c2), ltrim(" abcdEFGH =-*&% ") from ntb3 +print ====> select c1, ltrim(c1), c2, ltrim(c2), ltrim(" abcdEFGH =-*&% ") from ctb3 +sql select c1, ltrim(c1), c2, ltrim(c2), ltrim(" abcdEFGH =-*&% ") from ctb3 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 1 then + return -1 +endi +if $data01 != @abcd 1234 @ then + return -1 +endi +if $data03 != @abcd 1234 @ then + return -1 +endi +if $data04 != @abcdEFGH =-*&% @ then + return -1 +endi + +#sql_error select c1, ltrim(t1), c2, ltrim(t2) from ctb3 + + +#print ====> rtrim +#sql select c1, rtrim(c1), c2, rtrim(c2), rtrim(" abcdEFGH =-*&% ") from ntb3 +#print ====> select c1, rtrim(c1), c2, rtrim(c2), rtrim(" abcdEFGH =-*&% ") from ctb3 +#sql select c1, rtrim(c1), c2, rtrim(c2), rtrim(" abcdEFGH =-*&% ") from ctb3 +#print ====> rows: $rows +#print ====> [ $data00 ] [ $data01 ] [ $data02 ] [ $data03 ] [ $data04 ] [ $data05 ] [ $data06 ] +#print ====> $data10 $data11 $data12 $data13 $data14 $data15 +#if $rows != 1 then +# return -1 +#endi +#if $data01 != @ abcd 1234@ then +# return -1 +#endi +#if $data03 != @ abcd 1234@ then +# return -1 +#endi +#if $data04 != @ abcdEFGH =-*&%@ then +# return -1 +#endi + +#sql_error select c1, rtrim(t1), c2, rtrim(t2) from ctb3 + +print ====> concat +sql select c1, c3, concat(c1, c3), c2, c4, concat(c2, c4), concat("binary+", c1, c3), concat("nchar+", c2, c4) from ntb4 +print ====> select c1, c3, concat(c1, c3), c2, c4, concat(c2, c4), concat("binary+", c1, c3), concat("nchar+", c2, c4) from ctb4 +sql select c1, c3, concat(c1, c3), c2, c4, concat(c2, c4), concat("binary+", c1, c3), concat("nchar+", c2, c4) from ctb4 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 $data06 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $rows != 1 then + return -1 +endi +if $data02 != @ ab 12 cd 34 @ then + return -1 +endi +if $data05 != @ ab 12 cd 34 @ then + return -1 +endi +if $data06 != @binary+ ab 12 cd 34 @ then + return -1 +endi +if $data07 != @nchar+ ab 12 cd 34 @ then + return -1 +endi + +sql select c1, c3, concat("bin-", c1, "-a1-", "a2-", c3, "-a3-", "a4-", "END"), c2, c4, concat("nchar-", c2, "-a1-", "-a2-", c4, "-a3-", "a4-", "END") from ntb4 +print ====> select c1, c3, concat("bin-", c1, "-a1-", "a2-", c3, "-a3-", "a4-", "END"), c2, c4, concat("nchar-", c2, "-a1-", "a2-", c4, "-a3-", "a4-", "END") from ctb4 +sql select c1, c3, concat("bin-", c1, "-a1-", "a2-", c3, "-a3-", "a4-", "END"), c2, c4, concat("nchar-", c2, "-a1-", "a2-", c4, "-a3-", "a4-", "END") from ctb4 +print ====> rows: $rows +print ====> [ $data00 ] [ $data01 ] [ $data02 ] [ $data03 ] [ $data04 ] [ $data05 ] [ $data06 ] +print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $rows != 1 then + return -1 +endi +if $data02 != @bin- ab 12 -a1-a2- cd 34 -a3-a4-END@ then + return -1 +endi +if $data05 != @nchar- ab 12 -a1-a2- cd 34 -a3-a4-END@ then + return -1 +endi + +#sql_error select c1, c2, concat(c1, c2), c3, c4, concat(c3, c4) from ctb4 +#sql_error select t1, t2, concat(t1, t2), t3, t4, concat(t3, t4) from ctb4 +#sql_error select t1, t3, concat(t1, t3), t2, t4, concat(t2, t4) from ctb4 + +print ====> concat_ws +sql select c1, c3, concat_ws("*", c1, c3), c2, c4, concat_ws("*", c2, c4), concat_ws("*", "binary+", c1, c3), concat_ws("*", "nchar+", c2, c4) from ntb4 +print ====> select c1, c3, concat_ws("*", c1, c3), c2, c4, concat_ws("*", c2, c4), concat_ws("*", "binary+", c1, c3), concat_ws("*", "nchar+", c2, c4) from ctb4 +sql select c1, c3, concat_ws("*", c1, c3), c2, c4, concat_ws("*", c2, c4), concat_ws("*", "binary+", c1, c3), concat_ws("*", "nchar+", c2, c4) from ctb4 +print ====> rows: $rows +print ====> $data00 $data01 $data02 $data03 $data04 $data05 $data06 +print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $rows != 1 then + return -1 +endi +if $data02 != @ ab 12 * cd 34 @ then + return -1 +endi +if $data05 != @ ab 12 * cd 34 @ then + return -1 +endi +if $data06 != @binary+* ab 12 * cd 34 @ then + return -1 +endi +if $data07 != @nchar+* ab 12 * cd 34 @ then + return -1 +endi + +print ====> select c1, c3, concat_ws("*", "b0", c1, "b1", c3, "b2", "E0", "E1", "E2"), c2, c4, concat_ws("*", "n0", c2, c4, "n1", c2, c4, "n2", "END") from ctb4 +sql select c1, c3, concat_ws("*", "b0", c1, "b1", c3, "b2", "E0", "E1", "E2"), c2, c4, concat_ws("*", "n0", c2, c4, "n1", c2, c4, "n2", "END") from ctb4 +print ====> rows: $rows +print ====> [ $data00 ] [ $data01 ] [ $data02 ] [ $data03 ] [ $data04 ] [ $data05 ] [ $data06 ] +print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +if $rows != 1 then + return -1 +endi +if $data02 != @b0* ab 12 *b1* cd 34 *b2*E0*E1*E2@ then + return -1 +endi +if $data05 != @n0* ab 12 * cd 34 *n1* ab 12 * cd 34 *n2*END@ then + return -1 +endi + +#sql_error select c1, c2, concat_ws("*", c1, c2), c3, c4, concat_ws("*", c3, c4) from ctb4 +#sql_error select t1, t2, concat_ws("*", t1, t2), t3, t4, concat_ws("*", t3, t4) from ctb4 +#sql_error select t1, t3, concat_ws("*", t1, t3), t2, t4, concat_ws("*", t2, t4) from ctb4 + + +print ====> substr +#sql select c1, substr(c1, 3, 3), substr(c1, -5, 3), c2, substr(c2, 3, 3), substr(c2, -5, 3), substr("abcdefg", 3, 3), substr("abcdefg", -3, 3) from ntb5 +#print ====> select c1, substr(c1, 3, 3), substr(c1, -5, 3), c2, substr(c2, 3, 3), substr(c2, -5, 3), substr("abcdefg", 3, 3), substr("abcdefg", -3, 3) from ctb5 +#sql select c1, substr(c1, 3, 3), substr(c1, -5, 3), c2, substr(c2, 3, 3), substr(c2, -5, 3), substr("abcdefg", 3, 3), substr("abcdefg", -3, 3) from ctb5 +#print ====> rows: $rows +#print ====> $data00 $data01 $data02 $data03 $data04 $data05 $data06 +#print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +#if $rows != 1 then +# return -1 +#endi +#if $data01 != 345 then +# return -1 +#endi +#if $data02 != 456 then +# return -1 +#endi +#if $data04 != 345 then +# return -1 +#endi +#if $data05 != 456 then +# return -1 +#endi +#if $data06 != def then +# return -1 +#endi +#if $data07 != efg then +# return -1 +#endi +#if $data11 != NULL then +# return -1 +#endi +#if $data12 != NULL then +# return -1 +#endi +#if $data14 != NULL then +# return -1 +#endi +#if $data15 != NULL then +# return -1 +#endi +#if $data16 != def then +# return -1 +#endi +#if $data17 != efg then +# return -1 +#endi +# +#sql select c1, substr(c1, 3), substr(c1, -5), c2, substr(c2, 3), substr(c2, -5), substr("abcdefg", 3), substr("abcdefg", -3) from ntb5 +#print ====> select c1, substr(c1, 3), substr(c1, -5), c2, substr(c2, 3), substr(c2, -5), substr("abcdefg", 3), substr("abcdefg", -3) from ctb5 +#sql select c1, substr(c1, 3), substr(c1, -5), c2, substr(c2, 3), substr(c2, -5), substr("abcdefg", 3), substr("abcdefg", -3) from ctb5 +#print ====> rows: $rows +#print ====> $data00 $data01 $data02 $data03 $data04 $data05 $data06 +#print ====> $data10 $data11 $data12 $data13 $data14 $data15 $data16 +#if $rows != 1 then +# return -1 +#endi +#if $data01 != 3456789 then +# return -1 +#endi +#if $data02 != 456789 then +# return -1 +#endi +#if $data04 != 3456789 then +# return -1 +#endi +#if $data05 != 456789 then +# return -1 +#endi +#if $data06 != defg then +# return -1 +#endi +#if $data07 != efg then +# return -1 +#endi +#if $data11 != NULL then +# return -1 +#endi +#if $data12 != NULL then +# return -1 +#endi +#if $data14 != NULL then +# return -1 +#endi +#if $data15 != NULL then +# return -1 +#endi +#if $data16 != defg then +# return -1 +#endi +#if $data17 != efg then +# return -1 +#endi + +#sql_error select t1, substr(t1, 3, 2), substr(t1, -3, 2), t2, substr(t2, 3, 2), substr(t2, -3, 2) from ctb5 + +if $loop_test == 0 then + print =============== stop and restart taosd + system sh/exec.sh -n dnode1 -s stop -x SIGINT + system sh/exec.sh -n dnode1 -s start + + $loop_cnt = 0 + check_dnode_ready_0: + $loop_cnt = $loop_cnt + 1 + sleep 200 + if $loop_cnt == 10 then + print ====> dnode not ready! + return -1 + endi + sql show dnodes + print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 + if $data00 != 1 then + return -1 + endi + if $data04 != ready then + goto check_dnode_ready_0 + endi + + $loop_test = 1 + goto loop_test_pos +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index d7ae7668c8d29662e694330753cdbf63112a145c..22d8c2b735a604e7b3f0a6c95bcd1db7a39b6ed5 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -274,6 +274,10 @@ int main(int32_t argc, char *argv[]) { loop_consume(tmq); + err = tmq_unsubscribe(tmq); + ASSERT(err == TMQ_RESP_ERR__SUCCESS); + + #if 0 err = tmq_unsubscribe(tmq); if (err) {