From daaf4871ac079936cfd50b1f52e3d8627ce7e57e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 28 Mar 2023 18:43:58 +0800 Subject: [PATCH 01/71] feat: table level privilege syntax --- include/common/tmsg.h | 8 +- include/common/ttokendef.h | 98 +- include/libs/nodes/cmdnodes.h | 2 + source/common/src/tmsg.c | 25 +- source/libs/parser/inc/parAst.h | 11 +- source/libs/parser/inc/sql.y | 16 +- source/libs/parser/src/parAstCreater.c | 22 +- source/libs/parser/src/parTranslater.c | 11 +- source/libs/parser/src/sql.c | 6523 ++++++++++++------------ 9 files changed, 3408 insertions(+), 3308 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index ce441502cb..eb1ed592de 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -676,6 +676,8 @@ typedef struct { char user[TSDB_USER_LEN]; char pass[TSDB_USET_PASSWORD_LEN]; char objname[TSDB_DB_FNAME_LEN]; // db or topic + char tabName[TSDB_TABLE_NAME_LEN]; + char* tagCond; } SAlterUserReq; int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq); @@ -3187,9 +3189,9 @@ typedef struct { SArray* blockTbName; SArray* blockSchema; // the following attributes are extended from SMqDataRsp - int32_t createTableNum; - SArray* createTableLen; - SArray* createTableReq; + int32_t createTableNum; + SArray* createTableLen; + SArray* createTableReq; } STaosxRsp; int32_t tEncodeSTaosxRsp(SEncoder* pEncoder, const STaosxRsp* pRsp); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index a0593e7d4b..2e4a135f54 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -63,55 +63,55 @@ #define TK_READ 45 #define TK_WRITE 46 #define TK_NK_DOT 47 -#define TK_DNODE 48 -#define TK_PORT 49 -#define TK_DNODES 50 -#define TK_NK_IPTOKEN 51 -#define TK_FORCE 52 -#define TK_LOCAL 53 -#define TK_QNODE 54 -#define TK_BNODE 55 -#define TK_SNODE 56 -#define TK_MNODE 57 -#define TK_DATABASE 58 -#define TK_USE 59 -#define TK_FLUSH 60 -#define TK_TRIM 61 -#define TK_COMPACT 62 -#define TK_IF 63 -#define TK_NOT 64 -#define TK_EXISTS 65 -#define TK_BUFFER 66 -#define TK_CACHEMODEL 67 -#define TK_CACHESIZE 68 -#define TK_COMP 69 -#define TK_DURATION 70 -#define TK_NK_VARIABLE 71 -#define TK_MAXROWS 72 -#define TK_MINROWS 73 -#define TK_KEEP 74 -#define TK_PAGES 75 -#define TK_PAGESIZE 76 -#define TK_TSDB_PAGESIZE 77 -#define TK_PRECISION 78 -#define TK_REPLICA 79 -#define TK_VGROUPS 80 -#define TK_SINGLE_STABLE 81 -#define TK_RETENTIONS 82 -#define TK_SCHEMALESS 83 -#define TK_WAL_LEVEL 84 -#define TK_WAL_FSYNC_PERIOD 85 -#define TK_WAL_RETENTION_PERIOD 86 -#define TK_WAL_RETENTION_SIZE 87 -#define TK_WAL_ROLL_PERIOD 88 -#define TK_WAL_SEGMENT_SIZE 89 -#define TK_STT_TRIGGER 90 -#define TK_TABLE_PREFIX 91 -#define TK_TABLE_SUFFIX 92 -#define TK_NK_COLON 93 -#define TK_MAX_SPEED 94 -#define TK_START 95 -#define TK_WITH 96 +#define TK_WITH 48 +#define TK_DNODE 49 +#define TK_PORT 50 +#define TK_DNODES 51 +#define TK_NK_IPTOKEN 52 +#define TK_FORCE 53 +#define TK_LOCAL 54 +#define TK_QNODE 55 +#define TK_BNODE 56 +#define TK_SNODE 57 +#define TK_MNODE 58 +#define TK_DATABASE 59 +#define TK_USE 60 +#define TK_FLUSH 61 +#define TK_TRIM 62 +#define TK_COMPACT 63 +#define TK_IF 64 +#define TK_NOT 65 +#define TK_EXISTS 66 +#define TK_BUFFER 67 +#define TK_CACHEMODEL 68 +#define TK_CACHESIZE 69 +#define TK_COMP 70 +#define TK_DURATION 71 +#define TK_NK_VARIABLE 72 +#define TK_MAXROWS 73 +#define TK_MINROWS 74 +#define TK_KEEP 75 +#define TK_PAGES 76 +#define TK_PAGESIZE 77 +#define TK_TSDB_PAGESIZE 78 +#define TK_PRECISION 79 +#define TK_REPLICA 80 +#define TK_VGROUPS 81 +#define TK_SINGLE_STABLE 82 +#define TK_RETENTIONS 83 +#define TK_SCHEMALESS 84 +#define TK_WAL_LEVEL 85 +#define TK_WAL_FSYNC_PERIOD 86 +#define TK_WAL_RETENTION_PERIOD 87 +#define TK_WAL_RETENTION_SIZE 88 +#define TK_WAL_ROLL_PERIOD 89 +#define TK_WAL_SEGMENT_SIZE 90 +#define TK_STT_TRIGGER 91 +#define TK_TABLE_PREFIX 92 +#define TK_TABLE_SUFFIX 93 +#define TK_NK_COLON 94 +#define TK_MAX_SPEED 95 +#define TK_START 96 #define TK_TIMESTAMP 97 #define TK_END 98 #define TK_TABLE 99 diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index bcbc5f4cf4..d744295163 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -456,7 +456,9 @@ typedef struct SGrantStmt { ENodeType type; char userName[TSDB_USER_LEN]; char objName[TSDB_DB_NAME_LEN]; // db or topic + char tabName[TSDB_TABLE_NAME_LEN]; int64_t privileges; + SNode* pTagCond; } SGrantStmt; typedef SGrantStmt SRevokeStmt; diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7a238440a7..f6c2aaa5a4 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1150,7 +1150,7 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) { if (tDecodeI64(&decoder, &vload.compStorage) < 0) return -1; if (tDecodeI64(&decoder, &vload.pointsWritten) < 0) return -1; if (tDecodeI32(&decoder, &vload.numOfCachedTables) < 0) return -1; - if (tDecodeI32(&decoder, (int32_t*)&reserved) < 0) return -1; + if (tDecodeI32(&decoder, (int32_t *)&reserved) < 0) return -1; if (tDecodeI64(&decoder, &reserved) < 0) return -1; if (tDecodeI64(&decoder, &reserved) < 0) return -1; if (taosArrayPush(pReq->pVloads, &vload) == NULL) { @@ -1368,6 +1368,16 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) if (tEncodeCStr(&encoder, pReq->user) < 0) return -1; if (tEncodeCStr(&encoder, pReq->pass) < 0) return -1; if (tEncodeCStr(&encoder, pReq->objname) < 0) return -1; + int32_t len = strlen(pReq->tabName); + if (tEncodeI32(&encoder, len) < 0) return -1; + if (len > 0) { + if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1; + } + len = (NULL == pReq->tagCond ? 0 : strlen(pReq->tagCond)); + if (tEncodeI32(&encoder, len) < 0) return -1; + if (len > 0) { + if (tEncodeCStr(&encoder, pReq->tagCond) < 0) return -1; + } tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -1387,6 +1397,17 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq if (tDecodeCStrTo(&decoder, pReq->user) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->pass) < 0) return -1; if (tDecodeCStrTo(&decoder, pReq->objname) < 0) return -1; + if (!tDecodeIsEnd(&decoder)) { + int32_t len = 0; + if (tDecodeI32(&decoder, &len) < 0) return -1; + if (len > 0) { + if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1; + } + if (tDecodeI32(&decoder, &len) < 0) return -1; + if (len > 0) { + if (tDecodeCStrAlloc(&decoder, &pReq->tagCond) < 0) return -1; + } + } tEndDecode(&decoder); tDecoderClear(&decoder); @@ -6824,7 +6845,7 @@ int32_t tDecodeSMqDataRsp(SDecoder *pDecoder, SMqDataRsp *pRsp) { } void tDeleteSMqDataRsp(SMqDataRsp *pRsp) { - pRsp->blockDataLen = taosArrayDestroy(pRsp->blockDataLen);; + pRsp->blockDataLen = taosArrayDestroy(pRsp->blockDataLen); taosArrayDestroyP(pRsp->blockData, (FDelete)taosMemoryFree); pRsp->blockData = NULL; taosArrayDestroyP(pRsp->blockSchema, (FDelete)tDeleteSSchemaWrapper); diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 695d9f3006..fb6de977d8 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -82,6 +82,11 @@ typedef struct SAlterOption { SNodeList* pList; } SAlterOption; +typedef struct STokenPair { + SToken first; + SToken second; +} STokenPair; + extern SToken nil_token; void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt); @@ -227,8 +232,10 @@ SNode* createMergeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId1, cons SNode* createRedistributeVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId, SNodeList* pDnodes); SNode* createSplitVgroupStmt(SAstCreateContext* pCxt, const SToken* pVgId); SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName); -SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName); -SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName); +SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, + SNode* pTagCond); +SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, + SNode* pTagCond); SNode* createDeleteStmt(SAstCreateContext* pCxt, SNode* pTable, SNode* pWhere); SNode* createInsertStmt(SAstCreateContext* pCxt, SNode* pTable, SNodeList* pCols, SNode* pQuery); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index 9fd8d5415a..0d1ca9aa9f 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -94,8 +94,8 @@ sysinfo_opt(A) ::= . sysinfo_opt(A) ::= SYSINFO NK_INTEGER(B). { A = taosStr2Int8(B.z, NULL, 10); } /************************************************ grant/revoke ********************************************************/ -cmd ::= GRANT privileges(A) ON priv_level(B) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C); } -cmd ::= REVOKE privileges(A) ON priv_level(B) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C); } +cmd ::= GRANT privileges(A) ON priv_level(B) with_opt(D) TO user_name(C). { pCxt->pRootNode = createGrantStmt(pCxt, A, &B, &C, D); } +cmd ::= REVOKE privileges(A) ON priv_level(B) with_opt(D) FROM user_name(C). { pCxt->pRootNode = createRevokeStmt(pCxt, A, &B, &C, D); } %type privileges { int64_t } %destructor privileges { } @@ -113,11 +113,15 @@ priv_type_list(A) ::= priv_type_list(B) NK_COMMA priv_type(C). priv_type(A) ::= READ. { A = PRIVILEGE_TYPE_READ; } priv_type(A) ::= WRITE. { A = PRIVILEGE_TYPE_WRITE; } -%type priv_level { SToken } +%type priv_level { STokenPair } %destructor priv_level { } -priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR. { A = B; } -priv_level(A) ::= db_name(B) NK_DOT NK_STAR. { A = B; } -priv_level(A) ::= topic_name(B). { A = B; } +priv_level(A) ::= NK_STAR(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; } +priv_level(A) ::= db_name(B) NK_DOT NK_STAR(C). { A.first = B; A.second = C; } +priv_level(A) ::= db_name(B) NK_DOT table_name(C). { A.first = B; A.second = C; } +priv_level(A) ::= topic_name(B). { A.first = B; A.second = nil_token; } + +with_opt(A) ::= . { A = NULL; } +with_opt(A) ::= WITH search_condition(B). { A = B; } /************************************************ create/drop/alter dnode *********************************************/ cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); } diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index e1855256b2..2d88dad4de 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1961,29 +1961,39 @@ SNode* createSyncdbStmt(SAstCreateContext* pCxt, const SToken* pDbName) { return pStmt; } -SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName) { +SNode* createGrantStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, + SNode* pTagCond) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) { + if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) { return NULL; } SGrantStmt* pStmt = (SGrantStmt*)nodesMakeNode(QUERY_NODE_GRANT_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->privileges = privileges; - COPY_STRING_FORM_ID_TOKEN(pStmt->objName, pDbName); + COPY_STRING_FORM_ID_TOKEN(pStmt->objName, &pPrivLevel->first); + if (TK_NK_NIL != pPrivLevel->second.type && TK_NK_STAR != pPrivLevel->second.type) { + COPY_STRING_FORM_ID_TOKEN(pStmt->tabName, &pPrivLevel->second); + } COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); + pStmt->pTagCond = pTagCond; return (SNode*)pStmt; } -SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, SToken* pDbName, SToken* pUserName) { +SNode* createRevokeStmt(SAstCreateContext* pCxt, int64_t privileges, STokenPair* pPrivLevel, SToken* pUserName, + SNode* pTagCond) { CHECK_PARSER_STATUS(pCxt); - if (!checkDbName(pCxt, pDbName, false) || !checkUserName(pCxt, pUserName)) { + if (!checkDbName(pCxt, &pPrivLevel->first, false) || !checkUserName(pCxt, pUserName)) { return NULL; } SRevokeStmt* pStmt = (SRevokeStmt*)nodesMakeNode(QUERY_NODE_REVOKE_STMT); CHECK_OUT_OF_MEM(pStmt); pStmt->privileges = privileges; - COPY_STRING_FORM_ID_TOKEN(pStmt->objName, pDbName); + COPY_STRING_FORM_ID_TOKEN(pStmt->objName, &pPrivLevel->first); + if (TK_NK_NIL != pPrivLevel->second.type && TK_NK_STAR != pPrivLevel->second.type) { + COPY_STRING_FORM_ID_TOKEN(pStmt->tabName, &pPrivLevel->second); + } COPY_STRING_FORM_ID_TOKEN(pStmt->userName, pUserName); + pStmt->pTagCond = pTagCond; return (SNode*)pStmt; } diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 726790443e..1c88899dcf 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6464,7 +6464,15 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { } strcpy(req.user, pStmt->userName); sprintf(req.objname, "%d.%s", pCxt->pParseCxt->acctId, pStmt->objName); - return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req); + sprintf(req.tabName, "%s", pStmt->tabName); + int32_t code = TSDB_CODE_SUCCESS; + if (NULL != pStmt->pTagCond) { + code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, NULL); + } + if (TSDB_CODE_SUCCESS == code) { + code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req); + } + return code; } static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { @@ -6482,6 +6490,7 @@ static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { } strcpy(req.user, pStmt->userName); sprintf(req.objname, "%d.%s", pCxt->pParseCxt->acctId, pStmt->objName); + sprintf(req.tabName, "%s", pStmt->tabName); return buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 291d35ebe3..87ab47f4ac 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,27 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 471 +#define YYNOCODE 472 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - SNode* yy140; - EFillMode yy174; - int32_t yy214; - SNodeList* yy220; - int64_t yy303; - bool yy587; - SDataType yy682; - ENullOrder yy697; - EOperatorType yy794; - SAlterOption yy809; - EJoinType yy852; - int8_t yy857; - EOrder yy866; - SToken yy881; + int32_t yy20; + EOrder yy34; + bool yy89; + int64_t yy93; + SToken yy97; + EJoinType yy116; + ENullOrder yy265; + SAlterOption yy285; + EOperatorType yy396; + int8_t yy519; + SNodeList* yy520; + STokenPair yy569; + EFillMode yy646; + SNode* yy792; + SDataType yy848; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +140,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 752 -#define YYNRULE 572 +#define YYNSTATE 755 +#define YYNRULE 575 #define YYNTOKEN 328 -#define YY_MAX_SHIFT 751 -#define YY_MIN_SHIFTREDUCE 1118 -#define YY_MAX_SHIFTREDUCE 1689 -#define YY_ERROR_ACTION 1690 -#define YY_ACCEPT_ACTION 1691 -#define YY_NO_ACTION 1692 -#define YY_MIN_REDUCE 1693 -#define YY_MAX_REDUCE 2264 +#define YY_MAX_SHIFT 754 +#define YY_MIN_SHIFTREDUCE 1123 +#define YY_MAX_SHIFTREDUCE 1697 +#define YY_ERROR_ACTION 1698 +#define YY_ACCEPT_ACTION 1699 +#define YY_NO_ACTION 1700 +#define YY_MIN_REDUCE 1701 +#define YY_MAX_REDUCE 2275 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,739 +217,762 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2669) +#define YY_ACTTAB_COUNT (2778) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 1975, 1845, 387, 2076, 429, 604, 627, 2062, 141, 2235, - /* 10 */ 161, 2135, 45, 43, 1617, 1973, 628, 363, 2058, 1858, - /* 20 */ 384, 2062, 1466, 616, 603, 182, 1907, 2062, 496, 2236, - /* 30 */ 605, 2030, 2058, 1547, 492, 1464, 2094, 640, 2058, 44, - /* 40 */ 42, 41, 40, 39, 619, 1170, 332, 1169, 640, 2044, - /* 50 */ 1491, 657, 2054, 2060, 365, 506, 139, 1968, 1542, 1909, - /* 60 */ 222, 2240, 1909, 651, 18, 2235, 2054, 2060, 366, 349, - /* 70 */ 1691, 1472, 2054, 2060, 379, 1908, 1171, 651, 1907, 404, - /* 80 */ 2075, 2239, 176, 651, 2111, 2236, 2238, 109, 2077, 661, - /* 90 */ 2079, 2080, 656, 1151, 651, 166, 167, 748, 1705, 179, - /* 100 */ 14, 2164, 1801, 351, 1958, 378, 2160, 1491, 38, 37, - /* 110 */ 45, 43, 44, 42, 41, 40, 39, 48, 384, 184, - /* 120 */ 1466, 269, 2172, 615, 176, 133, 614, 2190, 48, 2235, - /* 130 */ 61, 1547, 1153, 1464, 1156, 1157, 1549, 1550, 397, 604, - /* 140 */ 622, 31, 396, 2235, 603, 182, 1959, 38, 37, 2236, - /* 150 */ 605, 44, 42, 41, 40, 39, 1542, 389, 603, 182, - /* 160 */ 1902, 1904, 18, 2236, 605, 1492, 1522, 1532, 1716, 1472, - /* 170 */ 1759, 122, 1548, 1551, 121, 120, 119, 118, 117, 116, - /* 180 */ 115, 114, 113, 579, 1975, 579, 1467, 2235, 1465, 2235, - /* 190 */ 490, 1493, 491, 1729, 65, 748, 375, 1239, 14, 1972, - /* 200 */ 628, 105, 2241, 182, 2241, 182, 640, 2236, 605, 2236, - /* 210 */ 605, 102, 1470, 1471, 2044, 1521, 1524, 1525, 1526, 1527, - /* 220 */ 1528, 1529, 1530, 1531, 653, 649, 1540, 1541, 1543, 1544, - /* 230 */ 1545, 1546, 2, 1241, 1549, 1550, 725, 724, 723, 722, - /* 240 */ 394, 626, 721, 720, 143, 715, 714, 713, 712, 711, - /* 250 */ 710, 709, 156, 705, 704, 703, 393, 392, 700, 699, - /* 260 */ 698, 697, 696, 2240, 1522, 1532, 1715, 2235, 38, 37, - /* 270 */ 1548, 1551, 44, 42, 41, 40, 39, 185, 1686, 185, - /* 280 */ 1494, 1330, 1331, 2239, 1467, 693, 1465, 2236, 2237, 508, - /* 290 */ 61, 1847, 489, 38, 37, 494, 1735, 44, 42, 41, - /* 300 */ 40, 39, 2058, 154, 153, 690, 689, 688, 151, 599, - /* 310 */ 1470, 1471, 2044, 1521, 1524, 1525, 1526, 1527, 1528, 1529, - /* 320 */ 1530, 1531, 653, 649, 1540, 1541, 1543, 1544, 1545, 1546, - /* 330 */ 2, 11, 45, 43, 1762, 1491, 2054, 2060, 1909, 271, - /* 340 */ 384, 1296, 1466, 1492, 695, 362, 1170, 651, 1169, 344, - /* 350 */ 594, 106, 194, 1547, 1907, 1464, 100, 1287, 683, 682, - /* 360 */ 681, 1291, 680, 1293, 1294, 679, 676, 140, 1302, 673, - /* 370 */ 1304, 1305, 670, 667, 1685, 1848, 33, 1171, 1542, 1833, - /* 380 */ 1849, 2076, 38, 37, 18, 568, 44, 42, 41, 40, - /* 390 */ 39, 1472, 1490, 83, 1576, 1645, 82, 545, 544, 543, - /* 400 */ 545, 544, 543, 1714, 535, 136, 539, 535, 136, 539, - /* 410 */ 538, 35, 290, 538, 2094, 537, 542, 748, 537, 542, - /* 420 */ 14, 536, 658, 499, 536, 491, 1729, 2044, 249, 657, - /* 430 */ 45, 43, 1552, 600, 595, 588, 86, 2179, 384, 185, - /* 440 */ 1466, 1250, 591, 590, 1643, 1644, 1646, 1647, 1648, 2044, - /* 450 */ 1577, 1547, 353, 1464, 1249, 641, 1549, 1550, 2075, 1402, - /* 460 */ 1403, 1851, 2111, 2176, 533, 109, 2077, 661, 2079, 2080, - /* 470 */ 656, 187, 651, 1694, 641, 142, 1542, 149, 2135, 2164, - /* 480 */ 61, 1385, 1386, 378, 2160, 532, 1522, 1532, 1856, 1472, - /* 490 */ 54, 693, 1548, 1551, 122, 1401, 1404, 121, 120, 119, - /* 500 */ 118, 117, 116, 115, 114, 113, 1467, 1856, 1465, 154, - /* 510 */ 153, 690, 689, 688, 151, 748, 476, 239, 46, 467, - /* 520 */ 49, 34, 382, 1571, 1572, 1573, 1574, 1575, 1579, 1580, - /* 530 */ 1581, 1582, 1470, 1471, 1693, 1521, 1524, 1525, 1526, 1527, - /* 540 */ 1528, 1529, 1530, 1531, 653, 649, 1540, 1541, 1543, 1544, - /* 550 */ 1545, 1546, 2, 423, 1549, 1550, 1472, 422, 131, 130, - /* 560 */ 129, 128, 127, 126, 125, 124, 123, 272, 498, 38, - /* 570 */ 37, 494, 1735, 44, 42, 41, 40, 39, 164, 2076, - /* 580 */ 198, 197, 1440, 1441, 1522, 1532, 616, 1859, 38, 37, - /* 590 */ 1548, 1551, 44, 42, 41, 40, 39, 2240, 579, 686, - /* 600 */ 1909, 86, 2235, 466, 1467, 2094, 1465, 372, 643, 61, - /* 610 */ 2136, 92, 2094, 598, 1493, 178, 1907, 2241, 182, 139, - /* 620 */ 619, 1831, 2236, 605, 27, 2044, 1852, 657, 1896, 185, - /* 630 */ 1470, 1471, 416, 1521, 1524, 1525, 1526, 1527, 1528, 1529, - /* 640 */ 1530, 1531, 653, 649, 1540, 1541, 1543, 1544, 1545, 1546, - /* 650 */ 2, 45, 43, 2037, 418, 414, 2075, 641, 597, 384, - /* 660 */ 2111, 1466, 1656, 109, 2077, 661, 2079, 2080, 656, 185, - /* 670 */ 651, 641, 1547, 132, 1464, 179, 641, 2164, 1903, 1904, - /* 680 */ 529, 378, 2160, 618, 180, 2172, 2173, 132, 137, 2177, - /* 690 */ 1856, 550, 427, 2179, 534, 1679, 2076, 1542, 579, 73, - /* 700 */ 1713, 616, 2235, 2191, 1856, 641, 560, 38, 37, 1856, - /* 710 */ 1472, 44, 42, 41, 40, 39, 627, 2241, 182, 2175, - /* 720 */ 236, 428, 2236, 605, 41, 40, 39, 641, 238, 2094, - /* 730 */ 616, 641, 237, 693, 139, 553, 748, 658, 1856, 46, - /* 740 */ 547, 11, 2044, 437, 657, 235, 2044, 452, 81, 45, - /* 750 */ 43, 154, 153, 690, 689, 688, 151, 384, 185, 1466, - /* 760 */ 1856, 376, 271, 139, 1856, 625, 627, 1968, 2063, 164, - /* 770 */ 1547, 2038, 1464, 2075, 707, 1549, 1550, 2111, 1858, 2058, - /* 780 */ 168, 2077, 661, 2079, 2080, 656, 69, 651, 1841, 68, - /* 790 */ 89, 339, 1712, 641, 361, 1542, 561, 1711, 2076, 181, - /* 800 */ 2172, 2173, 387, 137, 2177, 1522, 1532, 1954, 1472, 453, - /* 810 */ 164, 1548, 1551, 2054, 2060, 636, 579, 1968, 190, 1858, - /* 820 */ 2235, 580, 2201, 1939, 651, 1467, 1856, 1465, 183, 2172, - /* 830 */ 2173, 2094, 137, 2177, 748, 2241, 182, 14, 2044, 658, - /* 840 */ 2236, 605, 1621, 2044, 2044, 1710, 657, 1557, 1491, 1709, - /* 850 */ 2179, 1470, 1471, 1491, 1521, 1524, 1525, 1526, 1527, 1528, - /* 860 */ 1529, 1530, 1531, 653, 649, 1540, 1541, 1543, 1544, 1545, - /* 870 */ 1546, 2, 1843, 1549, 1550, 2075, 2174, 559, 1708, 2111, - /* 880 */ 1839, 641, 109, 2077, 661, 2079, 2080, 656, 165, 651, - /* 890 */ 557, 2044, 555, 310, 2139, 2044, 2164, 507, 685, 1909, - /* 900 */ 378, 2160, 1707, 1522, 1532, 1704, 377, 308, 72, 1548, - /* 910 */ 1551, 71, 38, 37, 1856, 1907, 44, 42, 41, 40, - /* 920 */ 39, 281, 282, 1467, 2044, 1465, 280, 356, 390, 205, - /* 930 */ 486, 484, 481, 8, 38, 37, 164, 2239, 44, 42, - /* 940 */ 41, 40, 39, 1703, 2076, 1858, 541, 540, 2044, 1470, - /* 950 */ 1471, 2044, 1521, 1524, 1525, 1526, 1527, 1528, 1529, 1530, - /* 960 */ 1531, 653, 649, 1540, 1541, 1543, 1544, 1545, 1546, 2, - /* 970 */ 61, 335, 1909, 1489, 2076, 719, 717, 2094, 447, 388, - /* 980 */ 460, 641, 1614, 474, 641, 658, 473, 446, 1907, 2044, - /* 990 */ 2044, 1254, 657, 357, 1523, 355, 354, 1853, 531, 1523, - /* 1000 */ 241, 443, 533, 475, 1253, 1633, 445, 2094, 108, 244, - /* 1010 */ 641, 641, 373, 1832, 1856, 658, 11, 1856, 9, 1491, - /* 1020 */ 2044, 2075, 657, 532, 652, 2111, 575, 620, 109, 2077, - /* 1030 */ 661, 2079, 2080, 656, 708, 651, 1818, 1702, 1701, 61, - /* 1040 */ 2255, 1494, 2164, 1856, 1856, 1700, 378, 2160, 80, 79, - /* 1050 */ 426, 2075, 352, 189, 641, 2111, 1494, 2198, 327, 2077, - /* 1060 */ 661, 2079, 2080, 656, 433, 651, 478, 13, 12, 1466, - /* 1070 */ 624, 1699, 333, 1749, 1578, 412, 695, 410, 406, 402, - /* 1080 */ 399, 419, 1464, 2044, 2044, 1698, 1697, 1856, 1696, 2076, - /* 1090 */ 645, 2044, 2136, 471, 163, 546, 465, 464, 463, 462, - /* 1100 */ 459, 458, 457, 456, 455, 451, 450, 449, 448, 334, - /* 1110 */ 440, 439, 438, 641, 435, 434, 350, 2044, 1472, 185, - /* 1120 */ 641, 608, 2094, 641, 421, 641, 420, 641, 574, 285, - /* 1130 */ 658, 2044, 2044, 152, 2044, 2044, 638, 657, 2076, 639, - /* 1140 */ 1954, 291, 1610, 391, 748, 32, 1856, 2012, 1954, 304, - /* 1150 */ 419, 192, 1886, 1856, 687, 1583, 1856, 1900, 1856, 196, - /* 1160 */ 1856, 1156, 1157, 2184, 1610, 1523, 2075, 1590, 1834, 691, - /* 1170 */ 2111, 2094, 1900, 109, 2077, 661, 2079, 2080, 656, 658, - /* 1180 */ 651, 51, 611, 3, 2044, 2255, 657, 2164, 185, 191, - /* 1190 */ 53, 378, 2160, 240, 430, 692, 1742, 2076, 1900, 145, - /* 1200 */ 152, 134, 2211, 607, 248, 228, 230, 431, 226, 229, - /* 1210 */ 232, 234, 147, 231, 233, 2075, 1688, 1689, 548, 2111, - /* 1220 */ 2076, 247, 109, 2077, 661, 2079, 2080, 656, 1613, 651, - /* 1230 */ 2094, 1802, 152, 1467, 2255, 1465, 2164, 563, 658, 562, - /* 1240 */ 378, 2160, 1740, 2044, 1475, 657, 63, 578, 13, 12, - /* 1250 */ 1706, 586, 2204, 2094, 648, 63, 253, 1435, 701, 1470, - /* 1260 */ 1471, 658, 266, 152, 551, 90, 2044, 592, 657, 47, - /* 1270 */ 278, 70, 150, 152, 2075, 63, 1474, 47, 2111, 47, - /* 1280 */ 1219, 109, 2077, 661, 2079, 2080, 656, 2065, 651, 1438, - /* 1290 */ 665, 221, 150, 2255, 152, 2164, 135, 2075, 2076, 378, - /* 1300 */ 2160, 2111, 150, 1642, 109, 2077, 661, 2079, 2080, 656, - /* 1310 */ 2229, 651, 1641, 255, 381, 380, 2255, 395, 2164, 52, - /* 1320 */ 623, 1736, 378, 2160, 1480, 1200, 1399, 283, 633, 287, - /* 1330 */ 1280, 2094, 1584, 2183, 1533, 1547, 303, 1473, 260, 658, - /* 1340 */ 2067, 702, 1963, 223, 2044, 2095, 657, 1308, 609, 1312, - /* 1350 */ 1730, 1319, 2194, 1317, 617, 1897, 265, 2076, 171, 155, - /* 1360 */ 1542, 1201, 268, 1217, 525, 521, 517, 513, 220, 1, - /* 1370 */ 743, 4, 398, 1472, 403, 2075, 1422, 348, 298, 2111, - /* 1380 */ 2076, 195, 109, 2077, 661, 2079, 2080, 656, 432, 651, - /* 1390 */ 2094, 1494, 1964, 436, 2137, 469, 2164, 1478, 658, 647, - /* 1400 */ 378, 2160, 1568, 2044, 441, 657, 1489, 454, 1956, 87, - /* 1410 */ 468, 612, 218, 2094, 461, 470, 479, 477, 200, 480, - /* 1420 */ 199, 658, 483, 482, 202, 485, 2044, 566, 657, 1477, - /* 1430 */ 487, 1495, 488, 497, 2075, 1497, 1492, 500, 2111, 208, - /* 1440 */ 501, 109, 2077, 661, 2079, 2080, 656, 1496, 651, 210, - /* 1450 */ 502, 1498, 503, 644, 213, 2164, 215, 2075, 505, 378, - /* 1460 */ 2160, 2111, 2076, 509, 110, 2077, 661, 2079, 2080, 656, - /* 1470 */ 84, 651, 579, 85, 219, 1173, 2235, 526, 2164, 217, - /* 1480 */ 211, 528, 2163, 2160, 216, 527, 504, 530, 1481, 111, - /* 1490 */ 1476, 2241, 182, 338, 1846, 2094, 2236, 605, 225, 2021, - /* 1500 */ 1842, 227, 209, 658, 157, 158, 1844, 565, 2044, 1840, - /* 1510 */ 657, 2076, 567, 159, 1484, 1486, 160, 88, 148, 242, - /* 1520 */ 299, 2018, 569, 2017, 245, 576, 573, 649, 1540, 1541, - /* 1530 */ 1543, 1544, 1545, 1546, 2076, 570, 583, 593, 2210, 2075, - /* 1540 */ 2195, 2205, 631, 2111, 2094, 602, 110, 2077, 661, 2079, - /* 1550 */ 2080, 656, 658, 651, 251, 589, 254, 2044, 7, 657, - /* 1560 */ 2164, 367, 596, 2209, 646, 2160, 172, 2094, 2186, 584, - /* 1570 */ 582, 261, 259, 2258, 263, 655, 262, 581, 1610, 264, - /* 1580 */ 2044, 613, 657, 368, 610, 138, 1493, 2180, 659, 371, - /* 1590 */ 621, 1499, 2111, 300, 1969, 110, 2077, 661, 2079, 2080, - /* 1600 */ 656, 629, 651, 273, 95, 634, 2076, 301, 97, 2164, - /* 1610 */ 635, 2075, 99, 343, 2160, 2111, 630, 60, 326, 2077, - /* 1620 */ 661, 2079, 2080, 656, 654, 651, 642, 2129, 267, 2076, - /* 1630 */ 2234, 1983, 1982, 1981, 374, 1857, 302, 2145, 101, 2094, - /* 1640 */ 663, 1901, 1819, 751, 305, 744, 745, 658, 747, 314, - /* 1650 */ 294, 328, 2044, 318, 657, 307, 309, 297, 50, 340, - /* 1660 */ 341, 2036, 2094, 2076, 2035, 2034, 329, 77, 2031, 400, - /* 1670 */ 658, 401, 175, 1457, 1458, 2044, 188, 657, 741, 737, - /* 1680 */ 733, 729, 295, 2075, 405, 2029, 407, 2111, 408, 2076, - /* 1690 */ 169, 2077, 661, 2079, 2080, 656, 2094, 651, 409, 2028, - /* 1700 */ 411, 2027, 413, 2026, 658, 415, 2075, 2025, 417, 2044, - /* 1710 */ 2111, 657, 78, 110, 2077, 661, 2079, 2080, 656, 1425, - /* 1720 */ 651, 1424, 2094, 107, 1995, 1994, 288, 2164, 1993, 424, - /* 1730 */ 658, 425, 2161, 1992, 1991, 2044, 1376, 657, 1947, 1946, - /* 1740 */ 2075, 1944, 606, 2256, 2111, 1943, 144, 168, 2077, 661, - /* 1750 */ 2079, 2080, 656, 2076, 651, 1942, 1945, 1941, 637, 193, - /* 1760 */ 1935, 442, 444, 1949, 1934, 1933, 2075, 1940, 1938, 1937, - /* 1770 */ 2111, 1936, 1932, 320, 2077, 661, 2079, 2080, 656, 1931, - /* 1780 */ 651, 1930, 1929, 1928, 1927, 2076, 2094, 1926, 1925, 2202, - /* 1790 */ 1924, 1923, 1922, 275, 658, 1921, 1920, 1919, 274, 2044, - /* 1800 */ 146, 657, 1918, 1917, 1948, 1916, 1915, 1378, 1914, 1913, - /* 1810 */ 2076, 1912, 1911, 472, 1429, 1910, 243, 601, 2094, 336, - /* 1820 */ 1251, 1255, 1765, 337, 201, 1764, 655, 1763, 1247, 1761, - /* 1830 */ 2075, 2044, 203, 657, 2111, 204, 1725, 169, 2077, 661, - /* 1840 */ 2079, 2080, 656, 2094, 651, 177, 1724, 2064, 383, 206, - /* 1850 */ 2008, 658, 75, 1159, 1158, 76, 2044, 493, 657, 2076, - /* 1860 */ 207, 495, 2075, 2002, 1990, 212, 2111, 214, 1989, 326, - /* 1870 */ 2077, 661, 2079, 2080, 656, 2076, 651, 1967, 2130, 1835, - /* 1880 */ 1760, 1758, 1193, 510, 512, 511, 1756, 2075, 514, 515, - /* 1890 */ 2257, 2111, 2094, 516, 327, 2077, 661, 2079, 2080, 656, - /* 1900 */ 658, 651, 1754, 519, 518, 2044, 520, 657, 2094, 1752, - /* 1910 */ 522, 524, 1739, 385, 523, 1738, 658, 1721, 1837, 1324, - /* 1920 */ 1836, 2044, 1323, 657, 2076, 1238, 224, 62, 1237, 1236, - /* 1930 */ 1235, 1234, 716, 718, 1231, 1229, 564, 1750, 1230, 1228, - /* 1940 */ 2111, 2076, 1743, 322, 2077, 661, 2079, 2080, 656, 358, - /* 1950 */ 651, 359, 2075, 1741, 360, 549, 2111, 2094, 2076, 327, - /* 1960 */ 2077, 661, 2079, 2080, 656, 658, 651, 1720, 552, 554, - /* 1970 */ 2044, 1719, 657, 556, 2094, 1718, 558, 112, 1445, 1447, - /* 1980 */ 1444, 2007, 658, 1449, 1431, 26, 2001, 2044, 571, 657, - /* 1990 */ 1988, 2094, 55, 246, 1986, 2240, 577, 66, 572, 658, - /* 2000 */ 19, 2075, 364, 16, 2044, 2111, 657, 2076, 311, 2077, - /* 2010 */ 661, 2079, 2080, 656, 58, 651, 28, 162, 2075, 5, - /* 2020 */ 1658, 250, 2111, 2076, 585, 312, 2077, 661, 2079, 2080, - /* 2030 */ 656, 6, 651, 59, 587, 2075, 64, 252, 258, 2111, - /* 2040 */ 2094, 2076, 313, 2077, 661, 2079, 2080, 656, 658, 651, - /* 2050 */ 257, 1640, 170, 2044, 2065, 657, 2094, 30, 256, 29, - /* 2060 */ 21, 1632, 91, 1673, 658, 1678, 1679, 1672, 270, 2044, - /* 2070 */ 369, 657, 1677, 1676, 2094, 370, 173, 1607, 1606, 1987, - /* 2080 */ 57, 1985, 658, 93, 2075, 56, 20, 2044, 2111, 657, - /* 2090 */ 2076, 319, 2077, 661, 2079, 2080, 656, 17, 651, 1984, - /* 2100 */ 2075, 1966, 94, 276, 2111, 22, 2076, 323, 2077, 661, - /* 2110 */ 2079, 2080, 656, 1965, 651, 277, 1638, 279, 2075, 284, - /* 2120 */ 67, 96, 2111, 2094, 286, 315, 2077, 661, 2079, 2080, - /* 2130 */ 656, 658, 651, 102, 98, 289, 2044, 23, 657, 2094, - /* 2140 */ 632, 1559, 10, 1558, 12, 1482, 2114, 658, 1537, 650, - /* 2150 */ 174, 1535, 2044, 1569, 657, 36, 186, 1514, 1534, 15, - /* 2160 */ 24, 660, 1506, 2076, 25, 662, 1309, 2075, 664, 386, - /* 2170 */ 666, 2111, 1306, 668, 324, 2077, 661, 2079, 2080, 656, - /* 2180 */ 2076, 651, 671, 2075, 669, 674, 1303, 2111, 1297, 672, - /* 2190 */ 316, 2077, 661, 2079, 2080, 656, 2094, 651, 675, 677, - /* 2200 */ 1301, 1295, 678, 1300, 658, 1286, 684, 103, 104, 2044, - /* 2210 */ 292, 657, 1318, 2094, 1299, 1298, 74, 1314, 1191, 694, - /* 2220 */ 1225, 658, 1224, 1223, 1222, 1221, 2044, 1220, 657, 2076, - /* 2230 */ 1245, 1218, 706, 1216, 1215, 1214, 1212, 293, 1211, 1210, - /* 2240 */ 2075, 1209, 1208, 1207, 2111, 2076, 1206, 325, 2077, 661, - /* 2250 */ 2079, 2080, 656, 1242, 651, 1240, 1203, 2075, 1202, 1199, - /* 2260 */ 1198, 2111, 2094, 1197, 317, 2077, 661, 2079, 2080, 656, - /* 2270 */ 658, 651, 1196, 1757, 726, 2044, 727, 657, 2094, 728, - /* 2280 */ 1755, 731, 730, 732, 1753, 734, 658, 736, 1751, 738, - /* 2290 */ 735, 2044, 740, 657, 2076, 1737, 742, 739, 1148, 1717, - /* 2300 */ 296, 1468, 746, 750, 306, 1692, 2075, 749, 1692, 1692, - /* 2310 */ 2111, 1692, 1692, 330, 2077, 661, 2079, 2080, 656, 2076, - /* 2320 */ 651, 1692, 2075, 1692, 1692, 1692, 2111, 2094, 1692, 331, - /* 2330 */ 2077, 661, 2079, 2080, 656, 658, 651, 1692, 1692, 1692, - /* 2340 */ 2044, 1692, 657, 2076, 1692, 1692, 1692, 1692, 1692, 1692, - /* 2350 */ 1692, 1692, 2094, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - /* 2360 */ 658, 1692, 1692, 1692, 1692, 2044, 1692, 657, 1692, 1692, - /* 2370 */ 1692, 2075, 1692, 1692, 1692, 2111, 2094, 1692, 2088, 2077, - /* 2380 */ 661, 2079, 2080, 656, 658, 651, 1692, 1692, 1692, 2044, - /* 2390 */ 1692, 657, 1692, 1692, 1692, 1692, 2075, 1692, 1692, 1692, - /* 2400 */ 2111, 1692, 1692, 2087, 2077, 661, 2079, 2080, 656, 1692, - /* 2410 */ 651, 1692, 1692, 1692, 2076, 1692, 1692, 1692, 1692, 1692, - /* 2420 */ 2075, 1692, 1692, 1692, 2111, 1692, 1692, 2086, 2077, 661, - /* 2430 */ 2079, 2080, 656, 1692, 651, 1692, 2076, 1692, 1692, 1692, - /* 2440 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 2094, 1692, 1692, - /* 2450 */ 1692, 1692, 1692, 1692, 1692, 658, 1692, 1692, 1692, 1692, - /* 2460 */ 2044, 1692, 657, 2076, 1692, 1692, 1692, 1692, 1692, 2094, - /* 2470 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 658, 1692, 1692, - /* 2480 */ 1692, 1692, 2044, 1692, 657, 1692, 1692, 1692, 1692, 1692, - /* 2490 */ 1692, 2075, 1692, 1692, 1692, 2111, 2094, 1692, 345, 2077, - /* 2500 */ 661, 2079, 2080, 656, 658, 651, 1692, 1692, 1692, 2044, - /* 2510 */ 1692, 657, 2076, 2075, 1692, 1692, 1692, 2111, 1692, 1692, - /* 2520 */ 346, 2077, 661, 2079, 2080, 656, 1692, 651, 2076, 1692, - /* 2530 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - /* 2540 */ 2075, 1692, 1692, 1692, 2111, 2094, 1692, 342, 2077, 661, - /* 2550 */ 2079, 2080, 656, 658, 651, 1692, 1692, 1692, 2044, 1692, - /* 2560 */ 657, 2094, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 658, - /* 2570 */ 1692, 1692, 1692, 1692, 2044, 1692, 657, 2076, 1692, 1692, - /* 2580 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 2075, - /* 2590 */ 1692, 1692, 1692, 2111, 1692, 1692, 347, 2077, 661, 2079, - /* 2600 */ 2080, 656, 1692, 651, 1692, 659, 1692, 1692, 1692, 2111, - /* 2610 */ 2094, 1692, 322, 2077, 661, 2079, 2080, 656, 658, 651, - /* 2620 */ 1692, 1692, 1692, 2044, 1692, 657, 1692, 1692, 1692, 1692, - /* 2630 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - /* 2640 */ 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, 1692, - /* 2650 */ 1692, 1692, 1692, 1692, 2075, 1692, 1692, 1692, 2111, 1692, - /* 2660 */ 1692, 321, 2077, 661, 2079, 2080, 656, 1692, 651, + /* 0 */ 2087, 494, 1920, 1986, 495, 1737, 1856, 644, 1867, 366, + /* 10 */ 661, 1965, 46, 44, 1625, 379, 2073, 1918, 1983, 631, + /* 20 */ 388, 601, 1474, 39, 38, 133, 2069, 45, 43, 42, + /* 30 */ 41, 40, 532, 1555, 123, 1472, 2105, 122, 121, 120, + /* 40 */ 119, 118, 117, 116, 115, 114, 499, 2105, 2055, 1178, + /* 50 */ 660, 1177, 496, 427, 1986, 192, 2087, 426, 1858, 1550, + /* 60 */ 2065, 2071, 369, 66, 226, 19, 661, 511, 2069, 1984, + /* 70 */ 631, 654, 1480, 180, 502, 619, 140, 495, 1737, 2086, + /* 80 */ 348, 1179, 1247, 2122, 643, 1907, 169, 2088, 664, 2090, + /* 90 */ 2091, 659, 2105, 654, 177, 1499, 434, 751, 582, 600, + /* 100 */ 15, 2246, 2065, 2071, 2055, 1499, 660, 619, 140, 435, + /* 110 */ 46, 44, 1474, 654, 355, 1969, 2252, 184, 388, 1249, + /* 120 */ 1474, 2247, 608, 167, 1584, 1472, 583, 2212, 209, 1699, + /* 130 */ 1812, 1555, 497, 1472, 1744, 2086, 1557, 1558, 2073, 2122, + /* 140 */ 1950, 1965, 110, 2088, 664, 2090, 2091, 659, 2069, 654, + /* 150 */ 1156, 168, 143, 1713, 150, 2146, 2175, 1550, 62, 62, + /* 160 */ 382, 2171, 1480, 19, 49, 211, 1530, 1540, 643, 497, + /* 170 */ 1480, 1744, 1556, 1559, 273, 2183, 618, 643, 134, 617, + /* 180 */ 1585, 2246, 2065, 2071, 370, 194, 1475, 751, 1473, 1158, + /* 190 */ 629, 1161, 1162, 654, 2073, 751, 606, 184, 15, 401, + /* 200 */ 1499, 2247, 608, 400, 2069, 621, 182, 2183, 2184, 1843, + /* 210 */ 138, 2188, 1478, 1479, 1773, 1529, 1532, 1533, 1534, 1535, + /* 220 */ 1536, 1537, 1538, 1539, 656, 652, 1548, 1549, 1551, 1552, + /* 230 */ 1553, 1554, 2, 393, 1557, 1558, 1913, 1915, 2065, 2071, + /* 240 */ 383, 1393, 1394, 425, 582, 424, 698, 2246, 49, 654, + /* 250 */ 87, 35, 386, 1579, 1580, 1581, 1582, 1583, 1587, 1588, + /* 260 */ 1589, 1590, 2252, 184, 1530, 1540, 357, 2247, 608, 423, + /* 270 */ 1556, 1559, 1920, 698, 607, 1862, 1475, 2246, 1473, 376, + /* 280 */ 62, 548, 547, 546, 1475, 1629, 1473, 1918, 538, 137, + /* 290 */ 542, 1499, 606, 184, 541, 451, 1653, 2247, 608, 540, + /* 300 */ 545, 602, 1478, 1479, 450, 539, 2023, 187, 187, 1500, + /* 310 */ 1478, 1479, 1844, 1529, 1532, 1533, 1534, 1535, 1536, 1537, + /* 320 */ 1538, 1539, 656, 652, 1548, 1549, 1551, 1552, 1553, 1554, + /* 330 */ 2, 12, 46, 44, 644, 1867, 644, 1867, 696, 1724, + /* 340 */ 388, 1702, 1474, 594, 593, 1651, 1652, 1654, 1655, 1656, + /* 350 */ 625, 244, 189, 1555, 55, 1472, 155, 154, 693, 692, + /* 360 */ 691, 152, 123, 433, 1498, 122, 121, 120, 119, 118, + /* 370 */ 117, 116, 115, 114, 45, 43, 42, 41, 40, 1550, + /* 380 */ 276, 548, 547, 546, 243, 19, 1920, 2055, 538, 137, + /* 390 */ 542, 571, 1480, 381, 541, 582, 1164, 187, 2246, 540, + /* 400 */ 545, 1918, 1498, 39, 38, 539, 336, 45, 43, 42, + /* 410 */ 41, 40, 2087, 2252, 184, 2190, 2251, 751, 2247, 608, + /* 420 */ 15, 62, 661, 93, 696, 1338, 1339, 619, 140, 187, + /* 430 */ 46, 44, 1560, 1501, 644, 1867, 597, 1531, 388, 1701, + /* 440 */ 1474, 2187, 155, 154, 693, 692, 691, 152, 2105, 1448, + /* 450 */ 1449, 1555, 133, 1472, 644, 1867, 1557, 1558, 62, 537, + /* 460 */ 2055, 630, 660, 132, 131, 130, 129, 128, 127, 126, + /* 470 */ 125, 124, 431, 630, 2087, 39, 38, 1550, 12, 45, + /* 480 */ 43, 42, 41, 40, 622, 1965, 1530, 1540, 380, 165, + /* 490 */ 1480, 2086, 1556, 1559, 1258, 2122, 165, 1870, 111, 2088, + /* 500 */ 664, 2090, 2091, 659, 1869, 654, 1475, 1257, 1473, 1501, + /* 510 */ 2105, 509, 2175, 1979, 1687, 751, 2174, 2171, 47, 603, + /* 520 */ 598, 591, 2055, 628, 660, 1979, 183, 2183, 2184, 198, + /* 530 */ 138, 2188, 1478, 1479, 87, 1529, 1532, 1533, 1534, 1535, + /* 540 */ 1536, 1537, 1538, 1539, 656, 652, 1548, 1549, 1551, 1552, + /* 550 */ 1553, 1554, 2, 2086, 1557, 1558, 2250, 2122, 196, 1863, + /* 560 */ 110, 2088, 664, 2090, 2091, 659, 2190, 654, 1664, 480, + /* 570 */ 187, 1723, 181, 1694, 2175, 1480, 619, 140, 382, 2171, + /* 580 */ 391, 275, 644, 1867, 1530, 1540, 611, 1920, 162, 391, + /* 590 */ 1556, 1559, 2186, 1304, 353, 367, 1869, 165, 84, 2202, + /* 600 */ 432, 83, 1918, 1918, 1475, 1869, 1473, 187, 630, 1295, + /* 610 */ 686, 685, 684, 1299, 683, 1301, 1302, 682, 679, 2055, + /* 620 */ 1310, 676, 1312, 1313, 673, 670, 1565, 42, 41, 40, + /* 630 */ 1478, 1479, 1499, 1529, 1532, 1533, 1534, 1535, 1536, 1537, + /* 640 */ 1538, 1539, 656, 652, 1548, 1549, 1551, 1552, 1553, 1554, + /* 650 */ 2, 46, 44, 710, 2087, 644, 1867, 275, 639, 388, + /* 660 */ 1979, 1474, 394, 607, 661, 12, 2246, 10, 553, 1693, + /* 670 */ 165, 1262, 1555, 441, 1472, 185, 2183, 2184, 1869, 138, + /* 680 */ 2188, 606, 184, 563, 1261, 360, 2247, 608, 39, 38, + /* 690 */ 2105, 107, 45, 43, 42, 41, 40, 240, 1550, 644, + /* 700 */ 1867, 1920, 2055, 2190, 660, 242, 9, 141, 392, 241, + /* 710 */ 1722, 1480, 153, 556, 177, 1859, 1918, 456, 550, 142, + /* 720 */ 39, 38, 2146, 239, 45, 43, 42, 41, 40, 2185, + /* 730 */ 644, 1867, 1502, 2086, 471, 1970, 751, 2122, 1502, 47, + /* 740 */ 170, 2088, 664, 2090, 2091, 659, 482, 654, 457, 46, + /* 750 */ 44, 361, 2087, 359, 358, 689, 534, 388, 2055, 1474, + /* 760 */ 536, 1852, 658, 70, 644, 1867, 69, 90, 343, 54, + /* 770 */ 1555, 365, 1472, 564, 2251, 1557, 1558, 2246, 1531, 39, + /* 780 */ 38, 535, 510, 45, 43, 42, 41, 40, 2105, 644, + /* 790 */ 1867, 609, 2267, 2250, 200, 199, 1550, 2247, 2249, 50, + /* 800 */ 2055, 562, 660, 644, 1867, 1530, 1540, 1864, 646, 1480, + /* 810 */ 2147, 1556, 1559, 612, 560, 28, 558, 470, 644, 1867, + /* 820 */ 1586, 245, 610, 285, 286, 1475, 420, 1473, 284, 101, + /* 830 */ 1500, 2086, 644, 1867, 751, 2122, 578, 15, 330, 2088, + /* 840 */ 664, 2090, 2091, 659, 657, 654, 645, 2140, 422, 418, + /* 850 */ 623, 1478, 1479, 1860, 1529, 1532, 1533, 1534, 1535, 1536, + /* 860 */ 1537, 1538, 1539, 656, 652, 1548, 1549, 1551, 1552, 1553, + /* 870 */ 1554, 2, 1842, 1557, 1558, 36, 294, 39, 38, 1854, + /* 880 */ 253, 45, 43, 42, 41, 40, 193, 14, 13, 644, + /* 890 */ 1867, 33, 648, 339, 2147, 1497, 644, 1867, 1178, 1850, + /* 900 */ 1177, 1591, 464, 1530, 1540, 478, 32, 627, 477, 1556, + /* 910 */ 1559, 688, 39, 38, 289, 1618, 45, 43, 42, 41, + /* 920 */ 40, 34, 1622, 1475, 447, 1473, 479, 39, 38, 449, + /* 930 */ 1179, 45, 43, 42, 41, 40, 39, 38, 1914, 1915, + /* 940 */ 45, 43, 42, 41, 40, 2048, 1410, 1411, 187, 1478, + /* 950 */ 1479, 1499, 1529, 1532, 1533, 1534, 1535, 1536, 1537, 1538, + /* 960 */ 1539, 656, 652, 1548, 1549, 1551, 1552, 1553, 1554, 2, + /* 970 */ 1641, 644, 1867, 536, 356, 1770, 2251, 544, 543, 2246, + /* 980 */ 644, 1867, 1409, 1412, 696, 690, 437, 1598, 1911, 641, + /* 990 */ 582, 1721, 1720, 2246, 535, 2250, 722, 720, 642, 2247, + /* 1000 */ 2248, 1920, 155, 154, 693, 692, 691, 152, 2252, 184, + /* 1010 */ 1161, 1162, 614, 2247, 608, 475, 1919, 577, 469, 468, + /* 1020 */ 467, 466, 463, 462, 461, 460, 459, 455, 454, 453, + /* 1030 */ 452, 338, 444, 443, 442, 2049, 439, 438, 354, 2055, + /* 1040 */ 2055, 248, 728, 727, 726, 725, 398, 1719, 724, 723, + /* 1050 */ 144, 718, 717, 716, 715, 714, 713, 712, 157, 708, + /* 1060 */ 707, 706, 397, 396, 703, 702, 701, 700, 699, 166, + /* 1070 */ 694, 2087, 1718, 1911, 314, 644, 1867, 1717, 1716, 1502, + /* 1080 */ 582, 622, 1715, 2246, 644, 1867, 2195, 1618, 312, 73, + /* 1090 */ 2074, 2087, 72, 295, 1712, 2055, 164, 1531, 2252, 184, + /* 1100 */ 2069, 661, 395, 2247, 608, 1711, 695, 2105, 1710, 1911, + /* 1110 */ 1760, 207, 490, 488, 485, 1709, 1483, 1708, 1707, 2055, + /* 1120 */ 2055, 660, 1753, 581, 1706, 2055, 2055, 2105, 308, 1845, + /* 1130 */ 2055, 1897, 549, 232, 2065, 2071, 230, 1705, 1704, 2055, + /* 1140 */ 234, 660, 2055, 233, 551, 654, 569, 711, 1714, 1829, + /* 1150 */ 2086, 62, 2041, 2055, 2122, 74, 2055, 110, 2088, 664, + /* 1160 */ 2090, 2091, 659, 2055, 654, 2055, 2055, 153, 1621, 181, + /* 1170 */ 2086, 2175, 2055, 148, 2122, 382, 2171, 169, 2088, 664, + /* 1180 */ 2090, 2091, 659, 153, 654, 2055, 2055, 2087, 186, 109, + /* 1190 */ 52, 582, 3, 146, 2246, 135, 2201, 661, 1751, 1746, + /* 1200 */ 236, 408, 238, 235, 82, 237, 566, 64, 565, 2252, + /* 1210 */ 184, 64, 251, 655, 2247, 608, 1696, 1697, 2213, 1482, + /* 1220 */ 554, 651, 257, 2105, 1443, 153, 48, 252, 270, 81, + /* 1230 */ 80, 430, 282, 71, 191, 2055, 2087, 660, 151, 153, + /* 1240 */ 1446, 615, 2215, 53, 64, 48, 661, 1747, 2209, 1813, + /* 1250 */ 14, 13, 2076, 337, 48, 91, 416, 668, 414, 410, + /* 1260 */ 406, 403, 423, 151, 1650, 225, 2086, 595, 1649, 1486, + /* 1270 */ 2122, 153, 2105, 110, 2088, 664, 2090, 2091, 659, 259, + /* 1280 */ 654, 136, 626, 1407, 2055, 2266, 660, 2175, 151, 287, + /* 1290 */ 636, 382, 2171, 106, 2087, 291, 1288, 746, 1208, 704, + /* 1300 */ 187, 1592, 1541, 103, 661, 2078, 2222, 264, 2106, 705, + /* 1310 */ 399, 307, 1974, 1738, 1316, 2086, 1908, 1743, 2205, 2122, + /* 1320 */ 1320, 1227, 110, 2088, 664, 2090, 2091, 659, 1327, 654, + /* 1330 */ 2105, 1225, 620, 272, 2266, 1209, 2175, 269, 1325, 1, + /* 1340 */ 382, 2171, 2055, 5, 660, 156, 402, 407, 352, 1430, + /* 1350 */ 302, 197, 2087, 436, 1502, 445, 440, 473, 1975, 1497, + /* 1360 */ 458, 472, 661, 1967, 589, 465, 474, 483, 1576, 484, + /* 1370 */ 481, 202, 1485, 2086, 486, 201, 487, 2122, 204, 489, + /* 1380 */ 110, 2088, 664, 2090, 2091, 659, 491, 654, 2105, 1503, + /* 1390 */ 492, 4, 2266, 493, 2175, 500, 2087, 501, 382, 2171, + /* 1400 */ 2055, 1505, 660, 503, 1500, 1504, 661, 1506, 2240, 212, + /* 1410 */ 505, 504, 214, 506, 217, 508, 512, 219, 85, 86, + /* 1420 */ 223, 1181, 529, 530, 2087, 533, 2032, 531, 2029, 112, + /* 1430 */ 1857, 2086, 2105, 2028, 661, 2122, 2194, 342, 110, 2088, + /* 1440 */ 664, 2090, 2091, 659, 2055, 654, 660, 568, 385, 384, + /* 1450 */ 2266, 229, 2175, 1853, 231, 158, 382, 2171, 1488, 570, + /* 1460 */ 2105, 89, 159, 246, 1855, 249, 1851, 160, 161, 1555, + /* 1470 */ 579, 1481, 2055, 572, 660, 2086, 596, 2221, 634, 2122, + /* 1480 */ 2206, 149, 110, 2088, 664, 2090, 2091, 659, 303, 654, + /* 1490 */ 576, 2216, 586, 592, 2266, 1550, 2175, 255, 8, 371, + /* 1500 */ 382, 2171, 258, 2086, 2220, 599, 2087, 2122, 1480, 573, + /* 1510 */ 110, 2088, 664, 2090, 2091, 659, 661, 654, 605, 173, + /* 1520 */ 587, 2087, 2266, 585, 2175, 584, 372, 268, 382, 2171, + /* 1530 */ 616, 661, 613, 650, 2197, 266, 263, 1618, 139, 1501, + /* 1540 */ 2191, 265, 2105, 624, 375, 277, 1507, 1980, 304, 632, + /* 1550 */ 96, 633, 1994, 1993, 2055, 267, 660, 2105, 1992, 378, + /* 1560 */ 305, 637, 638, 98, 1868, 61, 100, 2087, 2156, 2055, + /* 1570 */ 306, 660, 102, 1830, 309, 1912, 2245, 661, 2269, 666, + /* 1580 */ 271, 298, 747, 333, 748, 2086, 750, 51, 313, 2122, + /* 1590 */ 318, 2087, 324, 2088, 664, 2090, 2091, 659, 2047, 654, + /* 1600 */ 2086, 661, 332, 2105, 2122, 2046, 344, 110, 2088, 664, + /* 1610 */ 2090, 2091, 659, 311, 654, 2055, 322, 660, 2045, 2150, + /* 1620 */ 345, 2175, 1489, 2087, 1484, 382, 2171, 2105, 78, 2042, + /* 1630 */ 404, 1465, 405, 661, 1466, 604, 409, 190, 2040, 2055, + /* 1640 */ 413, 660, 411, 412, 2039, 415, 2086, 2038, 1492, 1494, + /* 1650 */ 2122, 417, 2037, 170, 2088, 664, 2090, 2091, 659, 2105, + /* 1660 */ 654, 652, 1548, 1549, 1551, 1552, 1553, 1554, 419, 2036, + /* 1670 */ 2086, 2055, 421, 660, 2122, 79, 1433, 110, 2088, 664, + /* 1680 */ 2090, 2091, 659, 1432, 654, 2006, 2005, 2004, 428, 2148, + /* 1690 */ 429, 2175, 2003, 2002, 2087, 382, 2171, 1958, 1384, 1957, + /* 1700 */ 1955, 145, 2086, 1954, 661, 2268, 2122, 1953, 1956, 110, + /* 1710 */ 2088, 664, 2090, 2091, 659, 1952, 654, 1951, 1949, 1948, + /* 1720 */ 1947, 647, 195, 2175, 2087, 446, 1946, 382, 2171, 448, + /* 1730 */ 2105, 1960, 1945, 1944, 661, 1943, 1942, 1941, 1940, 1939, + /* 1740 */ 1938, 1937, 2055, 1936, 660, 1935, 1934, 1933, 1932, 1931, + /* 1750 */ 1930, 147, 1929, 1928, 1959, 1927, 2087, 1926, 1925, 1924, + /* 1760 */ 2105, 1923, 476, 1922, 1386, 1921, 661, 1776, 1775, 340, + /* 1770 */ 203, 341, 2055, 2086, 660, 205, 1774, 2122, 1259, 1255, + /* 1780 */ 111, 2088, 664, 2090, 2091, 659, 1263, 654, 206, 1772, + /* 1790 */ 2087, 1733, 2105, 208, 2175, 1163, 1732, 2019, 649, 2171, + /* 1800 */ 661, 76, 2013, 662, 2055, 77, 660, 2122, 2001, 210, + /* 1810 */ 111, 2088, 664, 2090, 2091, 659, 178, 654, 2075, 216, + /* 1820 */ 179, 498, 218, 2000, 2175, 1978, 2105, 513, 347, 2171, + /* 1830 */ 1846, 377, 1771, 1769, 514, 2086, 1201, 515, 2055, 2122, + /* 1840 */ 660, 1767, 111, 2088, 664, 2090, 2091, 659, 2087, 654, + /* 1850 */ 517, 519, 518, 1765, 521, 522, 2175, 523, 658, 1763, + /* 1860 */ 526, 2172, 1750, 525, 1749, 2087, 1729, 1848, 527, 2086, + /* 1870 */ 1332, 1331, 1847, 2122, 1246, 661, 331, 2088, 664, 2090, + /* 1880 */ 2091, 659, 228, 654, 2105, 1245, 63, 1244, 719, 1243, + /* 1890 */ 1242, 721, 1239, 1238, 1761, 1237, 2055, 362, 660, 363, + /* 1900 */ 1236, 2105, 1754, 1752, 364, 555, 387, 552, 1728, 2087, + /* 1910 */ 1727, 557, 1726, 2055, 559, 660, 113, 561, 1453, 661, + /* 1920 */ 1455, 1452, 1457, 2018, 27, 1439, 67, 2086, 56, 2012, + /* 1930 */ 1999, 2122, 2087, 754, 330, 2088, 664, 2090, 2091, 659, + /* 1940 */ 574, 654, 661, 2141, 2086, 2105, 1997, 301, 2122, 250, + /* 1950 */ 389, 331, 2088, 664, 2090, 2091, 659, 2055, 654, 660, + /* 1960 */ 2251, 575, 368, 176, 20, 580, 17, 6, 2105, 744, + /* 1970 */ 740, 736, 732, 299, 29, 163, 7, 590, 588, 1666, + /* 1980 */ 2055, 2087, 660, 59, 254, 60, 261, 171, 2086, 256, + /* 1990 */ 1648, 661, 2122, 260, 262, 331, 2088, 664, 2090, 2091, + /* 2000 */ 659, 30, 654, 2076, 31, 1640, 92, 65, 1686, 22, + /* 2010 */ 1687, 567, 1681, 108, 1680, 2122, 292, 2105, 326, 2088, + /* 2020 */ 664, 2090, 2091, 659, 373, 654, 1685, 1684, 374, 2055, + /* 2030 */ 274, 660, 1615, 1614, 57, 21, 18, 2087, 58, 1998, + /* 2040 */ 1996, 1995, 174, 1977, 94, 95, 280, 661, 640, 23, + /* 2050 */ 1976, 281, 1646, 2087, 283, 288, 293, 97, 103, 68, + /* 2060 */ 2086, 290, 635, 661, 2122, 24, 99, 315, 2088, 664, + /* 2070 */ 2090, 2091, 659, 2105, 654, 1490, 1567, 11, 1566, 13, + /* 2080 */ 1577, 2125, 653, 279, 37, 2055, 1545, 660, 278, 2105, + /* 2090 */ 1522, 1543, 175, 188, 667, 390, 671, 1542, 16, 665, + /* 2100 */ 25, 2055, 1514, 660, 1437, 26, 247, 674, 1317, 2087, + /* 2110 */ 669, 663, 1314, 672, 677, 1311, 2086, 1305, 680, 661, + /* 2120 */ 2122, 1303, 675, 316, 2088, 664, 2090, 2091, 659, 678, + /* 2130 */ 654, 681, 2086, 1294, 104, 1309, 2122, 296, 1308, 317, + /* 2140 */ 2088, 664, 2090, 2091, 659, 2105, 654, 1307, 1306, 687, + /* 2150 */ 1326, 105, 75, 1322, 1233, 1199, 697, 2055, 2087, 660, + /* 2160 */ 1232, 1231, 1230, 1229, 1228, 1226, 1253, 1224, 661, 1223, + /* 2170 */ 1222, 2087, 709, 1220, 1219, 1218, 1217, 297, 1216, 1215, + /* 2180 */ 1214, 661, 1250, 1248, 1211, 1210, 1207, 1206, 2086, 1205, + /* 2190 */ 1204, 1768, 2122, 1766, 2105, 323, 2088, 664, 2090, 2091, + /* 2200 */ 659, 729, 654, 731, 733, 730, 2055, 2105, 660, 734, + /* 2210 */ 735, 1764, 737, 739, 738, 1762, 741, 742, 743, 2055, + /* 2220 */ 1748, 660, 745, 1153, 1725, 300, 749, 1700, 1476, 752, + /* 2230 */ 2087, 310, 753, 1700, 1700, 1700, 1700, 2086, 1700, 1700, + /* 2240 */ 661, 2122, 1700, 1700, 327, 2088, 664, 2090, 2091, 659, + /* 2250 */ 2086, 654, 1700, 1700, 2122, 1700, 1700, 319, 2088, 664, + /* 2260 */ 2090, 2091, 659, 1700, 654, 1700, 2105, 1700, 1700, 1700, + /* 2270 */ 1700, 1700, 1700, 1700, 2087, 1700, 1700, 1700, 2055, 1700, + /* 2280 */ 660, 1700, 1700, 1700, 661, 1700, 1700, 1700, 1700, 2087, + /* 2290 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 661, + /* 2300 */ 1700, 1700, 2087, 1700, 1700, 1700, 1700, 1700, 1700, 2086, + /* 2310 */ 2105, 1700, 661, 2122, 1700, 1700, 328, 2088, 664, 2090, + /* 2320 */ 2091, 659, 2055, 654, 660, 2105, 1700, 1700, 1700, 1700, + /* 2330 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 2055, 2105, 660, + /* 2340 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 2087, 1700, + /* 2350 */ 2055, 1700, 660, 2086, 1700, 1700, 1700, 2122, 661, 1700, + /* 2360 */ 320, 2088, 664, 2090, 2091, 659, 1700, 654, 2086, 1700, + /* 2370 */ 1700, 1700, 2122, 1700, 1700, 329, 2088, 664, 2090, 2091, + /* 2380 */ 659, 2086, 654, 1700, 2105, 2122, 1700, 227, 321, 2088, + /* 2390 */ 664, 2090, 2091, 659, 1700, 654, 2055, 1700, 660, 1700, + /* 2400 */ 1700, 1700, 1700, 172, 2087, 1700, 1700, 1700, 1700, 528, + /* 2410 */ 524, 520, 516, 224, 661, 1700, 1700, 1700, 1700, 2087, + /* 2420 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 2086, 1700, 661, + /* 2430 */ 1700, 2122, 1700, 1700, 334, 2088, 664, 2090, 2091, 659, + /* 2440 */ 2105, 654, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, + /* 2450 */ 1700, 1700, 2055, 88, 660, 2105, 222, 1700, 1700, 1700, + /* 2460 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 2055, 2087, 660, + /* 2470 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 661, 1700, + /* 2480 */ 1700, 1700, 1700, 2086, 1700, 1700, 1700, 2122, 1700, 2087, + /* 2490 */ 335, 2088, 664, 2090, 2091, 659, 1700, 654, 2086, 661, + /* 2500 */ 1700, 1700, 2122, 1700, 2105, 2099, 2088, 664, 2090, 2091, + /* 2510 */ 659, 1700, 654, 1700, 1700, 1700, 2055, 1700, 660, 1700, + /* 2520 */ 1700, 1700, 1700, 221, 215, 2105, 1700, 1700, 220, 1700, + /* 2530 */ 507, 1700, 1700, 1700, 1700, 1700, 1700, 2055, 2087, 660, + /* 2540 */ 1700, 1700, 1700, 1700, 1700, 1700, 213, 2086, 661, 1700, + /* 2550 */ 1700, 2122, 1700, 2087, 2098, 2088, 664, 2090, 2091, 659, + /* 2560 */ 1700, 654, 1700, 661, 1700, 1700, 1700, 1700, 2086, 1700, + /* 2570 */ 1700, 1700, 2122, 1700, 2105, 2097, 2088, 664, 2090, 2091, + /* 2580 */ 659, 1700, 654, 1700, 1700, 1700, 2055, 1700, 660, 2105, + /* 2590 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, + /* 2600 */ 1700, 2055, 1700, 660, 1700, 1700, 1700, 1700, 1700, 1700, + /* 2610 */ 1700, 1700, 2087, 1700, 1700, 1700, 1700, 2086, 1700, 1700, + /* 2620 */ 1700, 2122, 661, 1700, 349, 2088, 664, 2090, 2091, 659, + /* 2630 */ 1700, 654, 2086, 1700, 1700, 1700, 2122, 1700, 1700, 350, + /* 2640 */ 2088, 664, 2090, 2091, 659, 1700, 654, 1700, 2105, 1700, + /* 2650 */ 1700, 1700, 1700, 1700, 1700, 1700, 2087, 1700, 1700, 1700, + /* 2660 */ 2055, 1700, 660, 1700, 1700, 1700, 661, 1700, 1700, 1700, + /* 2670 */ 1700, 2087, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, + /* 2680 */ 1700, 661, 1700, 1700, 2087, 1700, 1700, 1700, 1700, 1700, + /* 2690 */ 1700, 2086, 2105, 1700, 661, 2122, 1700, 1700, 346, 2088, + /* 2700 */ 664, 2090, 2091, 659, 2055, 654, 660, 2105, 1700, 1700, + /* 2710 */ 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 2055, + /* 2720 */ 2105, 660, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, + /* 2730 */ 1700, 1700, 2055, 1700, 660, 2086, 1700, 1700, 1700, 2122, + /* 2740 */ 1700, 1700, 351, 2088, 664, 2090, 2091, 659, 1700, 654, + /* 2750 */ 662, 1700, 1700, 1700, 2122, 1700, 1700, 326, 2088, 664, + /* 2760 */ 2090, 2091, 659, 2086, 654, 1700, 1700, 2122, 1700, 1700, + /* 2770 */ 325, 2088, 664, 2090, 2091, 659, 1700, 654, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 379, 365, 356, 331, 339, 441, 339, 366, 425, 445, - /* 10 */ 364, 428, 12, 13, 14, 394, 395, 371, 377, 373, - /* 20 */ 20, 366, 22, 339, 460, 461, 380, 366, 14, 465, - /* 30 */ 466, 0, 377, 33, 20, 35, 364, 20, 377, 12, - /* 40 */ 13, 14, 15, 16, 372, 20, 381, 22, 20, 377, - /* 50 */ 20, 379, 411, 412, 413, 388, 372, 390, 58, 364, - /* 60 */ 35, 441, 364, 422, 64, 445, 411, 412, 413, 371, - /* 70 */ 328, 71, 411, 412, 413, 380, 51, 422, 380, 48, - /* 80 */ 408, 461, 364, 422, 412, 465, 466, 415, 416, 417, - /* 90 */ 418, 419, 420, 4, 422, 346, 330, 97, 332, 427, - /* 100 */ 100, 429, 353, 385, 386, 433, 434, 20, 8, 9, - /* 110 */ 12, 13, 12, 13, 14, 15, 16, 100, 20, 447, - /* 120 */ 22, 437, 438, 439, 364, 441, 442, 455, 100, 445, - /* 130 */ 100, 33, 43, 35, 45, 46, 136, 137, 396, 441, - /* 140 */ 396, 2, 400, 445, 460, 461, 386, 8, 9, 465, - /* 150 */ 466, 12, 13, 14, 15, 16, 58, 375, 460, 461, - /* 160 */ 378, 379, 64, 465, 466, 20, 166, 167, 331, 71, - /* 170 */ 0, 21, 172, 173, 24, 25, 26, 27, 28, 29, - /* 180 */ 30, 31, 32, 441, 379, 441, 186, 445, 188, 445, - /* 190 */ 335, 20, 337, 338, 4, 97, 391, 35, 100, 394, - /* 200 */ 395, 100, 460, 461, 460, 461, 20, 465, 466, 465, - /* 210 */ 466, 110, 212, 213, 377, 215, 216, 217, 218, 219, + /* 0 */ 331, 335, 367, 381, 338, 339, 368, 340, 341, 374, + /* 10 */ 341, 341, 12, 13, 14, 393, 369, 382, 396, 397, + /* 20 */ 20, 341, 22, 8, 9, 358, 379, 12, 13, 14, + /* 30 */ 15, 16, 365, 33, 21, 35, 367, 24, 25, 26, + /* 40 */ 27, 28, 29, 30, 31, 32, 14, 367, 379, 20, + /* 50 */ 381, 22, 20, 398, 381, 385, 331, 402, 369, 59, + /* 60 */ 413, 414, 415, 4, 35, 65, 341, 64, 379, 396, + /* 70 */ 397, 424, 72, 366, 335, 340, 341, 338, 339, 410, + /* 80 */ 65, 52, 35, 414, 20, 378, 417, 418, 419, 420, + /* 90 */ 421, 422, 367, 424, 367, 20, 22, 97, 443, 419, + /* 100 */ 100, 446, 413, 414, 379, 20, 381, 340, 341, 35, + /* 110 */ 12, 13, 22, 424, 387, 388, 461, 462, 20, 72, + /* 120 */ 22, 466, 467, 349, 109, 35, 457, 458, 336, 328, + /* 130 */ 356, 33, 340, 35, 342, 410, 136, 137, 369, 414, + /* 140 */ 0, 341, 417, 418, 419, 420, 421, 422, 379, 424, + /* 150 */ 4, 330, 427, 332, 429, 430, 431, 59, 100, 100, + /* 160 */ 435, 436, 72, 65, 100, 336, 166, 167, 20, 340, + /* 170 */ 72, 342, 172, 173, 439, 440, 441, 20, 443, 444, + /* 180 */ 165, 446, 413, 414, 415, 385, 186, 97, 188, 43, + /* 190 */ 20, 45, 46, 424, 369, 97, 461, 462, 100, 398, + /* 200 */ 20, 466, 467, 402, 379, 438, 439, 440, 441, 0, + /* 210 */ 443, 444, 212, 213, 0, 215, 216, 217, 218, 219, /* 220 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 230 */ 230, 231, 232, 71, 136, 137, 66, 67, 68, 69, - /* 240 */ 70, 20, 72, 73, 74, 75, 76, 77, 78, 79, - /* 250 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - /* 260 */ 90, 91, 92, 441, 166, 167, 331, 445, 8, 9, - /* 270 */ 172, 173, 12, 13, 14, 15, 16, 249, 178, 249, - /* 280 */ 20, 136, 137, 461, 186, 112, 188, 465, 466, 63, - /* 290 */ 100, 366, 336, 8, 9, 339, 340, 12, 13, 14, - /* 300 */ 15, 16, 377, 130, 131, 132, 133, 134, 135, 20, - /* 310 */ 212, 213, 377, 215, 216, 217, 218, 219, 220, 221, + /* 230 */ 230, 231, 232, 377, 136, 137, 380, 381, 413, 414, + /* 240 */ 415, 166, 167, 185, 443, 187, 64, 446, 100, 424, + /* 250 */ 348, 236, 237, 238, 239, 240, 241, 242, 243, 244, + /* 260 */ 245, 246, 461, 462, 166, 167, 364, 466, 467, 211, + /* 270 */ 172, 173, 367, 64, 443, 373, 186, 446, 188, 374, + /* 280 */ 100, 67, 68, 69, 186, 14, 188, 382, 74, 75, + /* 290 */ 76, 20, 461, 462, 80, 155, 212, 466, 467, 85, + /* 300 */ 86, 20, 212, 213, 164, 91, 363, 249, 249, 20, + /* 310 */ 212, 213, 0, 215, 216, 217, 218, 219, 220, 221, /* 320 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - /* 330 */ 232, 233, 12, 13, 0, 20, 411, 412, 364, 168, - /* 340 */ 20, 97, 22, 20, 63, 371, 20, 422, 22, 64, - /* 350 */ 171, 343, 58, 33, 380, 35, 343, 113, 114, 115, - /* 360 */ 116, 117, 118, 119, 120, 121, 122, 359, 124, 125, - /* 370 */ 126, 127, 128, 129, 274, 367, 2, 51, 58, 0, - /* 380 */ 367, 331, 8, 9, 64, 111, 12, 13, 14, 15, - /* 390 */ 16, 71, 20, 99, 109, 212, 102, 66, 67, 68, - /* 400 */ 66, 67, 68, 331, 73, 74, 75, 73, 74, 75, - /* 410 */ 79, 430, 431, 79, 364, 84, 85, 97, 84, 85, - /* 420 */ 100, 90, 372, 335, 90, 337, 338, 377, 168, 379, - /* 430 */ 12, 13, 14, 254, 255, 256, 345, 414, 20, 249, - /* 440 */ 22, 22, 259, 260, 261, 262, 263, 264, 265, 377, - /* 450 */ 165, 33, 361, 35, 35, 339, 136, 137, 408, 136, - /* 460 */ 137, 370, 412, 440, 112, 415, 416, 417, 418, 419, - /* 470 */ 420, 355, 422, 0, 339, 425, 58, 427, 428, 429, - /* 480 */ 100, 166, 167, 433, 434, 133, 166, 167, 372, 71, - /* 490 */ 355, 112, 172, 173, 21, 172, 173, 24, 25, 26, - /* 500 */ 27, 28, 29, 30, 31, 32, 186, 372, 188, 130, - /* 510 */ 131, 132, 133, 134, 135, 97, 97, 130, 100, 80, - /* 520 */ 100, 236, 237, 238, 239, 240, 241, 242, 243, 244, - /* 530 */ 245, 246, 212, 213, 0, 215, 216, 217, 218, 219, + /* 330 */ 232, 233, 12, 13, 340, 341, 340, 341, 112, 331, + /* 340 */ 20, 0, 22, 259, 260, 261, 262, 263, 264, 265, + /* 350 */ 398, 408, 358, 33, 358, 35, 130, 131, 132, 133, + /* 360 */ 134, 135, 21, 340, 20, 24, 25, 26, 27, 28, + /* 370 */ 29, 30, 31, 32, 12, 13, 14, 15, 16, 59, + /* 380 */ 59, 67, 68, 69, 130, 65, 367, 379, 74, 75, + /* 390 */ 76, 111, 72, 374, 80, 443, 14, 249, 446, 85, + /* 400 */ 86, 382, 20, 8, 9, 91, 383, 12, 13, 14, + /* 410 */ 15, 16, 331, 461, 462, 416, 3, 97, 466, 467, + /* 420 */ 100, 100, 341, 102, 112, 136, 137, 340, 341, 249, + /* 430 */ 12, 13, 14, 20, 340, 341, 171, 166, 20, 0, + /* 440 */ 22, 442, 130, 131, 132, 133, 134, 135, 367, 195, + /* 450 */ 196, 33, 358, 35, 340, 341, 136, 137, 100, 365, + /* 460 */ 379, 340, 381, 24, 25, 26, 27, 28, 29, 30, + /* 470 */ 31, 32, 358, 340, 331, 8, 9, 59, 233, 12, + /* 480 */ 13, 14, 15, 16, 341, 341, 166, 167, 359, 367, + /* 490 */ 72, 410, 172, 173, 22, 414, 367, 375, 417, 418, + /* 500 */ 419, 420, 421, 422, 375, 424, 186, 35, 188, 20, + /* 510 */ 367, 390, 431, 392, 101, 97, 435, 436, 100, 254, + /* 520 */ 255, 256, 379, 390, 381, 392, 439, 440, 441, 385, + /* 530 */ 443, 444, 212, 213, 348, 215, 216, 217, 218, 219, /* 540 */ 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, - /* 550 */ 230, 231, 232, 396, 136, 137, 71, 400, 24, 25, - /* 560 */ 26, 27, 28, 29, 30, 31, 32, 58, 336, 8, - /* 570 */ 9, 339, 340, 12, 13, 14, 15, 16, 364, 331, - /* 580 */ 141, 142, 195, 196, 166, 167, 339, 373, 8, 9, - /* 590 */ 172, 173, 12, 13, 14, 15, 16, 3, 441, 111, - /* 600 */ 364, 345, 445, 164, 186, 364, 188, 371, 426, 100, - /* 610 */ 428, 102, 364, 372, 20, 363, 380, 460, 461, 372, - /* 620 */ 372, 0, 465, 466, 44, 377, 370, 379, 376, 249, - /* 630 */ 212, 213, 181, 215, 216, 217, 218, 219, 220, 221, + /* 550 */ 230, 231, 232, 410, 136, 137, 3, 414, 59, 373, + /* 560 */ 417, 418, 419, 420, 421, 422, 416, 424, 101, 97, + /* 570 */ 249, 331, 429, 178, 431, 72, 340, 341, 435, 436, + /* 580 */ 359, 168, 340, 341, 166, 167, 44, 367, 367, 359, + /* 590 */ 172, 173, 442, 97, 374, 374, 375, 367, 99, 456, + /* 600 */ 358, 102, 382, 382, 186, 375, 188, 249, 340, 113, + /* 610 */ 114, 115, 116, 117, 118, 119, 120, 121, 122, 379, + /* 620 */ 124, 125, 126, 127, 128, 129, 14, 14, 15, 16, + /* 630 */ 212, 213, 20, 215, 216, 217, 218, 219, 220, 221, /* 640 */ 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, - /* 650 */ 232, 12, 13, 396, 203, 204, 408, 339, 417, 20, - /* 660 */ 412, 22, 101, 415, 416, 417, 418, 419, 420, 249, - /* 670 */ 422, 339, 33, 355, 35, 427, 339, 429, 378, 379, - /* 680 */ 362, 433, 434, 436, 437, 438, 439, 355, 441, 442, - /* 690 */ 372, 4, 355, 414, 362, 101, 331, 58, 441, 111, - /* 700 */ 331, 339, 445, 455, 372, 339, 19, 8, 9, 372, - /* 710 */ 71, 12, 13, 14, 15, 16, 339, 460, 461, 440, - /* 720 */ 33, 355, 465, 466, 14, 15, 16, 339, 131, 364, - /* 730 */ 339, 339, 135, 112, 372, 48, 97, 372, 372, 100, - /* 740 */ 53, 233, 377, 355, 379, 58, 377, 355, 160, 12, - /* 750 */ 13, 130, 131, 132, 133, 134, 135, 20, 249, 22, - /* 760 */ 372, 356, 168, 372, 372, 388, 339, 390, 366, 364, - /* 770 */ 33, 396, 35, 408, 71, 136, 137, 412, 373, 377, - /* 780 */ 415, 416, 417, 418, 419, 420, 99, 422, 365, 102, - /* 790 */ 193, 194, 331, 339, 197, 58, 199, 331, 331, 437, - /* 800 */ 438, 439, 356, 441, 442, 166, 167, 372, 71, 355, - /* 810 */ 364, 172, 173, 411, 412, 388, 441, 390, 383, 373, - /* 820 */ 445, 456, 457, 0, 422, 186, 372, 188, 437, 438, - /* 830 */ 439, 364, 441, 442, 97, 460, 461, 100, 377, 372, - /* 840 */ 465, 466, 14, 377, 377, 331, 379, 14, 20, 331, - /* 850 */ 414, 212, 213, 20, 215, 216, 217, 218, 219, 220, + /* 650 */ 232, 12, 13, 72, 331, 340, 341, 168, 390, 20, + /* 660 */ 392, 22, 359, 443, 341, 233, 446, 235, 4, 274, + /* 670 */ 367, 22, 33, 358, 35, 439, 440, 441, 375, 443, + /* 680 */ 444, 461, 462, 19, 35, 37, 466, 467, 8, 9, + /* 690 */ 367, 346, 12, 13, 14, 15, 16, 33, 59, 340, + /* 700 */ 341, 367, 379, 416, 381, 131, 39, 362, 374, 135, + /* 710 */ 331, 72, 44, 49, 367, 370, 382, 358, 54, 427, + /* 720 */ 8, 9, 430, 59, 12, 13, 14, 15, 16, 442, + /* 730 */ 340, 341, 20, 410, 81, 388, 97, 414, 20, 100, + /* 740 */ 417, 418, 419, 420, 421, 422, 97, 424, 358, 12, + /* 750 */ 13, 103, 331, 105, 106, 111, 108, 20, 379, 22, + /* 760 */ 112, 368, 341, 99, 340, 341, 102, 193, 194, 101, + /* 770 */ 33, 197, 35, 199, 443, 136, 137, 446, 166, 8, + /* 780 */ 9, 133, 358, 12, 13, 14, 15, 16, 367, 340, + /* 790 */ 341, 468, 469, 462, 141, 142, 59, 466, 467, 100, + /* 800 */ 379, 21, 381, 340, 341, 166, 167, 358, 428, 72, + /* 810 */ 430, 172, 173, 271, 34, 44, 36, 164, 340, 341, + /* 820 */ 165, 358, 269, 130, 131, 186, 181, 188, 135, 346, + /* 830 */ 20, 410, 340, 341, 97, 414, 358, 100, 417, 418, + /* 840 */ 419, 420, 421, 422, 423, 424, 425, 426, 203, 204, + /* 850 */ 358, 212, 213, 370, 215, 216, 217, 218, 219, 220, /* 860 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - /* 870 */ 231, 232, 365, 136, 137, 408, 440, 21, 331, 412, - /* 880 */ 365, 339, 415, 416, 417, 418, 419, 420, 18, 422, - /* 890 */ 34, 377, 36, 23, 427, 377, 429, 355, 365, 364, - /* 900 */ 433, 434, 331, 166, 167, 331, 371, 37, 38, 172, - /* 910 */ 173, 41, 8, 9, 372, 380, 12, 13, 14, 15, - /* 920 */ 16, 130, 131, 186, 377, 188, 135, 37, 356, 59, - /* 930 */ 60, 61, 62, 39, 8, 9, 364, 3, 12, 13, - /* 940 */ 14, 15, 16, 331, 331, 373, 350, 351, 377, 212, - /* 950 */ 213, 377, 215, 216, 217, 218, 219, 220, 221, 222, + /* 870 */ 231, 232, 0, 136, 137, 432, 433, 8, 9, 368, + /* 880 */ 168, 12, 13, 14, 15, 16, 168, 1, 2, 340, + /* 890 */ 341, 236, 428, 18, 430, 20, 340, 341, 20, 368, + /* 900 */ 22, 246, 27, 166, 167, 30, 2, 358, 33, 172, + /* 910 */ 173, 368, 8, 9, 358, 248, 12, 13, 14, 15, + /* 920 */ 16, 2, 4, 186, 49, 188, 51, 8, 9, 54, + /* 930 */ 52, 12, 13, 14, 15, 16, 8, 9, 380, 381, + /* 940 */ 12, 13, 14, 15, 16, 398, 136, 137, 249, 212, + /* 950 */ 213, 20, 215, 216, 217, 218, 219, 220, 221, 222, /* 960 */ 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, - /* 970 */ 100, 18, 364, 20, 331, 350, 351, 364, 155, 371, - /* 980 */ 27, 339, 4, 30, 339, 372, 33, 164, 380, 377, - /* 990 */ 377, 22, 379, 103, 166, 105, 106, 355, 108, 166, - /* 1000 */ 355, 48, 112, 50, 35, 101, 53, 364, 138, 365, - /* 1010 */ 339, 339, 369, 0, 372, 372, 233, 372, 235, 20, - /* 1020 */ 377, 408, 379, 133, 365, 412, 355, 355, 415, 416, - /* 1030 */ 417, 418, 419, 420, 352, 422, 354, 331, 331, 100, - /* 1040 */ 427, 20, 429, 372, 372, 331, 433, 434, 178, 179, - /* 1050 */ 180, 408, 99, 183, 339, 412, 20, 444, 415, 416, - /* 1060 */ 417, 418, 419, 420, 111, 422, 97, 1, 2, 22, - /* 1070 */ 355, 331, 202, 0, 165, 205, 63, 207, 208, 209, - /* 1080 */ 210, 211, 35, 377, 377, 331, 331, 372, 331, 331, - /* 1090 */ 426, 377, 428, 140, 168, 22, 143, 144, 145, 146, - /* 1100 */ 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - /* 1110 */ 157, 158, 159, 339, 161, 162, 163, 377, 71, 249, - /* 1120 */ 339, 44, 364, 339, 185, 339, 187, 339, 401, 355, - /* 1130 */ 372, 377, 377, 44, 377, 377, 355, 379, 331, 355, - /* 1140 */ 372, 355, 248, 355, 97, 236, 372, 360, 372, 357, - /* 1150 */ 211, 383, 360, 372, 374, 246, 372, 377, 372, 383, - /* 1160 */ 372, 45, 46, 247, 248, 166, 408, 101, 0, 374, - /* 1170 */ 412, 364, 377, 415, 416, 417, 418, 419, 420, 372, - /* 1180 */ 422, 42, 44, 44, 377, 427, 379, 429, 249, 168, - /* 1190 */ 101, 433, 434, 406, 22, 374, 0, 331, 377, 42, - /* 1200 */ 44, 44, 444, 269, 168, 104, 104, 35, 107, 107, - /* 1210 */ 104, 104, 44, 107, 107, 408, 136, 137, 22, 412, - /* 1220 */ 331, 58, 415, 416, 417, 418, 419, 420, 250, 422, - /* 1230 */ 364, 353, 44, 186, 427, 188, 429, 198, 372, 200, - /* 1240 */ 433, 434, 0, 377, 35, 379, 44, 96, 1, 2, - /* 1250 */ 332, 444, 387, 364, 64, 44, 44, 101, 13, 212, - /* 1260 */ 213, 372, 469, 44, 22, 102, 377, 458, 379, 44, - /* 1270 */ 44, 44, 44, 44, 408, 44, 35, 44, 412, 44, - /* 1280 */ 35, 415, 416, 417, 418, 419, 420, 47, 422, 101, - /* 1290 */ 44, 341, 44, 427, 44, 429, 44, 408, 331, 433, - /* 1300 */ 434, 412, 44, 101, 415, 416, 417, 418, 419, 420, - /* 1310 */ 444, 422, 101, 101, 12, 13, 427, 341, 429, 168, - /* 1320 */ 101, 0, 433, 434, 22, 35, 101, 101, 101, 101, - /* 1330 */ 101, 364, 101, 444, 101, 33, 101, 35, 452, 372, - /* 1340 */ 100, 13, 387, 33, 377, 364, 379, 101, 271, 101, - /* 1350 */ 338, 101, 387, 101, 443, 376, 435, 331, 48, 101, - /* 1360 */ 58, 71, 462, 35, 54, 55, 56, 57, 58, 446, - /* 1370 */ 49, 251, 410, 71, 48, 408, 184, 409, 398, 412, - /* 1380 */ 331, 42, 415, 416, 417, 418, 419, 420, 384, 422, - /* 1390 */ 364, 20, 387, 384, 427, 165, 429, 188, 372, 97, - /* 1400 */ 433, 434, 212, 377, 382, 379, 20, 339, 339, 99, - /* 1410 */ 382, 273, 102, 364, 384, 382, 98, 95, 339, 349, - /* 1420 */ 348, 372, 347, 94, 339, 339, 377, 396, 379, 188, - /* 1430 */ 339, 20, 333, 333, 408, 20, 20, 403, 412, 345, - /* 1440 */ 379, 415, 416, 417, 418, 419, 420, 20, 422, 345, - /* 1450 */ 340, 20, 397, 427, 345, 429, 345, 408, 340, 433, - /* 1460 */ 434, 412, 331, 339, 415, 416, 417, 418, 419, 420, - /* 1470 */ 345, 422, 441, 345, 345, 52, 445, 342, 429, 169, - /* 1480 */ 170, 333, 433, 434, 174, 342, 176, 364, 186, 339, - /* 1490 */ 188, 460, 461, 333, 364, 364, 465, 466, 364, 377, - /* 1500 */ 364, 364, 192, 372, 364, 364, 364, 201, 377, 364, - /* 1510 */ 379, 331, 407, 364, 212, 213, 364, 100, 405, 343, - /* 1520 */ 403, 377, 191, 377, 343, 339, 379, 225, 226, 227, - /* 1530 */ 228, 229, 230, 231, 331, 402, 377, 258, 451, 408, - /* 1540 */ 387, 387, 257, 412, 364, 177, 415, 416, 417, 418, - /* 1550 */ 419, 420, 372, 422, 392, 377, 392, 377, 266, 379, - /* 1560 */ 429, 377, 377, 451, 433, 434, 451, 364, 454, 268, - /* 1570 */ 267, 450, 453, 470, 448, 372, 449, 252, 248, 410, - /* 1580 */ 377, 272, 379, 275, 270, 372, 20, 414, 408, 340, - /* 1590 */ 339, 20, 412, 392, 390, 415, 416, 417, 418, 419, - /* 1600 */ 420, 377, 422, 343, 343, 170, 331, 392, 343, 429, - /* 1610 */ 389, 408, 343, 433, 434, 412, 377, 100, 415, 416, - /* 1620 */ 417, 418, 419, 420, 421, 422, 423, 424, 463, 331, - /* 1630 */ 464, 377, 377, 377, 377, 372, 360, 432, 100, 364, - /* 1640 */ 368, 377, 354, 19, 339, 36, 334, 372, 333, 358, - /* 1650 */ 343, 358, 377, 358, 379, 344, 329, 33, 399, 393, - /* 1660 */ 393, 0, 364, 331, 0, 0, 404, 42, 0, 35, - /* 1670 */ 372, 206, 48, 35, 35, 377, 35, 379, 54, 55, - /* 1680 */ 56, 57, 58, 408, 206, 0, 35, 412, 35, 331, - /* 1690 */ 415, 416, 417, 418, 419, 420, 364, 422, 206, 0, - /* 1700 */ 206, 0, 35, 0, 372, 22, 408, 0, 35, 377, - /* 1710 */ 412, 379, 193, 415, 416, 417, 418, 419, 420, 188, - /* 1720 */ 422, 186, 364, 99, 0, 0, 102, 429, 0, 182, - /* 1730 */ 372, 181, 434, 0, 0, 377, 47, 379, 0, 0, - /* 1740 */ 408, 0, 467, 468, 412, 0, 42, 415, 416, 417, - /* 1750 */ 418, 419, 420, 331, 422, 0, 0, 0, 134, 155, - /* 1760 */ 0, 35, 155, 0, 0, 0, 408, 0, 0, 0, - /* 1770 */ 412, 0, 0, 415, 416, 417, 418, 419, 420, 0, - /* 1780 */ 422, 0, 0, 0, 0, 331, 364, 0, 0, 457, - /* 1790 */ 0, 0, 0, 169, 372, 0, 0, 0, 174, 377, - /* 1800 */ 42, 379, 0, 0, 0, 0, 0, 22, 0, 0, - /* 1810 */ 331, 0, 0, 139, 190, 0, 192, 459, 364, 96, - /* 1820 */ 22, 22, 0, 96, 58, 0, 372, 0, 35, 0, - /* 1830 */ 408, 377, 58, 379, 412, 58, 0, 415, 416, 417, - /* 1840 */ 418, 419, 420, 364, 422, 44, 0, 47, 369, 42, - /* 1850 */ 0, 372, 39, 14, 14, 39, 377, 47, 379, 331, - /* 1860 */ 40, 47, 408, 0, 0, 39, 412, 177, 0, 415, - /* 1870 */ 416, 417, 418, 419, 420, 331, 422, 0, 424, 0, - /* 1880 */ 0, 0, 65, 35, 39, 48, 0, 408, 35, 48, - /* 1890 */ 468, 412, 364, 39, 415, 416, 417, 418, 419, 420, - /* 1900 */ 372, 422, 0, 48, 35, 377, 39, 379, 364, 0, - /* 1910 */ 35, 39, 0, 369, 48, 0, 372, 0, 0, 35, - /* 1920 */ 0, 377, 22, 379, 331, 35, 107, 109, 35, 35, - /* 1930 */ 35, 35, 44, 44, 35, 22, 408, 0, 35, 35, - /* 1940 */ 412, 331, 0, 415, 416, 417, 418, 419, 420, 22, - /* 1950 */ 422, 22, 408, 0, 22, 50, 412, 364, 331, 415, - /* 1960 */ 416, 417, 418, 419, 420, 372, 422, 0, 35, 35, - /* 1970 */ 377, 0, 379, 35, 364, 0, 22, 20, 35, 35, - /* 1980 */ 35, 0, 372, 101, 35, 100, 0, 377, 22, 379, - /* 1990 */ 0, 364, 168, 170, 0, 3, 175, 100, 168, 372, - /* 2000 */ 44, 408, 168, 253, 377, 412, 379, 331, 415, 416, - /* 2010 */ 417, 418, 419, 420, 44, 422, 100, 189, 408, 96, - /* 2020 */ 101, 100, 412, 331, 98, 415, 416, 417, 418, 419, - /* 2030 */ 420, 96, 422, 44, 95, 408, 3, 101, 47, 412, - /* 2040 */ 364, 331, 415, 416, 417, 418, 419, 420, 372, 422, - /* 2050 */ 44, 101, 100, 377, 47, 379, 364, 44, 100, 100, - /* 2060 */ 44, 101, 100, 35, 372, 101, 101, 35, 47, 377, - /* 2070 */ 35, 379, 35, 35, 364, 35, 47, 101, 101, 0, - /* 2080 */ 44, 0, 372, 100, 408, 247, 253, 377, 412, 379, - /* 2090 */ 331, 415, 416, 417, 418, 419, 420, 253, 422, 0, - /* 2100 */ 408, 0, 39, 47, 412, 100, 331, 415, 416, 417, - /* 2110 */ 418, 419, 420, 0, 422, 101, 101, 100, 408, 100, - /* 2120 */ 100, 39, 412, 364, 169, 415, 416, 417, 418, 419, - /* 2130 */ 420, 372, 422, 110, 100, 47, 377, 44, 379, 364, - /* 2140 */ 171, 98, 234, 98, 2, 22, 100, 372, 101, 100, - /* 2150 */ 47, 101, 377, 212, 379, 100, 47, 22, 101, 100, - /* 2160 */ 100, 214, 101, 331, 100, 111, 101, 408, 35, 35, - /* 2170 */ 100, 412, 101, 35, 415, 416, 417, 418, 419, 420, - /* 2180 */ 331, 422, 35, 408, 100, 35, 101, 412, 101, 100, - /* 2190 */ 415, 416, 417, 418, 419, 420, 364, 422, 100, 35, - /* 2200 */ 123, 101, 100, 123, 372, 22, 112, 100, 100, 377, - /* 2210 */ 44, 379, 35, 364, 123, 123, 100, 22, 65, 64, - /* 2220 */ 35, 372, 35, 35, 35, 35, 377, 35, 379, 331, - /* 2230 */ 71, 35, 93, 35, 35, 35, 35, 44, 35, 35, - /* 2240 */ 408, 22, 35, 35, 412, 331, 35, 415, 416, 417, - /* 2250 */ 418, 419, 420, 71, 422, 35, 35, 408, 35, 35, - /* 2260 */ 35, 412, 364, 22, 415, 416, 417, 418, 419, 420, - /* 2270 */ 372, 422, 35, 0, 35, 377, 48, 379, 364, 39, - /* 2280 */ 0, 48, 35, 39, 0, 35, 372, 39, 0, 35, - /* 2290 */ 48, 377, 39, 379, 331, 0, 35, 48, 35, 0, - /* 2300 */ 22, 22, 21, 20, 22, 471, 408, 21, 471, 471, - /* 2310 */ 412, 471, 471, 415, 416, 417, 418, 419, 420, 331, - /* 2320 */ 422, 471, 408, 471, 471, 471, 412, 364, 471, 415, - /* 2330 */ 416, 417, 418, 419, 420, 372, 422, 471, 471, 471, - /* 2340 */ 377, 471, 379, 331, 471, 471, 471, 471, 471, 471, - /* 2350 */ 471, 471, 364, 471, 471, 471, 471, 471, 471, 471, - /* 2360 */ 372, 471, 471, 471, 471, 377, 471, 379, 471, 471, - /* 2370 */ 471, 408, 471, 471, 471, 412, 364, 471, 415, 416, - /* 2380 */ 417, 418, 419, 420, 372, 422, 471, 471, 471, 377, - /* 2390 */ 471, 379, 471, 471, 471, 471, 408, 471, 471, 471, - /* 2400 */ 412, 471, 471, 415, 416, 417, 418, 419, 420, 471, - /* 2410 */ 422, 471, 471, 471, 331, 471, 471, 471, 471, 471, - /* 2420 */ 408, 471, 471, 471, 412, 471, 471, 415, 416, 417, - /* 2430 */ 418, 419, 420, 471, 422, 471, 331, 471, 471, 471, - /* 2440 */ 471, 471, 471, 471, 471, 471, 471, 364, 471, 471, - /* 2450 */ 471, 471, 471, 471, 471, 372, 471, 471, 471, 471, - /* 2460 */ 377, 471, 379, 331, 471, 471, 471, 471, 471, 364, - /* 2470 */ 471, 471, 471, 471, 471, 471, 471, 372, 471, 471, - /* 2480 */ 471, 471, 377, 471, 379, 471, 471, 471, 471, 471, - /* 2490 */ 471, 408, 471, 471, 471, 412, 364, 471, 415, 416, - /* 2500 */ 417, 418, 419, 420, 372, 422, 471, 471, 471, 377, - /* 2510 */ 471, 379, 331, 408, 471, 471, 471, 412, 471, 471, - /* 2520 */ 415, 416, 417, 418, 419, 420, 471, 422, 331, 471, - /* 2530 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2540 */ 408, 471, 471, 471, 412, 364, 471, 415, 416, 417, - /* 2550 */ 418, 419, 420, 372, 422, 471, 471, 471, 377, 471, - /* 2560 */ 379, 364, 471, 471, 471, 471, 471, 471, 471, 372, - /* 2570 */ 471, 471, 471, 471, 377, 471, 379, 331, 471, 471, - /* 2580 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 408, - /* 2590 */ 471, 471, 471, 412, 471, 471, 415, 416, 417, 418, - /* 2600 */ 419, 420, 471, 422, 471, 408, 471, 471, 471, 412, - /* 2610 */ 364, 471, 415, 416, 417, 418, 419, 420, 372, 422, - /* 2620 */ 471, 471, 471, 377, 471, 379, 471, 471, 471, 471, - /* 2630 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2640 */ 471, 471, 471, 471, 471, 471, 471, 471, 471, 471, - /* 2650 */ 471, 471, 471, 471, 408, 471, 471, 471, 412, 471, - /* 2660 */ 471, 415, 416, 417, 418, 419, 420, 471, 422, + /* 970 */ 101, 340, 341, 112, 99, 0, 443, 353, 354, 446, + /* 980 */ 340, 341, 172, 173, 112, 376, 111, 101, 379, 358, + /* 990 */ 443, 331, 331, 446, 133, 462, 353, 354, 358, 466, + /* 1000 */ 467, 367, 130, 131, 132, 133, 134, 135, 461, 462, + /* 1010 */ 45, 46, 44, 466, 467, 140, 382, 403, 143, 144, + /* 1020 */ 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + /* 1030 */ 155, 156, 157, 158, 159, 398, 161, 162, 163, 379, + /* 1040 */ 379, 368, 67, 68, 69, 70, 71, 331, 73, 74, + /* 1050 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + /* 1060 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 18, + /* 1070 */ 376, 331, 331, 379, 23, 340, 341, 331, 331, 20, + /* 1080 */ 443, 341, 331, 446, 340, 341, 247, 248, 37, 38, + /* 1090 */ 369, 331, 41, 358, 331, 379, 168, 166, 461, 462, + /* 1100 */ 379, 341, 358, 466, 467, 331, 376, 367, 331, 379, + /* 1110 */ 0, 60, 61, 62, 63, 331, 35, 331, 331, 379, + /* 1120 */ 379, 381, 0, 48, 331, 379, 379, 367, 360, 0, + /* 1130 */ 379, 363, 22, 104, 413, 414, 107, 331, 331, 379, + /* 1140 */ 104, 381, 379, 107, 22, 424, 398, 355, 332, 357, + /* 1150 */ 410, 100, 0, 379, 414, 111, 379, 417, 418, 419, + /* 1160 */ 420, 421, 422, 379, 424, 379, 379, 44, 250, 429, + /* 1170 */ 410, 431, 379, 44, 414, 435, 436, 417, 418, 419, + /* 1180 */ 420, 421, 422, 44, 424, 379, 379, 331, 448, 138, + /* 1190 */ 42, 443, 44, 42, 446, 44, 456, 341, 0, 343, + /* 1200 */ 104, 49, 104, 107, 160, 107, 198, 44, 200, 461, + /* 1210 */ 462, 44, 59, 368, 466, 467, 136, 137, 458, 35, + /* 1220 */ 22, 65, 44, 367, 101, 44, 44, 168, 470, 178, + /* 1230 */ 179, 180, 44, 44, 183, 379, 331, 381, 44, 44, + /* 1240 */ 101, 273, 389, 168, 44, 44, 341, 0, 343, 356, + /* 1250 */ 1, 2, 47, 202, 44, 102, 205, 44, 207, 208, + /* 1260 */ 209, 210, 211, 44, 101, 344, 410, 459, 101, 188, + /* 1270 */ 414, 44, 367, 417, 418, 419, 420, 421, 422, 101, + /* 1280 */ 424, 44, 101, 101, 379, 429, 381, 431, 44, 101, + /* 1290 */ 101, 435, 436, 100, 331, 101, 101, 50, 35, 13, + /* 1300 */ 249, 101, 101, 110, 341, 100, 343, 453, 367, 13, + /* 1310 */ 344, 101, 389, 339, 101, 410, 378, 341, 389, 414, + /* 1320 */ 101, 35, 417, 418, 419, 420, 421, 422, 101, 424, + /* 1330 */ 367, 35, 445, 463, 429, 72, 431, 437, 101, 447, + /* 1340 */ 435, 436, 379, 251, 381, 101, 412, 49, 411, 184, + /* 1350 */ 400, 42, 331, 386, 20, 384, 386, 165, 389, 20, + /* 1360 */ 340, 384, 341, 340, 343, 386, 384, 98, 212, 352, + /* 1370 */ 96, 340, 188, 410, 95, 351, 350, 414, 340, 340, + /* 1380 */ 417, 418, 419, 420, 421, 422, 340, 424, 367, 20, + /* 1390 */ 333, 48, 429, 337, 431, 333, 331, 337, 435, 436, + /* 1400 */ 379, 20, 381, 405, 20, 20, 341, 20, 343, 348, + /* 1410 */ 342, 381, 348, 399, 348, 342, 340, 348, 348, 348, + /* 1420 */ 348, 53, 345, 345, 331, 367, 379, 333, 379, 340, + /* 1430 */ 367, 410, 367, 379, 341, 414, 343, 333, 417, 418, + /* 1440 */ 419, 420, 421, 422, 379, 424, 381, 201, 12, 13, + /* 1450 */ 429, 367, 431, 367, 367, 367, 435, 436, 22, 409, + /* 1460 */ 367, 100, 367, 346, 367, 346, 367, 367, 367, 33, + /* 1470 */ 340, 35, 379, 191, 381, 410, 258, 452, 257, 414, + /* 1480 */ 389, 407, 417, 418, 419, 420, 421, 422, 405, 424, + /* 1490 */ 381, 389, 379, 379, 429, 59, 431, 394, 266, 379, + /* 1500 */ 435, 436, 394, 410, 452, 379, 331, 414, 72, 404, + /* 1510 */ 417, 418, 419, 420, 421, 422, 341, 424, 177, 452, + /* 1520 */ 268, 331, 429, 267, 431, 252, 275, 412, 435, 436, + /* 1530 */ 272, 341, 270, 97, 455, 450, 454, 248, 341, 20, + /* 1540 */ 416, 451, 367, 340, 342, 346, 20, 392, 394, 379, + /* 1550 */ 346, 379, 379, 379, 379, 449, 381, 367, 379, 379, + /* 1560 */ 394, 170, 391, 346, 341, 100, 346, 331, 434, 379, + /* 1570 */ 363, 381, 100, 357, 340, 379, 465, 341, 471, 371, + /* 1580 */ 464, 346, 36, 406, 334, 410, 333, 401, 329, 414, + /* 1590 */ 361, 331, 417, 418, 419, 420, 421, 422, 0, 424, + /* 1600 */ 410, 341, 361, 367, 414, 0, 395, 417, 418, 419, + /* 1610 */ 420, 421, 422, 347, 424, 379, 361, 381, 0, 429, + /* 1620 */ 395, 431, 186, 331, 188, 435, 436, 367, 42, 0, + /* 1630 */ 35, 35, 206, 341, 35, 460, 206, 35, 0, 379, + /* 1640 */ 206, 381, 35, 35, 0, 206, 410, 0, 212, 213, + /* 1650 */ 414, 35, 0, 417, 418, 419, 420, 421, 422, 367, + /* 1660 */ 424, 225, 226, 227, 228, 229, 230, 231, 22, 0, + /* 1670 */ 410, 379, 35, 381, 414, 193, 188, 417, 418, 419, + /* 1680 */ 420, 421, 422, 186, 424, 0, 0, 0, 182, 429, + /* 1690 */ 181, 431, 0, 0, 331, 435, 436, 0, 47, 0, + /* 1700 */ 0, 42, 410, 0, 341, 469, 414, 0, 0, 417, + /* 1710 */ 418, 419, 420, 421, 422, 0, 424, 0, 0, 0, + /* 1720 */ 0, 429, 155, 431, 331, 35, 0, 435, 436, 155, + /* 1730 */ 367, 0, 0, 0, 341, 0, 0, 0, 0, 0, + /* 1740 */ 0, 0, 379, 0, 381, 0, 0, 0, 0, 0, + /* 1750 */ 0, 42, 0, 0, 0, 0, 331, 0, 0, 0, + /* 1760 */ 367, 0, 139, 0, 22, 0, 341, 0, 0, 48, + /* 1770 */ 59, 48, 379, 410, 381, 59, 0, 414, 22, 35, + /* 1780 */ 417, 418, 419, 420, 421, 422, 22, 424, 59, 0, + /* 1790 */ 331, 0, 367, 42, 431, 14, 0, 0, 435, 436, + /* 1800 */ 341, 39, 0, 410, 379, 39, 381, 414, 0, 40, + /* 1810 */ 417, 418, 419, 420, 421, 422, 44, 424, 47, 39, + /* 1820 */ 47, 47, 177, 0, 431, 0, 367, 35, 435, 436, + /* 1830 */ 0, 372, 0, 0, 49, 410, 66, 39, 379, 414, + /* 1840 */ 381, 0, 417, 418, 419, 420, 421, 422, 331, 424, + /* 1850 */ 35, 39, 49, 0, 35, 49, 431, 39, 341, 0, + /* 1860 */ 49, 436, 0, 35, 0, 331, 0, 0, 39, 410, + /* 1870 */ 35, 22, 0, 414, 35, 341, 417, 418, 419, 420, + /* 1880 */ 421, 422, 107, 424, 367, 35, 109, 35, 44, 35, + /* 1890 */ 35, 44, 35, 35, 0, 22, 379, 22, 381, 22, + /* 1900 */ 35, 367, 0, 0, 22, 35, 372, 51, 0, 331, + /* 1910 */ 0, 35, 0, 379, 35, 381, 20, 22, 35, 341, + /* 1920 */ 35, 35, 101, 0, 100, 35, 100, 410, 168, 0, + /* 1930 */ 0, 414, 331, 19, 417, 418, 419, 420, 421, 422, + /* 1940 */ 22, 424, 341, 426, 410, 367, 0, 33, 414, 170, + /* 1950 */ 372, 417, 418, 419, 420, 421, 422, 379, 424, 381, + /* 1960 */ 3, 168, 168, 49, 44, 175, 253, 48, 367, 55, + /* 1970 */ 56, 57, 58, 59, 100, 189, 48, 96, 98, 101, + /* 1980 */ 379, 331, 381, 44, 100, 44, 44, 100, 410, 101, + /* 1990 */ 101, 341, 414, 100, 47, 417, 418, 419, 420, 421, + /* 2000 */ 422, 100, 424, 47, 44, 101, 100, 3, 101, 44, + /* 2010 */ 101, 410, 35, 99, 35, 414, 102, 367, 417, 418, + /* 2020 */ 419, 420, 421, 422, 35, 424, 35, 35, 35, 379, + /* 2030 */ 47, 381, 101, 101, 247, 253, 253, 331, 44, 0, + /* 2040 */ 0, 0, 47, 0, 100, 39, 47, 341, 134, 100, + /* 2050 */ 0, 101, 101, 331, 100, 100, 47, 39, 110, 100, + /* 2060 */ 410, 169, 171, 341, 414, 44, 100, 417, 418, 419, + /* 2070 */ 420, 421, 422, 367, 424, 22, 98, 234, 98, 2, + /* 2080 */ 212, 100, 100, 169, 100, 379, 101, 381, 174, 367, + /* 2090 */ 22, 101, 47, 47, 35, 35, 35, 101, 100, 111, + /* 2100 */ 100, 379, 101, 381, 190, 100, 192, 35, 101, 331, + /* 2110 */ 100, 214, 101, 100, 35, 101, 410, 101, 35, 341, + /* 2120 */ 414, 101, 100, 417, 418, 419, 420, 421, 422, 100, + /* 2130 */ 424, 100, 410, 22, 100, 123, 414, 44, 123, 417, + /* 2140 */ 418, 419, 420, 421, 422, 367, 424, 123, 123, 112, + /* 2150 */ 35, 100, 100, 22, 35, 66, 65, 379, 331, 381, + /* 2160 */ 35, 35, 35, 35, 35, 35, 72, 35, 341, 35, + /* 2170 */ 35, 331, 94, 35, 35, 35, 22, 44, 35, 35, + /* 2180 */ 35, 341, 72, 35, 35, 35, 35, 35, 410, 22, + /* 2190 */ 35, 0, 414, 0, 367, 417, 418, 419, 420, 421, + /* 2200 */ 422, 35, 424, 39, 35, 49, 379, 367, 381, 49, + /* 2210 */ 39, 0, 35, 39, 49, 0, 35, 49, 39, 379, + /* 2220 */ 0, 381, 35, 35, 0, 22, 21, 472, 22, 21, + /* 2230 */ 331, 22, 20, 472, 472, 472, 472, 410, 472, 472, + /* 2240 */ 341, 414, 472, 472, 417, 418, 419, 420, 421, 422, + /* 2250 */ 410, 424, 472, 472, 414, 472, 472, 417, 418, 419, + /* 2260 */ 420, 421, 422, 472, 424, 472, 367, 472, 472, 472, + /* 2270 */ 472, 472, 472, 472, 331, 472, 472, 472, 379, 472, + /* 2280 */ 381, 472, 472, 472, 341, 472, 472, 472, 472, 331, + /* 2290 */ 472, 472, 472, 472, 472, 472, 472, 472, 472, 341, + /* 2300 */ 472, 472, 331, 472, 472, 472, 472, 472, 472, 410, + /* 2310 */ 367, 472, 341, 414, 472, 472, 417, 418, 419, 420, + /* 2320 */ 421, 422, 379, 424, 381, 367, 472, 472, 472, 472, + /* 2330 */ 472, 472, 472, 472, 472, 472, 472, 379, 367, 381, + /* 2340 */ 472, 472, 472, 472, 472, 472, 472, 472, 331, 472, + /* 2350 */ 379, 472, 381, 410, 472, 472, 472, 414, 341, 472, + /* 2360 */ 417, 418, 419, 420, 421, 422, 472, 424, 410, 472, + /* 2370 */ 472, 472, 414, 472, 472, 417, 418, 419, 420, 421, + /* 2380 */ 422, 410, 424, 472, 367, 414, 472, 33, 417, 418, + /* 2390 */ 419, 420, 421, 422, 472, 424, 379, 472, 381, 472, + /* 2400 */ 472, 472, 472, 49, 331, 472, 472, 472, 472, 55, + /* 2410 */ 56, 57, 58, 59, 341, 472, 472, 472, 472, 331, + /* 2420 */ 472, 472, 472, 472, 472, 472, 472, 410, 472, 341, + /* 2430 */ 472, 414, 472, 472, 417, 418, 419, 420, 421, 422, + /* 2440 */ 367, 424, 472, 472, 472, 472, 472, 472, 472, 472, + /* 2450 */ 472, 472, 379, 99, 381, 367, 102, 472, 472, 472, + /* 2460 */ 472, 472, 472, 472, 472, 472, 472, 379, 331, 381, + /* 2470 */ 472, 472, 472, 472, 472, 472, 472, 472, 341, 472, + /* 2480 */ 472, 472, 472, 410, 472, 472, 472, 414, 472, 331, + /* 2490 */ 417, 418, 419, 420, 421, 422, 472, 424, 410, 341, + /* 2500 */ 472, 472, 414, 472, 367, 417, 418, 419, 420, 421, + /* 2510 */ 422, 472, 424, 472, 472, 472, 379, 472, 381, 472, + /* 2520 */ 472, 472, 472, 169, 170, 367, 472, 472, 174, 472, + /* 2530 */ 176, 472, 472, 472, 472, 472, 472, 379, 331, 381, + /* 2540 */ 472, 472, 472, 472, 472, 472, 192, 410, 341, 472, + /* 2550 */ 472, 414, 472, 331, 417, 418, 419, 420, 421, 422, + /* 2560 */ 472, 424, 472, 341, 472, 472, 472, 472, 410, 472, + /* 2570 */ 472, 472, 414, 472, 367, 417, 418, 419, 420, 421, + /* 2580 */ 422, 472, 424, 472, 472, 472, 379, 472, 381, 367, + /* 2590 */ 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, + /* 2600 */ 472, 379, 472, 381, 472, 472, 472, 472, 472, 472, + /* 2610 */ 472, 472, 331, 472, 472, 472, 472, 410, 472, 472, + /* 2620 */ 472, 414, 341, 472, 417, 418, 419, 420, 421, 422, + /* 2630 */ 472, 424, 410, 472, 472, 472, 414, 472, 472, 417, + /* 2640 */ 418, 419, 420, 421, 422, 472, 424, 472, 367, 472, + /* 2650 */ 472, 472, 472, 472, 472, 472, 331, 472, 472, 472, + /* 2660 */ 379, 472, 381, 472, 472, 472, 341, 472, 472, 472, + /* 2670 */ 472, 331, 472, 472, 472, 472, 472, 472, 472, 472, + /* 2680 */ 472, 341, 472, 472, 331, 472, 472, 472, 472, 472, + /* 2690 */ 472, 410, 367, 472, 341, 414, 472, 472, 417, 418, + /* 2700 */ 419, 420, 421, 422, 379, 424, 381, 367, 472, 472, + /* 2710 */ 472, 472, 472, 472, 472, 472, 472, 472, 472, 379, + /* 2720 */ 367, 381, 472, 472, 472, 472, 472, 472, 472, 472, + /* 2730 */ 472, 472, 379, 472, 381, 410, 472, 472, 472, 414, + /* 2740 */ 472, 472, 417, 418, 419, 420, 421, 422, 472, 424, + /* 2750 */ 410, 472, 472, 472, 414, 472, 472, 417, 418, 419, + /* 2760 */ 420, 421, 422, 410, 424, 472, 472, 414, 472, 472, + /* 2770 */ 417, 418, 419, 420, 421, 422, 472, 424, }; -#define YY_SHIFT_COUNT (751) +#define YY_SHIFT_COUNT (754) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2299) +#define YY_SHIFT_MAX (2354) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 870, 0, 98, 0, 320, 320, 320, 320, 320, 320, - /* 10 */ 320, 320, 320, 320, 320, 418, 639, 639, 737, 639, + /* 0 */ 1051, 0, 98, 0, 320, 320, 320, 320, 320, 320, + /* 10 */ 320, 320, 320, 320, 320, 320, 418, 639, 639, 737, /* 20 */ 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, /* 30 */ 639, 639, 639, 639, 639, 639, 639, 639, 639, 639, - /* 40 */ 639, 639, 639, 639, 639, 639, 639, 639, 28, 30, - /* 50 */ 939, 17, 509, 380, 420, 380, 17, 17, 1302, 1302, - /* 60 */ 1302, 380, 1302, 1302, 190, 380, 87, 323, 186, 186, - /* 70 */ 323, 89, 89, 315, 145, 14, 14, 186, 186, 186, - /* 80 */ 186, 186, 186, 186, 221, 186, 186, 226, 87, 186, - /* 90 */ 186, 289, 186, 87, 186, 221, 186, 221, 87, 186, - /* 100 */ 186, 87, 186, 87, 87, 87, 186, 281, 953, 285, - /* 110 */ 285, 331, 150, 1047, 1047, 1047, 1047, 1047, 1047, 1047, - /* 120 */ 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, 1047, - /* 130 */ 1047, 1047, 890, 594, 315, 145, 162, 171, 171, 171, - /* 140 */ 1013, 783, 783, 162, 372, 372, 372, 226, 274, 508, - /* 150 */ 87, 485, 87, 485, 485, 488, 703, 244, 244, 244, - /* 160 */ 244, 244, 244, 244, 244, 1624, 334, 473, 260, 100, - /* 170 */ 183, 25, 179, 828, 833, 326, 1021, 1116, 352, 1036, - /* 180 */ 916, 894, 934, 916, 1139, 978, 999, 1120, 1326, 1192, - /* 190 */ 1339, 1371, 1339, 1230, 1386, 1386, 1339, 1230, 1230, 1318, - /* 200 */ 1322, 1386, 1329, 1386, 1386, 1386, 1411, 1411, 1415, 226, - /* 210 */ 1416, 226, 1427, 1431, 226, 1427, 226, 226, 226, 1386, - /* 220 */ 226, 1423, 1423, 1411, 87, 87, 87, 87, 87, 87, - /* 230 */ 87, 87, 87, 87, 87, 1386, 1411, 485, 485, 485, - /* 240 */ 1306, 1417, 1415, 281, 1331, 1416, 281, 1386, 1371, 1371, - /* 250 */ 485, 1279, 1285, 485, 1279, 1285, 485, 485, 87, 1292, - /* 260 */ 1368, 1279, 1301, 1303, 1325, 1120, 1308, 1309, 1314, 1330, - /* 270 */ 372, 1566, 1386, 1427, 281, 281, 1571, 1285, 485, 485, - /* 280 */ 485, 485, 485, 1285, 485, 1435, 281, 488, 281, 372, - /* 290 */ 1517, 1538, 485, 703, 1386, 281, 1609, 1411, 2669, 2669, - /* 300 */ 2669, 2669, 2669, 2669, 2669, 2669, 2669, 170, 1310, 534, - /* 310 */ 687, 561, 580, 904, 379, 139, 374, 926, 621, 699, - /* 320 */ 699, 699, 699, 699, 699, 699, 699, 699, 173, 597, - /* 330 */ 27, 27, 439, 451, 823, 294, 419, 969, 856, 387, - /* 340 */ 791, 791, 710, 1066, 909, 710, 710, 710, 31, 1089, - /* 350 */ 1172, 1157, 588, 1168, 1101, 1102, 1106, 1107, 1073, 1196, - /* 360 */ 1242, 1039, 1156, 1188, 1163, 1202, 1211, 1212, 1080, 1077, - /* 370 */ 1138, 1151, 1219, 1225, 1226, 1227, 1228, 1229, 1247, 1231, - /* 380 */ 1209, 1241, 1190, 1233, 1240, 1235, 1246, 1248, 1250, 1252, - /* 390 */ 1258, 101, 1245, 1328, 1290, 1321, 1661, 1664, 1665, 1625, - /* 400 */ 1668, 1634, 1465, 1638, 1639, 1641, 1478, 1685, 1651, 1653, - /* 410 */ 1492, 1699, 1494, 1701, 1667, 1703, 1683, 1707, 1673, 1519, - /* 420 */ 1531, 1535, 1724, 1725, 1728, 1547, 1550, 1733, 1734, 1689, - /* 430 */ 1738, 1739, 1741, 1704, 1745, 1755, 1756, 1757, 1767, 1768, - /* 440 */ 1769, 1771, 1604, 1726, 1760, 1607, 1763, 1764, 1765, 1772, - /* 450 */ 1779, 1781, 1782, 1783, 1784, 1787, 1788, 1790, 1791, 1792, - /* 460 */ 1795, 1796, 1758, 1797, 1802, 1803, 1804, 1805, 1806, 1785, - /* 470 */ 1808, 1809, 1811, 1674, 1812, 1815, 1798, 1723, 1799, 1727, - /* 480 */ 1822, 1766, 1793, 1825, 1774, 1827, 1777, 1829, 1836, 1807, - /* 490 */ 1813, 1801, 1800, 1839, 1810, 1840, 1814, 1846, 1820, 1816, - /* 500 */ 1850, 1863, 1864, 1826, 1690, 1868, 1877, 1879, 1817, 1880, - /* 510 */ 1881, 1848, 1837, 1845, 1886, 1853, 1841, 1854, 1902, 1869, - /* 520 */ 1855, 1867, 1909, 1875, 1866, 1872, 1912, 1915, 1917, 1918, - /* 530 */ 1818, 1819, 1884, 1900, 1920, 1890, 1893, 1894, 1895, 1896, - /* 540 */ 1888, 1889, 1899, 1903, 1913, 1904, 1937, 1927, 1942, 1929, - /* 550 */ 1905, 1953, 1932, 1933, 1967, 1934, 1971, 1938, 1975, 1954, - /* 560 */ 1957, 1943, 1944, 1945, 1882, 1885, 1981, 1824, 1897, 1949, - /* 570 */ 1986, 1828, 1966, 1830, 1823, 1990, 1994, 1834, 1821, 1992, - /* 580 */ 1956, 1750, 1916, 1919, 1921, 1923, 1926, 1935, 1939, 1936, - /* 590 */ 1970, 1989, 1950, 1952, 1958, 1959, 1960, 2006, 1991, 2007, - /* 600 */ 1962, 2013, 1833, 1964, 1965, 2033, 2016, 1844, 2028, 2032, - /* 610 */ 2035, 2037, 2038, 2040, 1976, 1977, 2021, 1838, 2036, 2029, - /* 620 */ 2079, 2081, 2099, 2101, 1983, 2063, 1800, 2056, 2005, 2014, - /* 630 */ 2015, 2017, 2019, 1969, 2020, 2113, 2082, 1955, 2034, 2023, - /* 640 */ 1800, 2088, 2093, 2043, 1908, 2045, 2142, 2123, 1941, 2046, - /* 650 */ 2047, 2049, 2050, 2055, 2057, 2103, 2059, 2060, 2109, 2061, - /* 660 */ 2135, 1947, 2064, 2054, 2065, 2133, 2134, 2070, 2071, 2138, - /* 670 */ 2084, 2085, 2147, 2089, 2087, 2150, 2098, 2100, 2164, 2102, - /* 680 */ 2077, 2080, 2091, 2092, 2183, 2094, 2107, 2166, 2108, 2177, - /* 690 */ 2116, 2166, 2166, 2195, 2153, 2155, 2185, 2187, 2188, 2189, - /* 700 */ 2190, 2192, 2196, 2198, 2199, 2200, 2159, 2139, 2193, 2201, - /* 710 */ 2203, 2204, 2219, 2207, 2208, 2211, 2182, 1888, 2220, 1889, - /* 720 */ 2221, 2223, 2224, 2225, 2241, 2237, 2273, 2239, 2228, 2240, - /* 730 */ 2280, 2247, 2233, 2244, 2284, 2250, 2242, 2248, 2288, 2254, - /* 740 */ 2249, 2253, 2295, 2261, 2263, 2299, 2278, 2281, 2279, 2282, - /* 750 */ 2286, 2283, + /* 40 */ 639, 639, 639, 639, 639, 639, 639, 639, 639, 148, + /* 50 */ 180, 58, 64, 321, 358, 699, 358, 64, 64, 1436, + /* 60 */ 1436, 1436, 358, 1436, 1436, 59, 358, 85, 810, 157, + /* 70 */ 157, 810, 146, 146, 75, 289, 32, 32, 157, 157, + /* 80 */ 157, 157, 157, 157, 157, 170, 157, 157, 3, 85, + /* 90 */ 157, 157, 281, 157, 85, 157, 170, 157, 170, 85, + /* 100 */ 157, 157, 85, 157, 85, 85, 85, 157, 182, 875, + /* 110 */ 15, 15, 314, 13, 90, 90, 90, 90, 90, 90, + /* 120 */ 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + /* 130 */ 90, 90, 90, 648, 413, 75, 289, 47, 489, 489, + /* 140 */ 489, 209, 432, 432, 47, 344, 344, 344, 3, 280, + /* 150 */ 245, 85, 503, 85, 503, 503, 644, 581, 496, 496, + /* 160 */ 496, 496, 496, 496, 496, 496, 1914, 214, 341, 712, + /* 170 */ 395, 84, 29, 265, 271, 612, 878, 718, 965, 382, + /* 180 */ 861, 1059, 839, 667, 553, 839, 1148, 918, 931, 1092, + /* 190 */ 1298, 1165, 1309, 1334, 1309, 1192, 1339, 1339, 1309, 1192, + /* 200 */ 1192, 1269, 1274, 1339, 1279, 1339, 1339, 1339, 1369, 1343, + /* 210 */ 1369, 1343, 1381, 3, 1384, 3, 1385, 1387, 3, 1385, + /* 220 */ 3, 3, 3, 1339, 3, 1368, 1368, 1369, 85, 85, + /* 230 */ 85, 85, 85, 85, 85, 85, 85, 85, 85, 1339, + /* 240 */ 1369, 503, 503, 503, 1246, 1361, 1381, 182, 1282, 1384, + /* 250 */ 182, 1339, 1334, 1334, 503, 1218, 1221, 503, 1218, 1221, + /* 260 */ 503, 503, 85, 1232, 1341, 1218, 1252, 1256, 1273, 1092, + /* 270 */ 1251, 1258, 1262, 1289, 344, 1519, 1339, 1385, 182, 182, + /* 280 */ 1526, 1221, 503, 503, 503, 503, 503, 1221, 503, 1391, + /* 290 */ 182, 644, 182, 344, 1465, 1472, 503, 581, 1339, 182, + /* 300 */ 1546, 1369, 2778, 2778, 2778, 2778, 2778, 2778, 2778, 2778, + /* 310 */ 2778, 975, 2354, 439, 664, 467, 771, 869, 312, 904, + /* 320 */ 919, 928, 872, 680, 680, 680, 680, 680, 680, 680, + /* 330 */ 680, 680, 226, 574, 362, 362, 653, 645, 140, 499, + /* 340 */ 472, 649, 780, 254, 693, 693, 613, 886, 655, 613, + /* 350 */ 613, 613, 1152, 668, 74, 1151, 1044, 1129, 1029, 1036, + /* 360 */ 1096, 1098, 1110, 1122, 1198, 1008, 1123, 1139, 1153, 1163, + /* 370 */ 1167, 1178, 1080, 542, 968, 1075, 1181, 1182, 1188, 1189, + /* 380 */ 1194, 1195, 1249, 1200, 1081, 1184, 1156, 1201, 1205, 1210, + /* 390 */ 1213, 1219, 1227, 1237, 1244, 1193, 1286, 1296, 1263, 1247, + /* 400 */ 1598, 1605, 1618, 1586, 1629, 1595, 1426, 1596, 1599, 1602, + /* 410 */ 1430, 1638, 1607, 1608, 1434, 1644, 1439, 1647, 1616, 1652, + /* 420 */ 1646, 1669, 1637, 1482, 1488, 1497, 1685, 1686, 1687, 1506, + /* 430 */ 1509, 1692, 1693, 1651, 1697, 1699, 1700, 1659, 1703, 1707, + /* 440 */ 1708, 1715, 1717, 1718, 1719, 1720, 1567, 1690, 1726, 1574, + /* 450 */ 1731, 1732, 1733, 1735, 1736, 1737, 1738, 1739, 1740, 1741, + /* 460 */ 1743, 1745, 1746, 1747, 1748, 1749, 1709, 1750, 1752, 1753, + /* 470 */ 1754, 1755, 1757, 1742, 1758, 1759, 1761, 1623, 1763, 1765, + /* 480 */ 1756, 1721, 1764, 1723, 1767, 1711, 1744, 1768, 1716, 1776, + /* 490 */ 1729, 1789, 1791, 1751, 1762, 1772, 1771, 1773, 1781, 1774, + /* 500 */ 1796, 1769, 1766, 1797, 1802, 1808, 1780, 1645, 1823, 1825, + /* 510 */ 1830, 1770, 1832, 1833, 1792, 1785, 1798, 1841, 1815, 1803, + /* 520 */ 1812, 1853, 1819, 1806, 1818, 1859, 1828, 1811, 1829, 1862, + /* 530 */ 1864, 1866, 1867, 1777, 1775, 1835, 1849, 1872, 1839, 1850, + /* 540 */ 1852, 1854, 1855, 1844, 1847, 1857, 1858, 1873, 1865, 1894, + /* 550 */ 1875, 1902, 1877, 1856, 1903, 1882, 1870, 1908, 1876, 1910, + /* 560 */ 1879, 1912, 1895, 1896, 1883, 1885, 1886, 1821, 1824, 1923, + /* 570 */ 1760, 1826, 1890, 1929, 1786, 1918, 1793, 1779, 1930, 1946, + /* 580 */ 1794, 1790, 1957, 1920, 1713, 1874, 1878, 1884, 1919, 1880, + /* 590 */ 1928, 1881, 1888, 1939, 1941, 1889, 1887, 1893, 1901, 1904, + /* 600 */ 1942, 1947, 1956, 1906, 1960, 1782, 1907, 1909, 2004, 1965, + /* 610 */ 1783, 1977, 1979, 1989, 1991, 1992, 1993, 1931, 1932, 1983, + /* 620 */ 1787, 1994, 1995, 2039, 2040, 2041, 2043, 1944, 2006, 1771, + /* 630 */ 1999, 1949, 1950, 1951, 1954, 1955, 1891, 1959, 2050, 2018, + /* 640 */ 1892, 1966, 1948, 1771, 2009, 2021, 1978, 1843, 1980, 2077, + /* 650 */ 2053, 1868, 1981, 1985, 1982, 1990, 1984, 1996, 2045, 1998, + /* 660 */ 2000, 2046, 2001, 2068, 1897, 2005, 1988, 2007, 2059, 2060, + /* 670 */ 2010, 2011, 2061, 2013, 2014, 2072, 2022, 2016, 2079, 2029, + /* 680 */ 2020, 2083, 2031, 2012, 2015, 2024, 2025, 2111, 2037, 2034, + /* 690 */ 2093, 2051, 2115, 2052, 2093, 2093, 2131, 2089, 2091, 2119, + /* 700 */ 2125, 2126, 2127, 2128, 2129, 2130, 2132, 2134, 2135, 2094, + /* 710 */ 2078, 2133, 2138, 2139, 2140, 2154, 2143, 2144, 2145, 2110, + /* 720 */ 1844, 2148, 1847, 2149, 2150, 2151, 2152, 2167, 2155, 2191, + /* 730 */ 2166, 2156, 2164, 2193, 2169, 2160, 2171, 2211, 2177, 2165, + /* 740 */ 2174, 2215, 2181, 2168, 2179, 2220, 2187, 2188, 2224, 2203, + /* 750 */ 2205, 2206, 2209, 2208, 2212, }; -#define YY_REDUCE_COUNT (306) -#define YY_REDUCE_MIN (-436) -#define YY_REDUCE_MAX (2246) +#define YY_REDUCE_COUNT (310) +#define YY_REDUCE_MIN (-378) +#define YY_REDUCE_MAX (2353) static const short yy_reduce_ofst[] = { - /* 0 */ -258, -328, 50, 248, 613, 758, 807, 866, 889, 467, - /* 10 */ 967, 1026, 1049, 1131, 1180, 1203, 365, 1275, 1298, 1332, - /* 20 */ 1358, 1422, 643, 1454, 1479, 1544, 1528, 1593, 1610, 1627, - /* 30 */ 1676, 1692, 1710, 1759, 1775, 1832, 1849, 1898, 1914, 1963, - /* 40 */ 1988, 2012, 2083, 2105, 2132, 2181, 2197, 2246, -316, -302, - /* 50 */ 157, 247, -256, 257, 375, 1031, 362, 391, -359, -345, - /* 60 */ -339, -436, -75, 402, -380, -178, -354, -195, 318, 332, - /* 70 */ -379, -145, 88, -282, -218, -44, 232, 116, 135, 337, - /* 80 */ 366, 388, 392, 454, -333, 542, 642, 91, -26, 645, - /* 90 */ 671, 241, 672, 236, 715, 377, 774, 427, 405, 781, - /* 100 */ 784, 535, 786, 446, 608, 572, 788, 8, -335, -19, - /* 110 */ -19, -251, -234, -163, -65, 72, 369, 461, 466, 514, - /* 120 */ 518, 547, 571, 574, 612, 706, 707, 714, 740, 754, - /* 130 */ 755, 757, 252, 23, -240, 300, 596, 23, 279, 436, - /* 140 */ 13, 182, 664, 625, 435, 768, 776, 256, 787, -417, - /* 150 */ 214, 780, -305, 795, 821, 792, 682, -364, 423, 507, - /* 160 */ 515, 533, 644, 659, 533, 727, 878, 918, 865, 793, - /* 170 */ 809, 950, 886, 981, 981, 976, 955, 1012, 979, 965, - /* 180 */ 911, 911, 900, 911, 921, 923, 981, 962, 968, 980, - /* 190 */ 1004, 1005, 1009, 1022, 1068, 1069, 1030, 1028, 1033, 1070, - /* 200 */ 1072, 1079, 1075, 1085, 1086, 1091, 1099, 1100, 1034, 1094, - /* 210 */ 1061, 1104, 1110, 1055, 1109, 1118, 1111, 1125, 1128, 1124, - /* 220 */ 1129, 1135, 1143, 1148, 1123, 1130, 1134, 1136, 1137, 1140, - /* 230 */ 1141, 1142, 1145, 1149, 1152, 1150, 1160, 1122, 1144, 1146, - /* 240 */ 1105, 1113, 1117, 1176, 1133, 1147, 1181, 1186, 1153, 1154, - /* 250 */ 1159, 1087, 1162, 1178, 1112, 1164, 1184, 1185, 981, 1114, - /* 260 */ 1119, 1115, 1121, 1127, 1126, 1169, 1103, 1166, 1165, 911, - /* 270 */ 1213, 1173, 1251, 1249, 1260, 1261, 1204, 1201, 1224, 1239, - /* 280 */ 1254, 1255, 1256, 1215, 1257, 1221, 1265, 1276, 1269, 1263, - /* 290 */ 1205, 1272, 1264, 1288, 1305, 1307, 1312, 1315, 1259, 1262, - /* 300 */ 1266, 1267, 1291, 1293, 1295, 1311, 1327, + /* 0 */ -199, 740, -275, 143, 856, 905, 963, 1021, 1065, 1093, + /* 10 */ 1190, 1260, 1292, 81, 1363, 1393, 421, -331, 323, 1425, + /* 20 */ 760, 1175, 1236, 1459, 1517, 1534, 1578, 1601, 1650, 1706, + /* 30 */ 1722, 1778, 1827, 1840, 1899, 1943, 1958, 1971, 2017, 2073, + /* 40 */ 2088, 2137, 2158, 2207, 2222, 2281, 2325, 2340, 2353, -265, + /* 50 */ 220, -345, -233, -48, 547, 637, 748, 87, 236, -353, + /* 60 */ -231, -175, -169, -311, 721, 331, 533, 221, -378, -333, + /* 70 */ 94, -327, -334, -261, -273, -144, -208, -171, -6, -4, + /* 80 */ 114, 242, 315, 359, 390, 121, 424, 449, -98, -365, + /* 90 */ 463, 478, -320, 492, -95, 549, 133, 556, 268, 129, + /* 100 */ 631, 640, 19, 735, 230, 334, 303, 744, 345, 23, + /* 110 */ 443, 443, -226, -179, 8, 240, 379, 660, 661, 716, + /* 120 */ 741, 746, 747, 751, 763, 774, 777, 784, 786, 787, + /* 130 */ 793, 806, 807, -293, -1, 347, 558, 624, -1, 150, + /* 140 */ 287, 483, 380, 464, 643, -330, -200, 144, 186, -57, + /* 150 */ 292, 122, 609, 634, 694, 730, 768, 792, -362, 393, + /* 160 */ 511, 531, 543, 673, 845, 543, 614, 893, 816, 853, + /* 170 */ 758, 808, 921, 854, 941, 941, 966, 923, 974, 976, + /* 180 */ 938, 929, 887, 887, 870, 887, 900, 892, 941, 934, + /* 190 */ 937, 950, 967, 969, 970, 971, 1020, 1023, 979, 977, + /* 200 */ 982, 1017, 1024, 1031, 1026, 1038, 1039, 1046, 1057, 1056, + /* 210 */ 1062, 1060, 998, 1061, 1030, 1064, 1068, 1014, 1066, 1073, + /* 220 */ 1069, 1070, 1071, 1076, 1072, 1077, 1078, 1094, 1058, 1063, + /* 230 */ 1084, 1086, 1087, 1088, 1095, 1097, 1099, 1100, 1101, 1089, + /* 240 */ 1104, 1047, 1049, 1054, 1050, 1074, 1083, 1117, 1105, 1109, + /* 250 */ 1119, 1130, 1091, 1102, 1113, 1025, 1103, 1114, 1052, 1108, + /* 260 */ 1120, 1126, 941, 1079, 1082, 1067, 1090, 1085, 1106, 1115, + /* 270 */ 1107, 1111, 1116, 887, 1197, 1124, 1203, 1202, 1199, 1204, + /* 280 */ 1155, 1154, 1170, 1172, 1173, 1174, 1179, 1166, 1180, 1171, + /* 290 */ 1217, 1207, 1220, 1223, 1134, 1208, 1196, 1216, 1234, 1235, + /* 300 */ 1250, 1253, 1186, 1177, 1211, 1225, 1229, 1241, 1255, 1266, + /* 310 */ 1259, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 10 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 20 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 30 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 40 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 50 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 60 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 70 */ 1690, 1690, 1690, 1957, 1690, 1690, 1690, 1690, 1690, 1690, - /* 80 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1769, 1690, 1690, - /* 90 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 100 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1767, 1950, 2166, - /* 110 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 120 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 130 */ 1690, 1690, 1690, 2178, 1690, 1690, 1690, 2178, 2178, 2178, - /* 140 */ 1767, 2138, 2138, 1690, 1690, 1690, 1690, 1769, 2011, 1690, - /* 150 */ 1690, 1690, 1690, 1690, 1690, 1885, 1690, 1690, 1690, 1690, - /* 160 */ 1690, 1909, 1690, 1690, 1690, 2003, 1690, 1690, 2203, 2259, - /* 170 */ 1690, 1690, 2206, 1690, 1690, 1690, 1962, 1690, 1838, 2193, - /* 180 */ 2170, 2184, 2243, 2171, 2168, 2187, 1690, 2197, 1690, 1996, - /* 190 */ 1955, 1690, 1955, 1952, 1690, 1690, 1955, 1952, 1952, 1827, - /* 200 */ 1823, 1690, 1821, 1690, 1690, 1690, 1690, 1690, 1690, 1769, - /* 210 */ 1690, 1769, 1690, 1690, 1769, 1690, 1769, 1769, 1769, 1690, - /* 220 */ 1769, 1747, 1747, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 230 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 240 */ 2023, 2009, 1690, 1767, 2005, 1690, 1767, 1690, 1690, 1690, - /* 250 */ 1690, 2214, 2212, 1690, 2214, 2212, 1690, 1690, 1690, 2228, - /* 260 */ 2224, 2214, 2232, 2230, 2199, 2197, 2262, 2249, 2245, 2184, - /* 270 */ 1690, 1690, 1690, 1690, 1767, 1767, 1690, 2212, 1690, 1690, - /* 280 */ 1690, 1690, 1690, 2212, 1690, 1690, 1767, 1690, 1767, 1690, - /* 290 */ 1690, 1854, 1690, 1690, 1690, 1767, 1722, 1690, 1998, 2014, - /* 300 */ 1980, 1980, 1888, 1888, 1888, 1770, 1695, 1690, 1690, 1690, - /* 310 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2227, - /* 320 */ 2226, 2093, 1690, 2142, 2141, 2140, 2131, 2092, 1850, 1690, - /* 330 */ 2091, 2090, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 340 */ 1971, 1970, 2084, 1690, 1690, 2085, 2083, 2082, 1690, 1690, - /* 350 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 360 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2246, - /* 370 */ 2250, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2167, 1690, - /* 380 */ 1690, 1690, 1690, 1690, 2066, 1690, 1690, 1690, 1690, 1690, - /* 390 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 400 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 410 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 420 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 430 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 440 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 450 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 460 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 470 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 480 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 490 */ 1690, 1727, 2071, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 500 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 510 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 520 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 530 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 540 */ 1808, 1807, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 550 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 560 */ 1690, 1690, 1690, 1690, 2075, 1690, 1690, 1690, 1690, 1690, - /* 570 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2242, - /* 580 */ 2200, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 590 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2066, - /* 600 */ 1690, 2225, 1690, 1690, 2240, 1690, 2244, 1690, 1690, 1690, - /* 610 */ 1690, 1690, 1690, 1690, 2177, 2173, 1690, 1690, 2169, 1690, - /* 620 */ 1690, 1690, 1690, 1690, 1690, 1690, 2074, 1690, 1690, 1690, - /* 630 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 640 */ 2065, 1690, 2128, 1690, 1690, 1690, 2162, 1690, 1690, 2113, - /* 650 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 2075, - /* 660 */ 1690, 2078, 1690, 1690, 1690, 1690, 1690, 1882, 1690, 1690, - /* 670 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 680 */ 1867, 1865, 1864, 1863, 1690, 1860, 1690, 1895, 1690, 1690, - /* 690 */ 1690, 1891, 1890, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 700 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1788, 1690, - /* 710 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1780, 1690, 1779, - /* 720 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 730 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 740 */ 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, - /* 750 */ 1690, 1690, + /* 0 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 10 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 20 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 30 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 40 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 50 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 60 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 70 */ 1698, 1698, 1698, 1698, 1968, 1698, 1698, 1698, 1698, 1698, + /* 80 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1780, 1698, + /* 90 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 100 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1778, 1961, + /* 110 */ 2177, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 120 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 130 */ 1698, 1698, 1698, 1698, 2189, 1698, 1698, 1698, 2189, 2189, + /* 140 */ 2189, 1778, 2149, 2149, 1698, 1698, 1698, 1698, 1780, 2022, + /* 150 */ 1698, 1698, 1698, 1698, 1698, 1698, 1896, 1698, 1698, 1698, + /* 160 */ 1698, 1698, 1920, 1698, 1698, 1698, 2014, 1698, 1698, 2214, + /* 170 */ 2270, 1698, 1698, 2217, 1698, 1698, 1698, 1973, 1698, 1698, + /* 180 */ 1849, 2204, 2181, 2195, 2254, 2182, 2179, 2198, 1698, 2208, + /* 190 */ 1698, 2007, 1966, 1698, 1966, 1963, 1698, 1698, 1966, 1963, + /* 200 */ 1963, 1838, 1834, 1698, 1832, 1698, 1698, 1698, 1698, 1745, + /* 210 */ 1698, 1745, 1698, 1780, 1698, 1780, 1698, 1698, 1780, 1698, + /* 220 */ 1780, 1780, 1780, 1698, 1780, 1758, 1758, 1698, 1698, 1698, + /* 230 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 240 */ 1698, 1698, 1698, 1698, 2034, 2020, 1698, 1778, 2016, 1698, + /* 250 */ 1778, 1698, 1698, 1698, 1698, 2225, 2223, 1698, 2225, 2223, + /* 260 */ 1698, 1698, 1698, 2239, 2235, 2225, 2243, 2241, 2210, 2208, + /* 270 */ 2273, 2260, 2256, 2195, 1698, 1698, 1698, 1698, 1778, 1778, + /* 280 */ 1698, 2223, 1698, 1698, 1698, 1698, 1698, 2223, 1698, 1698, + /* 290 */ 1778, 1698, 1778, 1698, 1698, 1865, 1698, 1698, 1698, 1778, + /* 300 */ 1730, 1698, 2009, 2025, 1991, 1991, 1899, 1899, 1899, 1781, + /* 310 */ 1703, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 320 */ 1698, 1698, 1698, 2238, 2237, 2104, 1698, 2153, 2152, 2151, + /* 330 */ 2142, 2103, 1861, 1698, 2102, 2101, 1698, 1698, 1698, 1698, + /* 340 */ 1698, 1698, 1698, 1698, 1982, 1981, 2095, 1698, 1698, 2096, + /* 350 */ 2094, 2093, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 360 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 370 */ 1698, 1698, 1698, 2257, 2261, 1698, 1698, 1698, 1698, 1698, + /* 380 */ 1698, 1698, 2178, 1698, 1698, 1698, 1698, 1698, 2077, 1698, + /* 390 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 400 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 410 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 420 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 430 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 440 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 450 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 460 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 470 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 480 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 490 */ 1698, 1698, 1698, 1698, 1698, 1735, 2082, 1698, 1698, 1698, + /* 500 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 510 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 520 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 530 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 540 */ 1698, 1698, 1698, 1819, 1818, 1698, 1698, 1698, 1698, 1698, + /* 550 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 560 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 2086, 1698, 1698, + /* 570 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 580 */ 1698, 1698, 2253, 2211, 1698, 1698, 1698, 1698, 1698, 1698, + /* 590 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 600 */ 1698, 1698, 2077, 1698, 2236, 1698, 1698, 2251, 1698, 2255, + /* 610 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 2188, 2184, 1698, + /* 620 */ 1698, 2180, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 2085, + /* 630 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 640 */ 1698, 1698, 1698, 2076, 1698, 2139, 1698, 1698, 1698, 2173, + /* 650 */ 1698, 1698, 2124, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 660 */ 1698, 1698, 2086, 1698, 2089, 1698, 1698, 1698, 1698, 1698, + /* 670 */ 1893, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 680 */ 1698, 1698, 1698, 1878, 1876, 1875, 1874, 1698, 1871, 1698, + /* 690 */ 1906, 1698, 1698, 1698, 1902, 1901, 1698, 1698, 1698, 1698, + /* 700 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 710 */ 1698, 1799, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 720 */ 1791, 1698, 1790, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 730 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 740 */ 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, 1698, + /* 750 */ 1698, 1698, 1698, 1698, 1698, }; /********** End of lemon-generated parsing tables *****************************/ @@ -1016,6 +1040,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* READ => nothing */ 0, /* WRITE => nothing */ 0, /* NK_DOT => nothing */ + 0, /* WITH => nothing */ 0, /* DNODE => nothing */ 0, /* PORT => nothing */ 0, /* DNODES => nothing */ @@ -1064,7 +1089,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_COLON => nothing */ 0, /* MAX_SPEED => nothing */ 0, /* START => nothing */ - 0, /* WITH => nothing */ 0, /* TIMESTAMP => nothing */ 276, /* END => ABORT */ 0, /* TABLE => nothing */ @@ -1431,55 +1455,55 @@ static const char *const yyTokenName[] = { /* 45 */ "READ", /* 46 */ "WRITE", /* 47 */ "NK_DOT", - /* 48 */ "DNODE", - /* 49 */ "PORT", - /* 50 */ "DNODES", - /* 51 */ "NK_IPTOKEN", - /* 52 */ "FORCE", - /* 53 */ "LOCAL", - /* 54 */ "QNODE", - /* 55 */ "BNODE", - /* 56 */ "SNODE", - /* 57 */ "MNODE", - /* 58 */ "DATABASE", - /* 59 */ "USE", - /* 60 */ "FLUSH", - /* 61 */ "TRIM", - /* 62 */ "COMPACT", - /* 63 */ "IF", - /* 64 */ "NOT", - /* 65 */ "EXISTS", - /* 66 */ "BUFFER", - /* 67 */ "CACHEMODEL", - /* 68 */ "CACHESIZE", - /* 69 */ "COMP", - /* 70 */ "DURATION", - /* 71 */ "NK_VARIABLE", - /* 72 */ "MAXROWS", - /* 73 */ "MINROWS", - /* 74 */ "KEEP", - /* 75 */ "PAGES", - /* 76 */ "PAGESIZE", - /* 77 */ "TSDB_PAGESIZE", - /* 78 */ "PRECISION", - /* 79 */ "REPLICA", - /* 80 */ "VGROUPS", - /* 81 */ "SINGLE_STABLE", - /* 82 */ "RETENTIONS", - /* 83 */ "SCHEMALESS", - /* 84 */ "WAL_LEVEL", - /* 85 */ "WAL_FSYNC_PERIOD", - /* 86 */ "WAL_RETENTION_PERIOD", - /* 87 */ "WAL_RETENTION_SIZE", - /* 88 */ "WAL_ROLL_PERIOD", - /* 89 */ "WAL_SEGMENT_SIZE", - /* 90 */ "STT_TRIGGER", - /* 91 */ "TABLE_PREFIX", - /* 92 */ "TABLE_SUFFIX", - /* 93 */ "NK_COLON", - /* 94 */ "MAX_SPEED", - /* 95 */ "START", - /* 96 */ "WITH", + /* 48 */ "WITH", + /* 49 */ "DNODE", + /* 50 */ "PORT", + /* 51 */ "DNODES", + /* 52 */ "NK_IPTOKEN", + /* 53 */ "FORCE", + /* 54 */ "LOCAL", + /* 55 */ "QNODE", + /* 56 */ "BNODE", + /* 57 */ "SNODE", + /* 58 */ "MNODE", + /* 59 */ "DATABASE", + /* 60 */ "USE", + /* 61 */ "FLUSH", + /* 62 */ "TRIM", + /* 63 */ "COMPACT", + /* 64 */ "IF", + /* 65 */ "NOT", + /* 66 */ "EXISTS", + /* 67 */ "BUFFER", + /* 68 */ "CACHEMODEL", + /* 69 */ "CACHESIZE", + /* 70 */ "COMP", + /* 71 */ "DURATION", + /* 72 */ "NK_VARIABLE", + /* 73 */ "MAXROWS", + /* 74 */ "MINROWS", + /* 75 */ "KEEP", + /* 76 */ "PAGES", + /* 77 */ "PAGESIZE", + /* 78 */ "TSDB_PAGESIZE", + /* 79 */ "PRECISION", + /* 80 */ "REPLICA", + /* 81 */ "VGROUPS", + /* 82 */ "SINGLE_STABLE", + /* 83 */ "RETENTIONS", + /* 84 */ "SCHEMALESS", + /* 85 */ "WAL_LEVEL", + /* 86 */ "WAL_FSYNC_PERIOD", + /* 87 */ "WAL_RETENTION_PERIOD", + /* 88 */ "WAL_RETENTION_SIZE", + /* 89 */ "WAL_ROLL_PERIOD", + /* 90 */ "WAL_SEGMENT_SIZE", + /* 91 */ "STT_TRIGGER", + /* 92 */ "TABLE_PREFIX", + /* 93 */ "TABLE_SUFFIX", + /* 94 */ "NK_COLON", + /* 95 */ "MAX_SPEED", + /* 96 */ "START", /* 97 */ "TIMESTAMP", /* 98 */ "END", /* 99 */ "TABLE", @@ -1720,140 +1744,141 @@ static const char *const yyTokenName[] = { /* 334 */ "sysinfo_opt", /* 335 */ "privileges", /* 336 */ "priv_level", - /* 337 */ "priv_type_list", - /* 338 */ "priv_type", - /* 339 */ "db_name", - /* 340 */ "topic_name", - /* 341 */ "dnode_endpoint", - /* 342 */ "force_opt", - /* 343 */ "not_exists_opt", - /* 344 */ "db_options", - /* 345 */ "exists_opt", - /* 346 */ "alter_db_options", - /* 347 */ "speed_opt", - /* 348 */ "start_opt", - /* 349 */ "end_opt", - /* 350 */ "integer_list", - /* 351 */ "variable_list", - /* 352 */ "retention_list", - /* 353 */ "alter_db_option", - /* 354 */ "retention", - /* 355 */ "full_table_name", - /* 356 */ "column_def_list", - /* 357 */ "tags_def_opt", - /* 358 */ "table_options", - /* 359 */ "multi_create_clause", - /* 360 */ "tags_def", - /* 361 */ "multi_drop_clause", - /* 362 */ "alter_table_clause", - /* 363 */ "alter_table_options", - /* 364 */ "column_name", - /* 365 */ "type_name", - /* 366 */ "signed_literal", - /* 367 */ "create_subtable_clause", - /* 368 */ "specific_cols_opt", - /* 369 */ "expression_list", - /* 370 */ "drop_table_clause", - /* 371 */ "col_name_list", - /* 372 */ "table_name", - /* 373 */ "column_def", - /* 374 */ "duration_list", - /* 375 */ "rollup_func_list", - /* 376 */ "alter_table_option", - /* 377 */ "duration_literal", - /* 378 */ "rollup_func_name", - /* 379 */ "function_name", - /* 380 */ "col_name", - /* 381 */ "db_name_cond_opt", - /* 382 */ "like_pattern_opt", - /* 383 */ "table_name_cond", - /* 384 */ "from_db_opt", - /* 385 */ "tag_list_opt", - /* 386 */ "tag_item", - /* 387 */ "column_alias", - /* 388 */ "full_index_name", - /* 389 */ "index_options", - /* 390 */ "index_name", - /* 391 */ "func_list", - /* 392 */ "sliding_opt", - /* 393 */ "sma_stream_opt", - /* 394 */ "func", - /* 395 */ "sma_func_name", - /* 396 */ "query_or_subquery", - /* 397 */ "cgroup_name", - /* 398 */ "analyze_opt", - /* 399 */ "explain_options", - /* 400 */ "insert_query", - /* 401 */ "agg_func_opt", - /* 402 */ "bufsize_opt", - /* 403 */ "stream_name", - /* 404 */ "stream_options", - /* 405 */ "col_list_opt", - /* 406 */ "tag_def_or_ref_opt", - /* 407 */ "subtable_opt", - /* 408 */ "expression", - /* 409 */ "dnode_list", - /* 410 */ "where_clause_opt", - /* 411 */ "signed", - /* 412 */ "literal_func", - /* 413 */ "literal_list", - /* 414 */ "table_alias", - /* 415 */ "expr_or_subquery", - /* 416 */ "pseudo_column", - /* 417 */ "column_reference", - /* 418 */ "function_expression", - /* 419 */ "case_when_expression", - /* 420 */ "star_func", - /* 421 */ "star_func_para_list", - /* 422 */ "noarg_func", - /* 423 */ "other_para_list", - /* 424 */ "star_func_para", - /* 425 */ "when_then_list", - /* 426 */ "case_when_else_opt", - /* 427 */ "common_expression", - /* 428 */ "when_then_expr", - /* 429 */ "predicate", - /* 430 */ "compare_op", - /* 431 */ "in_op", - /* 432 */ "in_predicate_value", - /* 433 */ "boolean_value_expression", - /* 434 */ "boolean_primary", - /* 435 */ "from_clause_opt", - /* 436 */ "table_reference_list", - /* 437 */ "table_reference", - /* 438 */ "table_primary", - /* 439 */ "joined_table", - /* 440 */ "alias_opt", - /* 441 */ "subquery", - /* 442 */ "parenthesized_joined_table", - /* 443 */ "join_type", - /* 444 */ "search_condition", - /* 445 */ "query_specification", - /* 446 */ "set_quantifier_opt", - /* 447 */ "select_list", - /* 448 */ "partition_by_clause_opt", - /* 449 */ "range_opt", - /* 450 */ "every_opt", - /* 451 */ "fill_opt", - /* 452 */ "twindow_clause_opt", - /* 453 */ "group_by_clause_opt", - /* 454 */ "having_clause_opt", - /* 455 */ "select_item", - /* 456 */ "partition_list", - /* 457 */ "partition_item", - /* 458 */ "fill_mode", - /* 459 */ "group_by_list", - /* 460 */ "query_expression", - /* 461 */ "query_simple", - /* 462 */ "order_by_clause_opt", - /* 463 */ "slimit_clause_opt", - /* 464 */ "limit_clause_opt", - /* 465 */ "union_query_expression", - /* 466 */ "query_simple_or_subquery", - /* 467 */ "sort_specification_list", - /* 468 */ "sort_specification", - /* 469 */ "ordering_specification_opt", - /* 470 */ "null_ordering_opt", + /* 337 */ "with_opt", + /* 338 */ "priv_type_list", + /* 339 */ "priv_type", + /* 340 */ "db_name", + /* 341 */ "table_name", + /* 342 */ "topic_name", + /* 343 */ "search_condition", + /* 344 */ "dnode_endpoint", + /* 345 */ "force_opt", + /* 346 */ "not_exists_opt", + /* 347 */ "db_options", + /* 348 */ "exists_opt", + /* 349 */ "alter_db_options", + /* 350 */ "speed_opt", + /* 351 */ "start_opt", + /* 352 */ "end_opt", + /* 353 */ "integer_list", + /* 354 */ "variable_list", + /* 355 */ "retention_list", + /* 356 */ "alter_db_option", + /* 357 */ "retention", + /* 358 */ "full_table_name", + /* 359 */ "column_def_list", + /* 360 */ "tags_def_opt", + /* 361 */ "table_options", + /* 362 */ "multi_create_clause", + /* 363 */ "tags_def", + /* 364 */ "multi_drop_clause", + /* 365 */ "alter_table_clause", + /* 366 */ "alter_table_options", + /* 367 */ "column_name", + /* 368 */ "type_name", + /* 369 */ "signed_literal", + /* 370 */ "create_subtable_clause", + /* 371 */ "specific_cols_opt", + /* 372 */ "expression_list", + /* 373 */ "drop_table_clause", + /* 374 */ "col_name_list", + /* 375 */ "column_def", + /* 376 */ "duration_list", + /* 377 */ "rollup_func_list", + /* 378 */ "alter_table_option", + /* 379 */ "duration_literal", + /* 380 */ "rollup_func_name", + /* 381 */ "function_name", + /* 382 */ "col_name", + /* 383 */ "db_name_cond_opt", + /* 384 */ "like_pattern_opt", + /* 385 */ "table_name_cond", + /* 386 */ "from_db_opt", + /* 387 */ "tag_list_opt", + /* 388 */ "tag_item", + /* 389 */ "column_alias", + /* 390 */ "full_index_name", + /* 391 */ "index_options", + /* 392 */ "index_name", + /* 393 */ "func_list", + /* 394 */ "sliding_opt", + /* 395 */ "sma_stream_opt", + /* 396 */ "func", + /* 397 */ "sma_func_name", + /* 398 */ "query_or_subquery", + /* 399 */ "cgroup_name", + /* 400 */ "analyze_opt", + /* 401 */ "explain_options", + /* 402 */ "insert_query", + /* 403 */ "agg_func_opt", + /* 404 */ "bufsize_opt", + /* 405 */ "stream_name", + /* 406 */ "stream_options", + /* 407 */ "col_list_opt", + /* 408 */ "tag_def_or_ref_opt", + /* 409 */ "subtable_opt", + /* 410 */ "expression", + /* 411 */ "dnode_list", + /* 412 */ "where_clause_opt", + /* 413 */ "signed", + /* 414 */ "literal_func", + /* 415 */ "literal_list", + /* 416 */ "table_alias", + /* 417 */ "expr_or_subquery", + /* 418 */ "pseudo_column", + /* 419 */ "column_reference", + /* 420 */ "function_expression", + /* 421 */ "case_when_expression", + /* 422 */ "star_func", + /* 423 */ "star_func_para_list", + /* 424 */ "noarg_func", + /* 425 */ "other_para_list", + /* 426 */ "star_func_para", + /* 427 */ "when_then_list", + /* 428 */ "case_when_else_opt", + /* 429 */ "common_expression", + /* 430 */ "when_then_expr", + /* 431 */ "predicate", + /* 432 */ "compare_op", + /* 433 */ "in_op", + /* 434 */ "in_predicate_value", + /* 435 */ "boolean_value_expression", + /* 436 */ "boolean_primary", + /* 437 */ "from_clause_opt", + /* 438 */ "table_reference_list", + /* 439 */ "table_reference", + /* 440 */ "table_primary", + /* 441 */ "joined_table", + /* 442 */ "alias_opt", + /* 443 */ "subquery", + /* 444 */ "parenthesized_joined_table", + /* 445 */ "join_type", + /* 446 */ "query_specification", + /* 447 */ "set_quantifier_opt", + /* 448 */ "select_list", + /* 449 */ "partition_by_clause_opt", + /* 450 */ "range_opt", + /* 451 */ "every_opt", + /* 452 */ "fill_opt", + /* 453 */ "twindow_clause_opt", + /* 454 */ "group_by_clause_opt", + /* 455 */ "having_clause_opt", + /* 456 */ "select_item", + /* 457 */ "partition_list", + /* 458 */ "partition_item", + /* 459 */ "fill_mode", + /* 460 */ "group_by_list", + /* 461 */ "query_expression", + /* 462 */ "query_simple", + /* 463 */ "order_by_clause_opt", + /* 464 */ "slimit_clause_opt", + /* 465 */ "limit_clause_opt", + /* 466 */ "union_query_expression", + /* 467 */ "query_simple_or_subquery", + /* 468 */ "sort_specification_list", + /* 469 */ "sort_specification", + /* 470 */ "ordering_specification_opt", + /* 471 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1892,8 +1917,8 @@ static const char *const yyRuleName[] = { /* 28 */ "cmd ::= DROP USER user_name", /* 29 */ "sysinfo_opt ::=", /* 30 */ "sysinfo_opt ::= SYSINFO NK_INTEGER", - /* 31 */ "cmd ::= GRANT privileges ON priv_level TO user_name", - /* 32 */ "cmd ::= REVOKE privileges ON priv_level FROM user_name", + /* 31 */ "cmd ::= GRANT privileges ON priv_level with_opt TO user_name", + /* 32 */ "cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name", /* 33 */ "privileges ::= ALL", /* 34 */ "privileges ::= priv_type_list", /* 35 */ "privileges ::= SUBSCRIBE", @@ -1903,536 +1928,539 @@ static const char *const yyRuleName[] = { /* 39 */ "priv_type ::= WRITE", /* 40 */ "priv_level ::= NK_STAR NK_DOT NK_STAR", /* 41 */ "priv_level ::= db_name NK_DOT NK_STAR", - /* 42 */ "priv_level ::= topic_name", - /* 43 */ "cmd ::= CREATE DNODE dnode_endpoint", - /* 44 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", - /* 45 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", - /* 46 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", - /* 47 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", - /* 48 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", - /* 49 */ "cmd ::= ALTER ALL DNODES NK_STRING", - /* 50 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", - /* 51 */ "dnode_endpoint ::= NK_STRING", - /* 52 */ "dnode_endpoint ::= NK_ID", - /* 53 */ "dnode_endpoint ::= NK_IPTOKEN", - /* 54 */ "force_opt ::=", - /* 55 */ "force_opt ::= FORCE", - /* 56 */ "cmd ::= ALTER LOCAL NK_STRING", - /* 57 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", - /* 58 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", - /* 59 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", - /* 60 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", - /* 61 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", - /* 62 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", - /* 63 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", - /* 64 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", - /* 65 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", - /* 66 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", - /* 67 */ "cmd ::= DROP DATABASE exists_opt db_name", - /* 68 */ "cmd ::= USE db_name", - /* 69 */ "cmd ::= ALTER DATABASE db_name alter_db_options", - /* 70 */ "cmd ::= FLUSH DATABASE db_name", - /* 71 */ "cmd ::= TRIM DATABASE db_name speed_opt", - /* 72 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", - /* 73 */ "not_exists_opt ::= IF NOT EXISTS", - /* 74 */ "not_exists_opt ::=", - /* 75 */ "exists_opt ::= IF EXISTS", - /* 76 */ "exists_opt ::=", - /* 77 */ "db_options ::=", - /* 78 */ "db_options ::= db_options BUFFER NK_INTEGER", - /* 79 */ "db_options ::= db_options CACHEMODEL NK_STRING", - /* 80 */ "db_options ::= db_options CACHESIZE NK_INTEGER", - /* 81 */ "db_options ::= db_options COMP NK_INTEGER", - /* 82 */ "db_options ::= db_options DURATION NK_INTEGER", - /* 83 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 84 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 85 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 86 */ "db_options ::= db_options KEEP integer_list", - /* 87 */ "db_options ::= db_options KEEP variable_list", - /* 88 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 89 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 90 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", - /* 91 */ "db_options ::= db_options PRECISION NK_STRING", - /* 92 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 93 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 94 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 95 */ "db_options ::= db_options RETENTIONS retention_list", - /* 96 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", - /* 97 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", - /* 98 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", - /* 99 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", - /* 100 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", - /* 101 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", - /* 102 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", - /* 103 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", - /* 104 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", - /* 105 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", - /* 106 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", - /* 107 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", - /* 108 */ "alter_db_options ::= alter_db_option", - /* 109 */ "alter_db_options ::= alter_db_options alter_db_option", - /* 110 */ "alter_db_option ::= BUFFER NK_INTEGER", - /* 111 */ "alter_db_option ::= CACHEMODEL NK_STRING", - /* 112 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 113 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", - /* 114 */ "alter_db_option ::= KEEP integer_list", - /* 115 */ "alter_db_option ::= KEEP variable_list", - /* 116 */ "alter_db_option ::= PAGES NK_INTEGER", - /* 117 */ "alter_db_option ::= REPLICA NK_INTEGER", - /* 118 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", - /* 119 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", - /* 120 */ "alter_db_option ::= MINROWS NK_INTEGER", - /* 121 */ "integer_list ::= NK_INTEGER", - /* 122 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", - /* 123 */ "variable_list ::= NK_VARIABLE", - /* 124 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", - /* 125 */ "retention_list ::= retention", - /* 126 */ "retention_list ::= retention_list NK_COMMA retention", - /* 127 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", - /* 128 */ "speed_opt ::=", - /* 129 */ "speed_opt ::= MAX_SPEED NK_INTEGER", - /* 130 */ "start_opt ::=", - /* 131 */ "start_opt ::= START WITH NK_INTEGER", - /* 132 */ "start_opt ::= START WITH NK_STRING", - /* 133 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", - /* 134 */ "end_opt ::=", - /* 135 */ "end_opt ::= END WITH NK_INTEGER", - /* 136 */ "end_opt ::= END WITH NK_STRING", - /* 137 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", - /* 138 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 139 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 140 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 141 */ "cmd ::= DROP TABLE multi_drop_clause", - /* 142 */ "cmd ::= DROP STABLE exists_opt full_table_name", - /* 143 */ "cmd ::= ALTER TABLE alter_table_clause", - /* 144 */ "cmd ::= ALTER STABLE alter_table_clause", - /* 145 */ "alter_table_clause ::= full_table_name alter_table_options", - /* 146 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", - /* 147 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", - /* 148 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", - /* 149 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", - /* 150 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", - /* 151 */ "alter_table_clause ::= full_table_name DROP TAG column_name", - /* 152 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", - /* 153 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", - /* 154 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", - /* 155 */ "multi_create_clause ::= create_subtable_clause", - /* 156 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 157 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", - /* 158 */ "multi_drop_clause ::= drop_table_clause", - /* 159 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", - /* 160 */ "drop_table_clause ::= exists_opt full_table_name", - /* 161 */ "specific_cols_opt ::=", - /* 162 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", - /* 163 */ "full_table_name ::= table_name", - /* 164 */ "full_table_name ::= db_name NK_DOT table_name", - /* 165 */ "column_def_list ::= column_def", - /* 166 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 167 */ "column_def ::= column_name type_name", - /* 168 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 169 */ "type_name ::= BOOL", - /* 170 */ "type_name ::= TINYINT", - /* 171 */ "type_name ::= SMALLINT", - /* 172 */ "type_name ::= INT", - /* 173 */ "type_name ::= INTEGER", - /* 174 */ "type_name ::= BIGINT", - /* 175 */ "type_name ::= FLOAT", - /* 176 */ "type_name ::= DOUBLE", - /* 177 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 178 */ "type_name ::= TIMESTAMP", - /* 179 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 180 */ "type_name ::= TINYINT UNSIGNED", - /* 181 */ "type_name ::= SMALLINT UNSIGNED", - /* 182 */ "type_name ::= INT UNSIGNED", - /* 183 */ "type_name ::= BIGINT UNSIGNED", - /* 184 */ "type_name ::= JSON", - /* 185 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 186 */ "type_name ::= MEDIUMBLOB", - /* 187 */ "type_name ::= BLOB", - /* 188 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 189 */ "type_name ::= DECIMAL", - /* 190 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 191 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 192 */ "tags_def_opt ::=", - /* 193 */ "tags_def_opt ::= tags_def", - /* 194 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 195 */ "table_options ::=", - /* 196 */ "table_options ::= table_options COMMENT NK_STRING", - /* 197 */ "table_options ::= table_options MAX_DELAY duration_list", - /* 198 */ "table_options ::= table_options WATERMARK duration_list", - /* 199 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", - /* 200 */ "table_options ::= table_options TTL NK_INTEGER", - /* 201 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 202 */ "table_options ::= table_options DELETE_MARK duration_list", - /* 203 */ "alter_table_options ::= alter_table_option", - /* 204 */ "alter_table_options ::= alter_table_options alter_table_option", - /* 205 */ "alter_table_option ::= COMMENT NK_STRING", - /* 206 */ "alter_table_option ::= TTL NK_INTEGER", - /* 207 */ "duration_list ::= duration_literal", - /* 208 */ "duration_list ::= duration_list NK_COMMA duration_literal", - /* 209 */ "rollup_func_list ::= rollup_func_name", - /* 210 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", - /* 211 */ "rollup_func_name ::= function_name", - /* 212 */ "rollup_func_name ::= FIRST", - /* 213 */ "rollup_func_name ::= LAST", - /* 214 */ "col_name_list ::= col_name", - /* 215 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 216 */ "col_name ::= column_name", - /* 217 */ "cmd ::= SHOW DNODES", - /* 218 */ "cmd ::= SHOW USERS", - /* 219 */ "cmd ::= SHOW USER PRIVILEGES", - /* 220 */ "cmd ::= SHOW DATABASES", - /* 221 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", - /* 222 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", - /* 223 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", - /* 224 */ "cmd ::= SHOW MNODES", - /* 225 */ "cmd ::= SHOW QNODES", - /* 226 */ "cmd ::= SHOW FUNCTIONS", - /* 227 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", - /* 228 */ "cmd ::= SHOW STREAMS", - /* 229 */ "cmd ::= SHOW ACCOUNTS", - /* 230 */ "cmd ::= SHOW APPS", - /* 231 */ "cmd ::= SHOW CONNECTIONS", - /* 232 */ "cmd ::= SHOW LICENCES", - /* 233 */ "cmd ::= SHOW GRANTS", - /* 234 */ "cmd ::= SHOW CREATE DATABASE db_name", - /* 235 */ "cmd ::= SHOW CREATE TABLE full_table_name", - /* 236 */ "cmd ::= SHOW CREATE STABLE full_table_name", - /* 237 */ "cmd ::= SHOW QUERIES", - /* 238 */ "cmd ::= SHOW SCORES", - /* 239 */ "cmd ::= SHOW TOPICS", - /* 240 */ "cmd ::= SHOW VARIABLES", - /* 241 */ "cmd ::= SHOW CLUSTER VARIABLES", - /* 242 */ "cmd ::= SHOW LOCAL VARIABLES", - /* 243 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", - /* 244 */ "cmd ::= SHOW BNODES", - /* 245 */ "cmd ::= SHOW SNODES", - /* 246 */ "cmd ::= SHOW CLUSTER", - /* 247 */ "cmd ::= SHOW TRANSACTIONS", - /* 248 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", - /* 249 */ "cmd ::= SHOW CONSUMERS", - /* 250 */ "cmd ::= SHOW SUBSCRIPTIONS", - /* 251 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", - /* 252 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", - /* 253 */ "cmd ::= SHOW VNODES NK_INTEGER", - /* 254 */ "cmd ::= SHOW VNODES NK_STRING", - /* 255 */ "cmd ::= SHOW db_name_cond_opt ALIVE", - /* 256 */ "cmd ::= SHOW CLUSTER ALIVE", - /* 257 */ "db_name_cond_opt ::=", - /* 258 */ "db_name_cond_opt ::= db_name NK_DOT", - /* 259 */ "like_pattern_opt ::=", - /* 260 */ "like_pattern_opt ::= LIKE NK_STRING", - /* 261 */ "table_name_cond ::= table_name", - /* 262 */ "from_db_opt ::=", - /* 263 */ "from_db_opt ::= FROM db_name", - /* 264 */ "tag_list_opt ::=", - /* 265 */ "tag_list_opt ::= tag_item", - /* 266 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", - /* 267 */ "tag_item ::= TBNAME", - /* 268 */ "tag_item ::= QTAGS", - /* 269 */ "tag_item ::= column_name", - /* 270 */ "tag_item ::= column_name column_alias", - /* 271 */ "tag_item ::= column_name AS column_alias", - /* 272 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", - /* 273 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", - /* 274 */ "cmd ::= DROP INDEX exists_opt full_index_name", - /* 275 */ "full_index_name ::= index_name", - /* 276 */ "full_index_name ::= db_name NK_DOT index_name", - /* 277 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", - /* 278 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", - /* 279 */ "func_list ::= func", - /* 280 */ "func_list ::= func_list NK_COMMA func", - /* 281 */ "func ::= sma_func_name NK_LP expression_list NK_RP", - /* 282 */ "sma_func_name ::= function_name", - /* 283 */ "sma_func_name ::= COUNT", - /* 284 */ "sma_func_name ::= FIRST", - /* 285 */ "sma_func_name ::= LAST", - /* 286 */ "sma_func_name ::= LAST_ROW", - /* 287 */ "sma_stream_opt ::=", - /* 288 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", - /* 289 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", - /* 290 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", - /* 291 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", - /* 292 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", - /* 293 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", - /* 294 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", - /* 295 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", - /* 296 */ "cmd ::= DROP TOPIC exists_opt topic_name", - /* 297 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", - /* 298 */ "cmd ::= DESC full_table_name", - /* 299 */ "cmd ::= DESCRIBE full_table_name", - /* 300 */ "cmd ::= RESET QUERY CACHE", - /* 301 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", - /* 302 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", - /* 303 */ "analyze_opt ::=", - /* 304 */ "analyze_opt ::= ANALYZE", - /* 305 */ "explain_options ::=", - /* 306 */ "explain_options ::= explain_options VERBOSE NK_BOOL", - /* 307 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 308 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 309 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 310 */ "agg_func_opt ::=", - /* 311 */ "agg_func_opt ::= AGGREGATE", - /* 312 */ "bufsize_opt ::=", - /* 313 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 314 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", - /* 315 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 316 */ "col_list_opt ::=", - /* 317 */ "col_list_opt ::= NK_LP col_name_list NK_RP", - /* 318 */ "tag_def_or_ref_opt ::=", - /* 319 */ "tag_def_or_ref_opt ::= tags_def", - /* 320 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", - /* 321 */ "stream_options ::=", - /* 322 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 323 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 324 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 325 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 326 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", - /* 327 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", - /* 328 */ "stream_options ::= stream_options DELETE_MARK duration_literal", - /* 329 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", - /* 330 */ "subtable_opt ::=", - /* 331 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", - /* 332 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 333 */ "cmd ::= KILL QUERY NK_STRING", - /* 334 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 335 */ "cmd ::= BALANCE VGROUP", - /* 336 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 337 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 338 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 339 */ "dnode_list ::= DNODE NK_INTEGER", - /* 340 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 341 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 342 */ "cmd ::= query_or_subquery", - /* 343 */ "cmd ::= insert_query", - /* 344 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", - /* 345 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", - /* 346 */ "literal ::= NK_INTEGER", - /* 347 */ "literal ::= NK_FLOAT", - /* 348 */ "literal ::= NK_STRING", - /* 349 */ "literal ::= NK_BOOL", - /* 350 */ "literal ::= TIMESTAMP NK_STRING", - /* 351 */ "literal ::= duration_literal", - /* 352 */ "literal ::= NULL", - /* 353 */ "literal ::= NK_QUESTION", - /* 354 */ "duration_literal ::= NK_VARIABLE", - /* 355 */ "signed ::= NK_INTEGER", - /* 356 */ "signed ::= NK_PLUS NK_INTEGER", - /* 357 */ "signed ::= NK_MINUS NK_INTEGER", - /* 358 */ "signed ::= NK_FLOAT", - /* 359 */ "signed ::= NK_PLUS NK_FLOAT", - /* 360 */ "signed ::= NK_MINUS NK_FLOAT", - /* 361 */ "signed_literal ::= signed", - /* 362 */ "signed_literal ::= NK_STRING", - /* 363 */ "signed_literal ::= NK_BOOL", - /* 364 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 365 */ "signed_literal ::= duration_literal", - /* 366 */ "signed_literal ::= NULL", - /* 367 */ "signed_literal ::= literal_func", - /* 368 */ "signed_literal ::= NK_QUESTION", - /* 369 */ "literal_list ::= signed_literal", - /* 370 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 371 */ "db_name ::= NK_ID", - /* 372 */ "table_name ::= NK_ID", - /* 373 */ "column_name ::= NK_ID", - /* 374 */ "function_name ::= NK_ID", - /* 375 */ "table_alias ::= NK_ID", - /* 376 */ "column_alias ::= NK_ID", - /* 377 */ "user_name ::= NK_ID", - /* 378 */ "topic_name ::= NK_ID", - /* 379 */ "stream_name ::= NK_ID", - /* 380 */ "cgroup_name ::= NK_ID", - /* 381 */ "index_name ::= NK_ID", - /* 382 */ "expr_or_subquery ::= expression", - /* 383 */ "expression ::= literal", - /* 384 */ "expression ::= pseudo_column", - /* 385 */ "expression ::= column_reference", - /* 386 */ "expression ::= function_expression", - /* 387 */ "expression ::= case_when_expression", - /* 388 */ "expression ::= NK_LP expression NK_RP", - /* 389 */ "expression ::= NK_PLUS expr_or_subquery", - /* 390 */ "expression ::= NK_MINUS expr_or_subquery", - /* 391 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", - /* 392 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", - /* 393 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", - /* 394 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", - /* 395 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", - /* 396 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 397 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", - /* 398 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", - /* 399 */ "expression_list ::= expr_or_subquery", - /* 400 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", - /* 401 */ "column_reference ::= column_name", - /* 402 */ "column_reference ::= table_name NK_DOT column_name", - /* 403 */ "pseudo_column ::= ROWTS", - /* 404 */ "pseudo_column ::= TBNAME", - /* 405 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 406 */ "pseudo_column ::= QSTART", - /* 407 */ "pseudo_column ::= QEND", - /* 408 */ "pseudo_column ::= QDURATION", - /* 409 */ "pseudo_column ::= WSTART", - /* 410 */ "pseudo_column ::= WEND", - /* 411 */ "pseudo_column ::= WDURATION", - /* 412 */ "pseudo_column ::= IROWTS", - /* 413 */ "pseudo_column ::= ISFILLED", - /* 414 */ "pseudo_column ::= QTAGS", - /* 415 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 416 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 417 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", - /* 418 */ "function_expression ::= literal_func", - /* 419 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 420 */ "literal_func ::= NOW", - /* 421 */ "noarg_func ::= NOW", - /* 422 */ "noarg_func ::= TODAY", - /* 423 */ "noarg_func ::= TIMEZONE", - /* 424 */ "noarg_func ::= DATABASE", - /* 425 */ "noarg_func ::= CLIENT_VERSION", - /* 426 */ "noarg_func ::= SERVER_VERSION", - /* 427 */ "noarg_func ::= SERVER_STATUS", - /* 428 */ "noarg_func ::= CURRENT_USER", - /* 429 */ "noarg_func ::= USER", - /* 430 */ "star_func ::= COUNT", - /* 431 */ "star_func ::= FIRST", - /* 432 */ "star_func ::= LAST", - /* 433 */ "star_func ::= LAST_ROW", - /* 434 */ "star_func_para_list ::= NK_STAR", - /* 435 */ "star_func_para_list ::= other_para_list", - /* 436 */ "other_para_list ::= star_func_para", - /* 437 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 438 */ "star_func_para ::= expr_or_subquery", - /* 439 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 440 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", - /* 441 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", - /* 442 */ "when_then_list ::= when_then_expr", - /* 443 */ "when_then_list ::= when_then_list when_then_expr", - /* 444 */ "when_then_expr ::= WHEN common_expression THEN common_expression", - /* 445 */ "case_when_else_opt ::=", - /* 446 */ "case_when_else_opt ::= ELSE common_expression", - /* 447 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", - /* 448 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", - /* 449 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", - /* 450 */ "predicate ::= expr_or_subquery IS NULL", - /* 451 */ "predicate ::= expr_or_subquery IS NOT NULL", - /* 452 */ "predicate ::= expr_or_subquery in_op in_predicate_value", - /* 453 */ "compare_op ::= NK_LT", - /* 454 */ "compare_op ::= NK_GT", - /* 455 */ "compare_op ::= NK_LE", - /* 456 */ "compare_op ::= NK_GE", - /* 457 */ "compare_op ::= NK_NE", - /* 458 */ "compare_op ::= NK_EQ", - /* 459 */ "compare_op ::= LIKE", - /* 460 */ "compare_op ::= NOT LIKE", - /* 461 */ "compare_op ::= MATCH", - /* 462 */ "compare_op ::= NMATCH", - /* 463 */ "compare_op ::= CONTAINS", - /* 464 */ "in_op ::= IN", - /* 465 */ "in_op ::= NOT IN", - /* 466 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 467 */ "boolean_value_expression ::= boolean_primary", - /* 468 */ "boolean_value_expression ::= NOT boolean_primary", - /* 469 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 470 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 471 */ "boolean_primary ::= predicate", - /* 472 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 473 */ "common_expression ::= expr_or_subquery", - /* 474 */ "common_expression ::= boolean_value_expression", - /* 475 */ "from_clause_opt ::=", - /* 476 */ "from_clause_opt ::= FROM table_reference_list", - /* 477 */ "table_reference_list ::= table_reference", - /* 478 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 479 */ "table_reference ::= table_primary", - /* 480 */ "table_reference ::= joined_table", - /* 481 */ "table_primary ::= table_name alias_opt", - /* 482 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 483 */ "table_primary ::= subquery alias_opt", - /* 484 */ "table_primary ::= parenthesized_joined_table", - /* 485 */ "alias_opt ::=", - /* 486 */ "alias_opt ::= table_alias", - /* 487 */ "alias_opt ::= AS table_alias", - /* 488 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 489 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 490 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 491 */ "join_type ::=", - /* 492 */ "join_type ::= INNER", - /* 493 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 494 */ "set_quantifier_opt ::=", - /* 495 */ "set_quantifier_opt ::= DISTINCT", - /* 496 */ "set_quantifier_opt ::= ALL", - /* 497 */ "select_list ::= select_item", - /* 498 */ "select_list ::= select_list NK_COMMA select_item", - /* 499 */ "select_item ::= NK_STAR", - /* 500 */ "select_item ::= common_expression", - /* 501 */ "select_item ::= common_expression column_alias", - /* 502 */ "select_item ::= common_expression AS column_alias", - /* 503 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 504 */ "where_clause_opt ::=", - /* 505 */ "where_clause_opt ::= WHERE search_condition", - /* 506 */ "partition_by_clause_opt ::=", - /* 507 */ "partition_by_clause_opt ::= PARTITION BY partition_list", - /* 508 */ "partition_list ::= partition_item", - /* 509 */ "partition_list ::= partition_list NK_COMMA partition_item", - /* 510 */ "partition_item ::= expr_or_subquery", - /* 511 */ "partition_item ::= expr_or_subquery column_alias", - /* 512 */ "partition_item ::= expr_or_subquery AS column_alias", - /* 513 */ "twindow_clause_opt ::=", - /* 514 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 515 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", - /* 516 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 517 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 518 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", - /* 519 */ "sliding_opt ::=", - /* 520 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 521 */ "fill_opt ::=", - /* 522 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 523 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 524 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", - /* 525 */ "fill_mode ::= NONE", - /* 526 */ "fill_mode ::= PREV", - /* 527 */ "fill_mode ::= NULL", - /* 528 */ "fill_mode ::= NULL_F", - /* 529 */ "fill_mode ::= LINEAR", - /* 530 */ "fill_mode ::= NEXT", - /* 531 */ "group_by_clause_opt ::=", - /* 532 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 533 */ "group_by_list ::= expr_or_subquery", - /* 534 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", - /* 535 */ "having_clause_opt ::=", - /* 536 */ "having_clause_opt ::= HAVING search_condition", - /* 537 */ "range_opt ::=", - /* 538 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", - /* 539 */ "every_opt ::=", - /* 540 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 541 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 542 */ "query_simple ::= query_specification", - /* 543 */ "query_simple ::= union_query_expression", - /* 544 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", - /* 545 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", - /* 546 */ "query_simple_or_subquery ::= query_simple", - /* 547 */ "query_simple_or_subquery ::= subquery", - /* 548 */ "query_or_subquery ::= query_expression", - /* 549 */ "query_or_subquery ::= subquery", - /* 550 */ "order_by_clause_opt ::=", - /* 551 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 552 */ "slimit_clause_opt ::=", - /* 553 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 554 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 555 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 556 */ "limit_clause_opt ::=", - /* 557 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 558 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 559 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 560 */ "subquery ::= NK_LP query_expression NK_RP", - /* 561 */ "subquery ::= NK_LP subquery NK_RP", - /* 562 */ "search_condition ::= common_expression", - /* 563 */ "sort_specification_list ::= sort_specification", - /* 564 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 565 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", - /* 566 */ "ordering_specification_opt ::=", - /* 567 */ "ordering_specification_opt ::= ASC", - /* 568 */ "ordering_specification_opt ::= DESC", - /* 569 */ "null_ordering_opt ::=", - /* 570 */ "null_ordering_opt ::= NULLS FIRST", - /* 571 */ "null_ordering_opt ::= NULLS LAST", + /* 42 */ "priv_level ::= db_name NK_DOT table_name", + /* 43 */ "priv_level ::= topic_name", + /* 44 */ "with_opt ::=", + /* 45 */ "with_opt ::= WITH search_condition", + /* 46 */ "cmd ::= CREATE DNODE dnode_endpoint", + /* 47 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER", + /* 48 */ "cmd ::= DROP DNODE NK_INTEGER force_opt", + /* 49 */ "cmd ::= DROP DNODE dnode_endpoint force_opt", + /* 50 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING", + /* 51 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING", + /* 52 */ "cmd ::= ALTER ALL DNODES NK_STRING", + /* 53 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING", + /* 54 */ "dnode_endpoint ::= NK_STRING", + /* 55 */ "dnode_endpoint ::= NK_ID", + /* 56 */ "dnode_endpoint ::= NK_IPTOKEN", + /* 57 */ "force_opt ::=", + /* 58 */ "force_opt ::= FORCE", + /* 59 */ "cmd ::= ALTER LOCAL NK_STRING", + /* 60 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING", + /* 61 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER", + /* 62 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER", + /* 63 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER", + /* 64 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER", + /* 65 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER", + /* 66 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER", + /* 67 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER", + /* 68 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER", + /* 69 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", + /* 70 */ "cmd ::= DROP DATABASE exists_opt db_name", + /* 71 */ "cmd ::= USE db_name", + /* 72 */ "cmd ::= ALTER DATABASE db_name alter_db_options", + /* 73 */ "cmd ::= FLUSH DATABASE db_name", + /* 74 */ "cmd ::= TRIM DATABASE db_name speed_opt", + /* 75 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt", + /* 76 */ "not_exists_opt ::= IF NOT EXISTS", + /* 77 */ "not_exists_opt ::=", + /* 78 */ "exists_opt ::= IF EXISTS", + /* 79 */ "exists_opt ::=", + /* 80 */ "db_options ::=", + /* 81 */ "db_options ::= db_options BUFFER NK_INTEGER", + /* 82 */ "db_options ::= db_options CACHEMODEL NK_STRING", + /* 83 */ "db_options ::= db_options CACHESIZE NK_INTEGER", + /* 84 */ "db_options ::= db_options COMP NK_INTEGER", + /* 85 */ "db_options ::= db_options DURATION NK_INTEGER", + /* 86 */ "db_options ::= db_options DURATION NK_VARIABLE", + /* 87 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 88 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 89 */ "db_options ::= db_options KEEP integer_list", + /* 90 */ "db_options ::= db_options KEEP variable_list", + /* 91 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 92 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 93 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER", + /* 94 */ "db_options ::= db_options PRECISION NK_STRING", + /* 95 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 96 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 97 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 98 */ "db_options ::= db_options RETENTIONS retention_list", + /* 99 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 100 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 101 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", + /* 102 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", + /* 103 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", + /* 104 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", + /* 105 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER", + /* 106 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER", + /* 107 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER", + /* 108 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER", + /* 109 */ "db_options ::= db_options TABLE_PREFIX NK_INTEGER", + /* 110 */ "db_options ::= db_options TABLE_SUFFIX NK_INTEGER", + /* 111 */ "alter_db_options ::= alter_db_option", + /* 112 */ "alter_db_options ::= alter_db_options alter_db_option", + /* 113 */ "alter_db_option ::= BUFFER NK_INTEGER", + /* 114 */ "alter_db_option ::= CACHEMODEL NK_STRING", + /* 115 */ "alter_db_option ::= CACHESIZE NK_INTEGER", + /* 116 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", + /* 117 */ "alter_db_option ::= KEEP integer_list", + /* 118 */ "alter_db_option ::= KEEP variable_list", + /* 119 */ "alter_db_option ::= PAGES NK_INTEGER", + /* 120 */ "alter_db_option ::= REPLICA NK_INTEGER", + /* 121 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", + /* 122 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER", + /* 123 */ "alter_db_option ::= MINROWS NK_INTEGER", + /* 124 */ "integer_list ::= NK_INTEGER", + /* 125 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", + /* 126 */ "variable_list ::= NK_VARIABLE", + /* 127 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE", + /* 128 */ "retention_list ::= retention", + /* 129 */ "retention_list ::= retention_list NK_COMMA retention", + /* 130 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE", + /* 131 */ "speed_opt ::=", + /* 132 */ "speed_opt ::= MAX_SPEED NK_INTEGER", + /* 133 */ "start_opt ::=", + /* 134 */ "start_opt ::= START WITH NK_INTEGER", + /* 135 */ "start_opt ::= START WITH NK_STRING", + /* 136 */ "start_opt ::= START WITH TIMESTAMP NK_STRING", + /* 137 */ "end_opt ::=", + /* 138 */ "end_opt ::= END WITH NK_INTEGER", + /* 139 */ "end_opt ::= END WITH NK_STRING", + /* 140 */ "end_opt ::= END WITH TIMESTAMP NK_STRING", + /* 141 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 142 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 143 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 144 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 145 */ "cmd ::= DROP STABLE exists_opt full_table_name", + /* 146 */ "cmd ::= ALTER TABLE alter_table_clause", + /* 147 */ "cmd ::= ALTER STABLE alter_table_clause", + /* 148 */ "alter_table_clause ::= full_table_name alter_table_options", + /* 149 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name", + /* 150 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name", + /* 151 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name", + /* 152 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name", + /* 153 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name", + /* 154 */ "alter_table_clause ::= full_table_name DROP TAG column_name", + /* 155 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name", + /* 156 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name", + /* 157 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal", + /* 158 */ "multi_create_clause ::= create_subtable_clause", + /* 159 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 160 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options", + /* 161 */ "multi_drop_clause ::= drop_table_clause", + /* 162 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause", + /* 163 */ "drop_table_clause ::= exists_opt full_table_name", + /* 164 */ "specific_cols_opt ::=", + /* 165 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP", + /* 166 */ "full_table_name ::= table_name", + /* 167 */ "full_table_name ::= db_name NK_DOT table_name", + /* 168 */ "column_def_list ::= column_def", + /* 169 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 170 */ "column_def ::= column_name type_name", + /* 171 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 172 */ "type_name ::= BOOL", + /* 173 */ "type_name ::= TINYINT", + /* 174 */ "type_name ::= SMALLINT", + /* 175 */ "type_name ::= INT", + /* 176 */ "type_name ::= INTEGER", + /* 177 */ "type_name ::= BIGINT", + /* 178 */ "type_name ::= FLOAT", + /* 179 */ "type_name ::= DOUBLE", + /* 180 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 181 */ "type_name ::= TIMESTAMP", + /* 182 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 183 */ "type_name ::= TINYINT UNSIGNED", + /* 184 */ "type_name ::= SMALLINT UNSIGNED", + /* 185 */ "type_name ::= INT UNSIGNED", + /* 186 */ "type_name ::= BIGINT UNSIGNED", + /* 187 */ "type_name ::= JSON", + /* 188 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 189 */ "type_name ::= MEDIUMBLOB", + /* 190 */ "type_name ::= BLOB", + /* 191 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 192 */ "type_name ::= DECIMAL", + /* 193 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 194 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 195 */ "tags_def_opt ::=", + /* 196 */ "tags_def_opt ::= tags_def", + /* 197 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 198 */ "table_options ::=", + /* 199 */ "table_options ::= table_options COMMENT NK_STRING", + /* 200 */ "table_options ::= table_options MAX_DELAY duration_list", + /* 201 */ "table_options ::= table_options WATERMARK duration_list", + /* 202 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP", + /* 203 */ "table_options ::= table_options TTL NK_INTEGER", + /* 204 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 205 */ "table_options ::= table_options DELETE_MARK duration_list", + /* 206 */ "alter_table_options ::= alter_table_option", + /* 207 */ "alter_table_options ::= alter_table_options alter_table_option", + /* 208 */ "alter_table_option ::= COMMENT NK_STRING", + /* 209 */ "alter_table_option ::= TTL NK_INTEGER", + /* 210 */ "duration_list ::= duration_literal", + /* 211 */ "duration_list ::= duration_list NK_COMMA duration_literal", + /* 212 */ "rollup_func_list ::= rollup_func_name", + /* 213 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name", + /* 214 */ "rollup_func_name ::= function_name", + /* 215 */ "rollup_func_name ::= FIRST", + /* 216 */ "rollup_func_name ::= LAST", + /* 217 */ "col_name_list ::= col_name", + /* 218 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 219 */ "col_name ::= column_name", + /* 220 */ "cmd ::= SHOW DNODES", + /* 221 */ "cmd ::= SHOW USERS", + /* 222 */ "cmd ::= SHOW USER PRIVILEGES", + /* 223 */ "cmd ::= SHOW DATABASES", + /* 224 */ "cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt", + /* 225 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt", + /* 226 */ "cmd ::= SHOW db_name_cond_opt VGROUPS", + /* 227 */ "cmd ::= SHOW MNODES", + /* 228 */ "cmd ::= SHOW QNODES", + /* 229 */ "cmd ::= SHOW FUNCTIONS", + /* 230 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt", + /* 231 */ "cmd ::= SHOW STREAMS", + /* 232 */ "cmd ::= SHOW ACCOUNTS", + /* 233 */ "cmd ::= SHOW APPS", + /* 234 */ "cmd ::= SHOW CONNECTIONS", + /* 235 */ "cmd ::= SHOW LICENCES", + /* 236 */ "cmd ::= SHOW GRANTS", + /* 237 */ "cmd ::= SHOW CREATE DATABASE db_name", + /* 238 */ "cmd ::= SHOW CREATE TABLE full_table_name", + /* 239 */ "cmd ::= SHOW CREATE STABLE full_table_name", + /* 240 */ "cmd ::= SHOW QUERIES", + /* 241 */ "cmd ::= SHOW SCORES", + /* 242 */ "cmd ::= SHOW TOPICS", + /* 243 */ "cmd ::= SHOW VARIABLES", + /* 244 */ "cmd ::= SHOW CLUSTER VARIABLES", + /* 245 */ "cmd ::= SHOW LOCAL VARIABLES", + /* 246 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt", + /* 247 */ "cmd ::= SHOW BNODES", + /* 248 */ "cmd ::= SHOW SNODES", + /* 249 */ "cmd ::= SHOW CLUSTER", + /* 250 */ "cmd ::= SHOW TRANSACTIONS", + /* 251 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name", + /* 252 */ "cmd ::= SHOW CONSUMERS", + /* 253 */ "cmd ::= SHOW SUBSCRIPTIONS", + /* 254 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt", + /* 255 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt", + /* 256 */ "cmd ::= SHOW VNODES NK_INTEGER", + /* 257 */ "cmd ::= SHOW VNODES NK_STRING", + /* 258 */ "cmd ::= SHOW db_name_cond_opt ALIVE", + /* 259 */ "cmd ::= SHOW CLUSTER ALIVE", + /* 260 */ "db_name_cond_opt ::=", + /* 261 */ "db_name_cond_opt ::= db_name NK_DOT", + /* 262 */ "like_pattern_opt ::=", + /* 263 */ "like_pattern_opt ::= LIKE NK_STRING", + /* 264 */ "table_name_cond ::= table_name", + /* 265 */ "from_db_opt ::=", + /* 266 */ "from_db_opt ::= FROM db_name", + /* 267 */ "tag_list_opt ::=", + /* 268 */ "tag_list_opt ::= tag_item", + /* 269 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item", + /* 270 */ "tag_item ::= TBNAME", + /* 271 */ "tag_item ::= QTAGS", + /* 272 */ "tag_item ::= column_name", + /* 273 */ "tag_item ::= column_name column_alias", + /* 274 */ "tag_item ::= column_name AS column_alias", + /* 275 */ "cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options", + /* 276 */ "cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP", + /* 277 */ "cmd ::= DROP INDEX exists_opt full_index_name", + /* 278 */ "full_index_name ::= index_name", + /* 279 */ "full_index_name ::= db_name NK_DOT index_name", + /* 280 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", + /* 281 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", + /* 282 */ "func_list ::= func", + /* 283 */ "func_list ::= func_list NK_COMMA func", + /* 284 */ "func ::= sma_func_name NK_LP expression_list NK_RP", + /* 285 */ "sma_func_name ::= function_name", + /* 286 */ "sma_func_name ::= COUNT", + /* 287 */ "sma_func_name ::= FIRST", + /* 288 */ "sma_func_name ::= LAST", + /* 289 */ "sma_func_name ::= LAST_ROW", + /* 290 */ "sma_stream_opt ::=", + /* 291 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal", + /* 292 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal", + /* 293 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal", + /* 294 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery", + /* 295 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name", + /* 296 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name", + /* 297 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name", + /* 298 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name", + /* 299 */ "cmd ::= DROP TOPIC exists_opt topic_name", + /* 300 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name", + /* 301 */ "cmd ::= DESC full_table_name", + /* 302 */ "cmd ::= DESCRIBE full_table_name", + /* 303 */ "cmd ::= RESET QUERY CACHE", + /* 304 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery", + /* 305 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query", + /* 306 */ "analyze_opt ::=", + /* 307 */ "analyze_opt ::= ANALYZE", + /* 308 */ "explain_options ::=", + /* 309 */ "explain_options ::= explain_options VERBOSE NK_BOOL", + /* 310 */ "explain_options ::= explain_options RATIO NK_FLOAT", + /* 311 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 312 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 313 */ "agg_func_opt ::=", + /* 314 */ "agg_func_opt ::= AGGREGATE", + /* 315 */ "bufsize_opt ::=", + /* 316 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 317 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery", + /* 318 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 319 */ "col_list_opt ::=", + /* 320 */ "col_list_opt ::= NK_LP col_name_list NK_RP", + /* 321 */ "tag_def_or_ref_opt ::=", + /* 322 */ "tag_def_or_ref_opt ::= tags_def", + /* 323 */ "tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP", + /* 324 */ "stream_options ::=", + /* 325 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 326 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 327 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 328 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 329 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER", + /* 330 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER", + /* 331 */ "stream_options ::= stream_options DELETE_MARK duration_literal", + /* 332 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER", + /* 333 */ "subtable_opt ::=", + /* 334 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP", + /* 335 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 336 */ "cmd ::= KILL QUERY NK_STRING", + /* 337 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 338 */ "cmd ::= BALANCE VGROUP", + /* 339 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 340 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 341 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 342 */ "dnode_list ::= DNODE NK_INTEGER", + /* 343 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 344 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 345 */ "cmd ::= query_or_subquery", + /* 346 */ "cmd ::= insert_query", + /* 347 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery", + /* 348 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery", + /* 349 */ "literal ::= NK_INTEGER", + /* 350 */ "literal ::= NK_FLOAT", + /* 351 */ "literal ::= NK_STRING", + /* 352 */ "literal ::= NK_BOOL", + /* 353 */ "literal ::= TIMESTAMP NK_STRING", + /* 354 */ "literal ::= duration_literal", + /* 355 */ "literal ::= NULL", + /* 356 */ "literal ::= NK_QUESTION", + /* 357 */ "duration_literal ::= NK_VARIABLE", + /* 358 */ "signed ::= NK_INTEGER", + /* 359 */ "signed ::= NK_PLUS NK_INTEGER", + /* 360 */ "signed ::= NK_MINUS NK_INTEGER", + /* 361 */ "signed ::= NK_FLOAT", + /* 362 */ "signed ::= NK_PLUS NK_FLOAT", + /* 363 */ "signed ::= NK_MINUS NK_FLOAT", + /* 364 */ "signed_literal ::= signed", + /* 365 */ "signed_literal ::= NK_STRING", + /* 366 */ "signed_literal ::= NK_BOOL", + /* 367 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 368 */ "signed_literal ::= duration_literal", + /* 369 */ "signed_literal ::= NULL", + /* 370 */ "signed_literal ::= literal_func", + /* 371 */ "signed_literal ::= NK_QUESTION", + /* 372 */ "literal_list ::= signed_literal", + /* 373 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 374 */ "db_name ::= NK_ID", + /* 375 */ "table_name ::= NK_ID", + /* 376 */ "column_name ::= NK_ID", + /* 377 */ "function_name ::= NK_ID", + /* 378 */ "table_alias ::= NK_ID", + /* 379 */ "column_alias ::= NK_ID", + /* 380 */ "user_name ::= NK_ID", + /* 381 */ "topic_name ::= NK_ID", + /* 382 */ "stream_name ::= NK_ID", + /* 383 */ "cgroup_name ::= NK_ID", + /* 384 */ "index_name ::= NK_ID", + /* 385 */ "expr_or_subquery ::= expression", + /* 386 */ "expression ::= literal", + /* 387 */ "expression ::= pseudo_column", + /* 388 */ "expression ::= column_reference", + /* 389 */ "expression ::= function_expression", + /* 390 */ "expression ::= case_when_expression", + /* 391 */ "expression ::= NK_LP expression NK_RP", + /* 392 */ "expression ::= NK_PLUS expr_or_subquery", + /* 393 */ "expression ::= NK_MINUS expr_or_subquery", + /* 394 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery", + /* 395 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery", + /* 396 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery", + /* 397 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery", + /* 398 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery", + /* 399 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 400 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery", + /* 401 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery", + /* 402 */ "expression_list ::= expr_or_subquery", + /* 403 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery", + /* 404 */ "column_reference ::= column_name", + /* 405 */ "column_reference ::= table_name NK_DOT column_name", + /* 406 */ "pseudo_column ::= ROWTS", + /* 407 */ "pseudo_column ::= TBNAME", + /* 408 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 409 */ "pseudo_column ::= QSTART", + /* 410 */ "pseudo_column ::= QEND", + /* 411 */ "pseudo_column ::= QDURATION", + /* 412 */ "pseudo_column ::= WSTART", + /* 413 */ "pseudo_column ::= WEND", + /* 414 */ "pseudo_column ::= WDURATION", + /* 415 */ "pseudo_column ::= IROWTS", + /* 416 */ "pseudo_column ::= ISFILLED", + /* 417 */ "pseudo_column ::= QTAGS", + /* 418 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 419 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 420 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP", + /* 421 */ "function_expression ::= literal_func", + /* 422 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 423 */ "literal_func ::= NOW", + /* 424 */ "noarg_func ::= NOW", + /* 425 */ "noarg_func ::= TODAY", + /* 426 */ "noarg_func ::= TIMEZONE", + /* 427 */ "noarg_func ::= DATABASE", + /* 428 */ "noarg_func ::= CLIENT_VERSION", + /* 429 */ "noarg_func ::= SERVER_VERSION", + /* 430 */ "noarg_func ::= SERVER_STATUS", + /* 431 */ "noarg_func ::= CURRENT_USER", + /* 432 */ "noarg_func ::= USER", + /* 433 */ "star_func ::= COUNT", + /* 434 */ "star_func ::= FIRST", + /* 435 */ "star_func ::= LAST", + /* 436 */ "star_func ::= LAST_ROW", + /* 437 */ "star_func_para_list ::= NK_STAR", + /* 438 */ "star_func_para_list ::= other_para_list", + /* 439 */ "other_para_list ::= star_func_para", + /* 440 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 441 */ "star_func_para ::= expr_or_subquery", + /* 442 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 443 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END", + /* 444 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END", + /* 445 */ "when_then_list ::= when_then_expr", + /* 446 */ "when_then_list ::= when_then_list when_then_expr", + /* 447 */ "when_then_expr ::= WHEN common_expression THEN common_expression", + /* 448 */ "case_when_else_opt ::=", + /* 449 */ "case_when_else_opt ::= ELSE common_expression", + /* 450 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery", + /* 451 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery", + /* 452 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery", + /* 453 */ "predicate ::= expr_or_subquery IS NULL", + /* 454 */ "predicate ::= expr_or_subquery IS NOT NULL", + /* 455 */ "predicate ::= expr_or_subquery in_op in_predicate_value", + /* 456 */ "compare_op ::= NK_LT", + /* 457 */ "compare_op ::= NK_GT", + /* 458 */ "compare_op ::= NK_LE", + /* 459 */ "compare_op ::= NK_GE", + /* 460 */ "compare_op ::= NK_NE", + /* 461 */ "compare_op ::= NK_EQ", + /* 462 */ "compare_op ::= LIKE", + /* 463 */ "compare_op ::= NOT LIKE", + /* 464 */ "compare_op ::= MATCH", + /* 465 */ "compare_op ::= NMATCH", + /* 466 */ "compare_op ::= CONTAINS", + /* 467 */ "in_op ::= IN", + /* 468 */ "in_op ::= NOT IN", + /* 469 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 470 */ "boolean_value_expression ::= boolean_primary", + /* 471 */ "boolean_value_expression ::= NOT boolean_primary", + /* 472 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 473 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 474 */ "boolean_primary ::= predicate", + /* 475 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 476 */ "common_expression ::= expr_or_subquery", + /* 477 */ "common_expression ::= boolean_value_expression", + /* 478 */ "from_clause_opt ::=", + /* 479 */ "from_clause_opt ::= FROM table_reference_list", + /* 480 */ "table_reference_list ::= table_reference", + /* 481 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 482 */ "table_reference ::= table_primary", + /* 483 */ "table_reference ::= joined_table", + /* 484 */ "table_primary ::= table_name alias_opt", + /* 485 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 486 */ "table_primary ::= subquery alias_opt", + /* 487 */ "table_primary ::= parenthesized_joined_table", + /* 488 */ "alias_opt ::=", + /* 489 */ "alias_opt ::= table_alias", + /* 490 */ "alias_opt ::= AS table_alias", + /* 491 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 492 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 493 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 494 */ "join_type ::=", + /* 495 */ "join_type ::= INNER", + /* 496 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 497 */ "set_quantifier_opt ::=", + /* 498 */ "set_quantifier_opt ::= DISTINCT", + /* 499 */ "set_quantifier_opt ::= ALL", + /* 500 */ "select_list ::= select_item", + /* 501 */ "select_list ::= select_list NK_COMMA select_item", + /* 502 */ "select_item ::= NK_STAR", + /* 503 */ "select_item ::= common_expression", + /* 504 */ "select_item ::= common_expression column_alias", + /* 505 */ "select_item ::= common_expression AS column_alias", + /* 506 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 507 */ "where_clause_opt ::=", + /* 508 */ "where_clause_opt ::= WHERE search_condition", + /* 509 */ "partition_by_clause_opt ::=", + /* 510 */ "partition_by_clause_opt ::= PARTITION BY partition_list", + /* 511 */ "partition_list ::= partition_item", + /* 512 */ "partition_list ::= partition_list NK_COMMA partition_item", + /* 513 */ "partition_item ::= expr_or_subquery", + /* 514 */ "partition_item ::= expr_or_subquery column_alias", + /* 515 */ "partition_item ::= expr_or_subquery AS column_alias", + /* 516 */ "twindow_clause_opt ::=", + /* 517 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 518 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP", + /* 519 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 520 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 521 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition", + /* 522 */ "sliding_opt ::=", + /* 523 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 524 */ "fill_opt ::=", + /* 525 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 526 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 527 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP", + /* 528 */ "fill_mode ::= NONE", + /* 529 */ "fill_mode ::= PREV", + /* 530 */ "fill_mode ::= NULL", + /* 531 */ "fill_mode ::= NULL_F", + /* 532 */ "fill_mode ::= LINEAR", + /* 533 */ "fill_mode ::= NEXT", + /* 534 */ "group_by_clause_opt ::=", + /* 535 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 536 */ "group_by_list ::= expr_or_subquery", + /* 537 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery", + /* 538 */ "having_clause_opt ::=", + /* 539 */ "having_clause_opt ::= HAVING search_condition", + /* 540 */ "range_opt ::=", + /* 541 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP", + /* 542 */ "every_opt ::=", + /* 543 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 544 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 545 */ "query_simple ::= query_specification", + /* 546 */ "query_simple ::= union_query_expression", + /* 547 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery", + /* 548 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery", + /* 549 */ "query_simple_or_subquery ::= query_simple", + /* 550 */ "query_simple_or_subquery ::= subquery", + /* 551 */ "query_or_subquery ::= query_expression", + /* 552 */ "query_or_subquery ::= subquery", + /* 553 */ "order_by_clause_opt ::=", + /* 554 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 555 */ "slimit_clause_opt ::=", + /* 556 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 557 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 558 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 559 */ "limit_clause_opt ::=", + /* 560 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 561 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 562 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 563 */ "subquery ::= NK_LP query_expression NK_RP", + /* 564 */ "subquery ::= NK_LP subquery NK_RP", + /* 565 */ "search_condition ::= common_expression", + /* 566 */ "sort_specification_list ::= sort_specification", + /* 567 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 568 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt", + /* 569 */ "ordering_specification_opt ::=", + /* 570 */ "ordering_specification_opt ::= ASC", + /* 571 */ "ordering_specification_opt ::= DESC", + /* 572 */ "null_ordering_opt ::=", + /* 573 */ "null_ordering_opt ::= NULLS FIRST", + /* 574 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2561,107 +2589,107 @@ static void yy_destructor( /* Default NON-TERMINAL Destructor */ case 328: /* cmd */ case 331: /* literal */ - case 344: /* db_options */ - case 346: /* alter_db_options */ - case 348: /* start_opt */ - case 349: /* end_opt */ - case 354: /* retention */ - case 355: /* full_table_name */ - case 358: /* table_options */ - case 362: /* alter_table_clause */ - case 363: /* alter_table_options */ - case 366: /* signed_literal */ - case 367: /* create_subtable_clause */ - case 370: /* drop_table_clause */ - case 373: /* column_def */ - case 377: /* duration_literal */ - case 378: /* rollup_func_name */ - case 380: /* col_name */ - case 381: /* db_name_cond_opt */ - case 382: /* like_pattern_opt */ - case 383: /* table_name_cond */ - case 384: /* from_db_opt */ - case 386: /* tag_item */ - case 388: /* full_index_name */ - case 389: /* index_options */ - case 392: /* sliding_opt */ - case 393: /* sma_stream_opt */ - case 394: /* func */ - case 396: /* query_or_subquery */ - case 399: /* explain_options */ - case 400: /* insert_query */ - case 404: /* stream_options */ - case 407: /* subtable_opt */ - case 408: /* expression */ - case 410: /* where_clause_opt */ - case 411: /* signed */ - case 412: /* literal_func */ - case 415: /* expr_or_subquery */ - case 416: /* pseudo_column */ - case 417: /* column_reference */ - case 418: /* function_expression */ - case 419: /* case_when_expression */ - case 424: /* star_func_para */ - case 426: /* case_when_else_opt */ - case 427: /* common_expression */ - case 428: /* when_then_expr */ - case 429: /* predicate */ - case 432: /* in_predicate_value */ - case 433: /* boolean_value_expression */ - case 434: /* boolean_primary */ - case 435: /* from_clause_opt */ - case 436: /* table_reference_list */ - case 437: /* table_reference */ - case 438: /* table_primary */ - case 439: /* joined_table */ - case 441: /* subquery */ - case 442: /* parenthesized_joined_table */ - case 444: /* search_condition */ - case 445: /* query_specification */ - case 449: /* range_opt */ - case 450: /* every_opt */ - case 451: /* fill_opt */ - case 452: /* twindow_clause_opt */ - case 454: /* having_clause_opt */ - case 455: /* select_item */ - case 457: /* partition_item */ - case 460: /* query_expression */ - case 461: /* query_simple */ - case 463: /* slimit_clause_opt */ - case 464: /* limit_clause_opt */ - case 465: /* union_query_expression */ - case 466: /* query_simple_or_subquery */ - case 468: /* sort_specification */ + case 337: /* with_opt */ + case 343: /* search_condition */ + case 347: /* db_options */ + case 349: /* alter_db_options */ + case 351: /* start_opt */ + case 352: /* end_opt */ + case 357: /* retention */ + case 358: /* full_table_name */ + case 361: /* table_options */ + case 365: /* alter_table_clause */ + case 366: /* alter_table_options */ + case 369: /* signed_literal */ + case 370: /* create_subtable_clause */ + case 373: /* drop_table_clause */ + case 375: /* column_def */ + case 379: /* duration_literal */ + case 380: /* rollup_func_name */ + case 382: /* col_name */ + case 383: /* db_name_cond_opt */ + case 384: /* like_pattern_opt */ + case 385: /* table_name_cond */ + case 386: /* from_db_opt */ + case 388: /* tag_item */ + case 390: /* full_index_name */ + case 391: /* index_options */ + case 394: /* sliding_opt */ + case 395: /* sma_stream_opt */ + case 396: /* func */ + case 398: /* query_or_subquery */ + case 401: /* explain_options */ + case 402: /* insert_query */ + case 406: /* stream_options */ + case 409: /* subtable_opt */ + case 410: /* expression */ + case 412: /* where_clause_opt */ + case 413: /* signed */ + case 414: /* literal_func */ + case 417: /* expr_or_subquery */ + case 418: /* pseudo_column */ + case 419: /* column_reference */ + case 420: /* function_expression */ + case 421: /* case_when_expression */ + case 426: /* star_func_para */ + case 428: /* case_when_else_opt */ + case 429: /* common_expression */ + case 430: /* when_then_expr */ + case 431: /* predicate */ + case 434: /* in_predicate_value */ + case 435: /* boolean_value_expression */ + case 436: /* boolean_primary */ + case 437: /* from_clause_opt */ + case 438: /* table_reference_list */ + case 439: /* table_reference */ + case 440: /* table_primary */ + case 441: /* joined_table */ + case 443: /* subquery */ + case 444: /* parenthesized_joined_table */ + case 446: /* query_specification */ + case 450: /* range_opt */ + case 451: /* every_opt */ + case 452: /* fill_opt */ + case 453: /* twindow_clause_opt */ + case 455: /* having_clause_opt */ + case 456: /* select_item */ + case 458: /* partition_item */ + case 461: /* query_expression */ + case 462: /* query_simple */ + case 464: /* slimit_clause_opt */ + case 465: /* limit_clause_opt */ + case 466: /* union_query_expression */ + case 467: /* query_simple_or_subquery */ + case 469: /* sort_specification */ { - nodesDestroyNode((yypminor->yy140)); + nodesDestroyNode((yypminor->yy792)); } break; case 329: /* account_options */ case 330: /* alter_account_options */ case 332: /* alter_account_option */ - case 347: /* speed_opt */ - case 402: /* bufsize_opt */ + case 350: /* speed_opt */ + case 404: /* bufsize_opt */ { } break; case 333: /* user_name */ - case 336: /* priv_level */ - case 339: /* db_name */ - case 340: /* topic_name */ - case 341: /* dnode_endpoint */ - case 364: /* column_name */ - case 372: /* table_name */ - case 379: /* function_name */ - case 387: /* column_alias */ - case 390: /* index_name */ - case 395: /* sma_func_name */ - case 397: /* cgroup_name */ - case 403: /* stream_name */ - case 414: /* table_alias */ - case 420: /* star_func */ - case 422: /* noarg_func */ - case 440: /* alias_opt */ + case 340: /* db_name */ + case 341: /* table_name */ + case 342: /* topic_name */ + case 344: /* dnode_endpoint */ + case 367: /* column_name */ + case 381: /* function_name */ + case 389: /* column_alias */ + case 392: /* index_name */ + case 397: /* sma_func_name */ + case 399: /* cgroup_name */ + case 405: /* stream_name */ + case 416: /* table_alias */ + case 422: /* star_func */ + case 424: /* noarg_func */ + case 442: /* alias_opt */ { } @@ -2672,88 +2700,93 @@ static void yy_destructor( } break; case 335: /* privileges */ - case 337: /* priv_type_list */ - case 338: /* priv_type */ + case 338: /* priv_type_list */ + case 339: /* priv_type */ { } break; - case 342: /* force_opt */ - case 343: /* not_exists_opt */ - case 345: /* exists_opt */ - case 398: /* analyze_opt */ - case 401: /* agg_func_opt */ - case 446: /* set_quantifier_opt */ + case 336: /* priv_level */ { } break; - case 350: /* integer_list */ - case 351: /* variable_list */ - case 352: /* retention_list */ - case 356: /* column_def_list */ - case 357: /* tags_def_opt */ - case 359: /* multi_create_clause */ - case 360: /* tags_def */ - case 361: /* multi_drop_clause */ - case 368: /* specific_cols_opt */ - case 369: /* expression_list */ - case 371: /* col_name_list */ - case 374: /* duration_list */ - case 375: /* rollup_func_list */ - case 385: /* tag_list_opt */ - case 391: /* func_list */ - case 405: /* col_list_opt */ - case 406: /* tag_def_or_ref_opt */ - case 409: /* dnode_list */ - case 413: /* literal_list */ - case 421: /* star_func_para_list */ - case 423: /* other_para_list */ - case 425: /* when_then_list */ - case 447: /* select_list */ - case 448: /* partition_by_clause_opt */ - case 453: /* group_by_clause_opt */ - case 456: /* partition_list */ - case 459: /* group_by_list */ - case 462: /* order_by_clause_opt */ - case 467: /* sort_specification_list */ -{ - nodesDestroyList((yypminor->yy220)); -} - break; - case 353: /* alter_db_option */ - case 376: /* alter_table_option */ + case 345: /* force_opt */ + case 346: /* not_exists_opt */ + case 348: /* exists_opt */ + case 400: /* analyze_opt */ + case 403: /* agg_func_opt */ + case 447: /* set_quantifier_opt */ { } break; - case 365: /* type_name */ + case 353: /* integer_list */ + case 354: /* variable_list */ + case 355: /* retention_list */ + case 359: /* column_def_list */ + case 360: /* tags_def_opt */ + case 362: /* multi_create_clause */ + case 363: /* tags_def */ + case 364: /* multi_drop_clause */ + case 371: /* specific_cols_opt */ + case 372: /* expression_list */ + case 374: /* col_name_list */ + case 376: /* duration_list */ + case 377: /* rollup_func_list */ + case 387: /* tag_list_opt */ + case 393: /* func_list */ + case 407: /* col_list_opt */ + case 408: /* tag_def_or_ref_opt */ + case 411: /* dnode_list */ + case 415: /* literal_list */ + case 423: /* star_func_para_list */ + case 425: /* other_para_list */ + case 427: /* when_then_list */ + case 448: /* select_list */ + case 449: /* partition_by_clause_opt */ + case 454: /* group_by_clause_opt */ + case 457: /* partition_list */ + case 460: /* group_by_list */ + case 463: /* order_by_clause_opt */ + case 468: /* sort_specification_list */ +{ + nodesDestroyList((yypminor->yy520)); +} + break; + case 356: /* alter_db_option */ + case 378: /* alter_table_option */ { } break; - case 430: /* compare_op */ - case 431: /* in_op */ + case 368: /* type_name */ { } break; - case 443: /* join_type */ + case 432: /* compare_op */ + case 433: /* in_op */ { } break; - case 458: /* fill_mode */ + case 445: /* join_type */ { } break; - case 469: /* ordering_specification_opt */ + case 459: /* fill_mode */ { } break; - case 470: /* null_ordering_opt */ + case 470: /* ordering_specification_opt */ +{ + +} + break; + case 471: /* null_ordering_opt */ { } @@ -3083,547 +3116,550 @@ static const struct { { 328, -3 }, /* (28) cmd ::= DROP USER user_name */ { 334, 0 }, /* (29) sysinfo_opt ::= */ { 334, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 328, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 328, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 328, -7 }, /* (31) cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ + { 328, -7 }, /* (32) cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ { 335, -1 }, /* (33) privileges ::= ALL */ { 335, -1 }, /* (34) privileges ::= priv_type_list */ { 335, -1 }, /* (35) privileges ::= SUBSCRIBE */ - { 337, -1 }, /* (36) priv_type_list ::= priv_type */ - { 337, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 338, -1 }, /* (38) priv_type ::= READ */ - { 338, -1 }, /* (39) priv_type ::= WRITE */ + { 338, -1 }, /* (36) priv_type_list ::= priv_type */ + { 338, -3 }, /* (37) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 339, -1 }, /* (38) priv_type ::= READ */ + { 339, -1 }, /* (39) priv_type ::= WRITE */ { 336, -3 }, /* (40) priv_level ::= NK_STAR NK_DOT NK_STAR */ { 336, -3 }, /* (41) priv_level ::= db_name NK_DOT NK_STAR */ - { 336, -1 }, /* (42) priv_level ::= topic_name */ - { 328, -3 }, /* (43) cmd ::= CREATE DNODE dnode_endpoint */ - { 328, -5 }, /* (44) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 328, -4 }, /* (45) cmd ::= DROP DNODE NK_INTEGER force_opt */ - { 328, -4 }, /* (46) cmd ::= DROP DNODE dnode_endpoint force_opt */ - { 328, -4 }, /* (47) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 328, -5 }, /* (48) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 328, -4 }, /* (49) cmd ::= ALTER ALL DNODES NK_STRING */ - { 328, -5 }, /* (50) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 341, -1 }, /* (51) dnode_endpoint ::= NK_STRING */ - { 341, -1 }, /* (52) dnode_endpoint ::= NK_ID */ - { 341, -1 }, /* (53) dnode_endpoint ::= NK_IPTOKEN */ - { 342, 0 }, /* (54) force_opt ::= */ - { 342, -1 }, /* (55) force_opt ::= FORCE */ - { 328, -3 }, /* (56) cmd ::= ALTER LOCAL NK_STRING */ - { 328, -4 }, /* (57) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 328, -5 }, /* (58) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (59) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (60) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (61) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (62) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (63) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (64) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (65) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 328, -5 }, /* (66) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 328, -4 }, /* (67) cmd ::= DROP DATABASE exists_opt db_name */ - { 328, -2 }, /* (68) cmd ::= USE db_name */ - { 328, -4 }, /* (69) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 328, -3 }, /* (70) cmd ::= FLUSH DATABASE db_name */ - { 328, -4 }, /* (71) cmd ::= TRIM DATABASE db_name speed_opt */ - { 328, -5 }, /* (72) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ - { 343, -3 }, /* (73) not_exists_opt ::= IF NOT EXISTS */ - { 343, 0 }, /* (74) not_exists_opt ::= */ - { 345, -2 }, /* (75) exists_opt ::= IF EXISTS */ - { 345, 0 }, /* (76) exists_opt ::= */ - { 344, 0 }, /* (77) db_options ::= */ - { 344, -3 }, /* (78) db_options ::= db_options BUFFER NK_INTEGER */ - { 344, -3 }, /* (79) db_options ::= db_options CACHEMODEL NK_STRING */ - { 344, -3 }, /* (80) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 344, -3 }, /* (81) db_options ::= db_options COMP NK_INTEGER */ - { 344, -3 }, /* (82) db_options ::= db_options DURATION NK_INTEGER */ - { 344, -3 }, /* (83) db_options ::= db_options DURATION NK_VARIABLE */ - { 344, -3 }, /* (84) db_options ::= db_options MAXROWS NK_INTEGER */ - { 344, -3 }, /* (85) db_options ::= db_options MINROWS NK_INTEGER */ - { 344, -3 }, /* (86) db_options ::= db_options KEEP integer_list */ - { 344, -3 }, /* (87) db_options ::= db_options KEEP variable_list */ - { 344, -3 }, /* (88) db_options ::= db_options PAGES NK_INTEGER */ - { 344, -3 }, /* (89) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 344, -3 }, /* (90) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ - { 344, -3 }, /* (91) db_options ::= db_options PRECISION NK_STRING */ - { 344, -3 }, /* (92) db_options ::= db_options REPLICA NK_INTEGER */ - { 344, -3 }, /* (93) db_options ::= db_options VGROUPS NK_INTEGER */ - { 344, -3 }, /* (94) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 344, -3 }, /* (95) db_options ::= db_options RETENTIONS retention_list */ - { 344, -3 }, /* (96) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 344, -3 }, /* (97) db_options ::= db_options WAL_LEVEL NK_INTEGER */ - { 344, -3 }, /* (98) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ - { 344, -3 }, /* (99) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 344, -4 }, /* (100) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 344, -3 }, /* (101) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 344, -4 }, /* (102) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 344, -3 }, /* (103) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 344, -3 }, /* (104) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 344, -3 }, /* (105) db_options ::= db_options STT_TRIGGER NK_INTEGER */ - { 344, -3 }, /* (106) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ - { 344, -3 }, /* (107) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ - { 346, -1 }, /* (108) alter_db_options ::= alter_db_option */ - { 346, -2 }, /* (109) alter_db_options ::= alter_db_options alter_db_option */ - { 353, -2 }, /* (110) alter_db_option ::= BUFFER NK_INTEGER */ - { 353, -2 }, /* (111) alter_db_option ::= CACHEMODEL NK_STRING */ - { 353, -2 }, /* (112) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 353, -2 }, /* (113) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ - { 353, -2 }, /* (114) alter_db_option ::= KEEP integer_list */ - { 353, -2 }, /* (115) alter_db_option ::= KEEP variable_list */ - { 353, -2 }, /* (116) alter_db_option ::= PAGES NK_INTEGER */ - { 353, -2 }, /* (117) alter_db_option ::= REPLICA NK_INTEGER */ - { 353, -2 }, /* (118) alter_db_option ::= WAL_LEVEL NK_INTEGER */ - { 353, -2 }, /* (119) alter_db_option ::= STT_TRIGGER NK_INTEGER */ - { 353, -2 }, /* (120) alter_db_option ::= MINROWS NK_INTEGER */ - { 350, -1 }, /* (121) integer_list ::= NK_INTEGER */ - { 350, -3 }, /* (122) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 351, -1 }, /* (123) variable_list ::= NK_VARIABLE */ - { 351, -3 }, /* (124) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 352, -1 }, /* (125) retention_list ::= retention */ - { 352, -3 }, /* (126) retention_list ::= retention_list NK_COMMA retention */ - { 354, -3 }, /* (127) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 347, 0 }, /* (128) speed_opt ::= */ - { 347, -2 }, /* (129) speed_opt ::= MAX_SPEED NK_INTEGER */ - { 348, 0 }, /* (130) start_opt ::= */ - { 348, -3 }, /* (131) start_opt ::= START WITH NK_INTEGER */ - { 348, -3 }, /* (132) start_opt ::= START WITH NK_STRING */ - { 348, -4 }, /* (133) start_opt ::= START WITH TIMESTAMP NK_STRING */ - { 349, 0 }, /* (134) end_opt ::= */ - { 349, -3 }, /* (135) end_opt ::= END WITH NK_INTEGER */ - { 349, -3 }, /* (136) end_opt ::= END WITH NK_STRING */ - { 349, -4 }, /* (137) end_opt ::= END WITH TIMESTAMP NK_STRING */ - { 328, -9 }, /* (138) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 328, -3 }, /* (139) cmd ::= CREATE TABLE multi_create_clause */ - { 328, -9 }, /* (140) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 328, -3 }, /* (141) cmd ::= DROP TABLE multi_drop_clause */ - { 328, -4 }, /* (142) cmd ::= DROP STABLE exists_opt full_table_name */ - { 328, -3 }, /* (143) cmd ::= ALTER TABLE alter_table_clause */ - { 328, -3 }, /* (144) cmd ::= ALTER STABLE alter_table_clause */ - { 362, -2 }, /* (145) alter_table_clause ::= full_table_name alter_table_options */ - { 362, -5 }, /* (146) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 362, -4 }, /* (147) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 362, -5 }, /* (148) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 362, -5 }, /* (149) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 362, -5 }, /* (150) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 362, -4 }, /* (151) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 362, -5 }, /* (152) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 362, -5 }, /* (153) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 362, -6 }, /* (154) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 359, -1 }, /* (155) multi_create_clause ::= create_subtable_clause */ - { 359, -2 }, /* (156) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 367, -10 }, /* (157) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 361, -1 }, /* (158) multi_drop_clause ::= drop_table_clause */ - { 361, -3 }, /* (159) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ - { 370, -2 }, /* (160) drop_table_clause ::= exists_opt full_table_name */ - { 368, 0 }, /* (161) specific_cols_opt ::= */ - { 368, -3 }, /* (162) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 355, -1 }, /* (163) full_table_name ::= table_name */ - { 355, -3 }, /* (164) full_table_name ::= db_name NK_DOT table_name */ - { 356, -1 }, /* (165) column_def_list ::= column_def */ - { 356, -3 }, /* (166) column_def_list ::= column_def_list NK_COMMA column_def */ - { 373, -2 }, /* (167) column_def ::= column_name type_name */ - { 373, -4 }, /* (168) column_def ::= column_name type_name COMMENT NK_STRING */ - { 365, -1 }, /* (169) type_name ::= BOOL */ - { 365, -1 }, /* (170) type_name ::= TINYINT */ - { 365, -1 }, /* (171) type_name ::= SMALLINT */ - { 365, -1 }, /* (172) type_name ::= INT */ - { 365, -1 }, /* (173) type_name ::= INTEGER */ - { 365, -1 }, /* (174) type_name ::= BIGINT */ - { 365, -1 }, /* (175) type_name ::= FLOAT */ - { 365, -1 }, /* (176) type_name ::= DOUBLE */ - { 365, -4 }, /* (177) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 365, -1 }, /* (178) type_name ::= TIMESTAMP */ - { 365, -4 }, /* (179) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 365, -2 }, /* (180) type_name ::= TINYINT UNSIGNED */ - { 365, -2 }, /* (181) type_name ::= SMALLINT UNSIGNED */ - { 365, -2 }, /* (182) type_name ::= INT UNSIGNED */ - { 365, -2 }, /* (183) type_name ::= BIGINT UNSIGNED */ - { 365, -1 }, /* (184) type_name ::= JSON */ - { 365, -4 }, /* (185) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 365, -1 }, /* (186) type_name ::= MEDIUMBLOB */ - { 365, -1 }, /* (187) type_name ::= BLOB */ - { 365, -4 }, /* (188) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 365, -1 }, /* (189) type_name ::= DECIMAL */ - { 365, -4 }, /* (190) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 365, -6 }, /* (191) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 357, 0 }, /* (192) tags_def_opt ::= */ - { 357, -1 }, /* (193) tags_def_opt ::= tags_def */ - { 360, -4 }, /* (194) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 358, 0 }, /* (195) table_options ::= */ - { 358, -3 }, /* (196) table_options ::= table_options COMMENT NK_STRING */ - { 358, -3 }, /* (197) table_options ::= table_options MAX_DELAY duration_list */ - { 358, -3 }, /* (198) table_options ::= table_options WATERMARK duration_list */ - { 358, -5 }, /* (199) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 358, -3 }, /* (200) table_options ::= table_options TTL NK_INTEGER */ - { 358, -5 }, /* (201) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 358, -3 }, /* (202) table_options ::= table_options DELETE_MARK duration_list */ - { 363, -1 }, /* (203) alter_table_options ::= alter_table_option */ - { 363, -2 }, /* (204) alter_table_options ::= alter_table_options alter_table_option */ - { 376, -2 }, /* (205) alter_table_option ::= COMMENT NK_STRING */ - { 376, -2 }, /* (206) alter_table_option ::= TTL NK_INTEGER */ - { 374, -1 }, /* (207) duration_list ::= duration_literal */ - { 374, -3 }, /* (208) duration_list ::= duration_list NK_COMMA duration_literal */ - { 375, -1 }, /* (209) rollup_func_list ::= rollup_func_name */ - { 375, -3 }, /* (210) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 378, -1 }, /* (211) rollup_func_name ::= function_name */ - { 378, -1 }, /* (212) rollup_func_name ::= FIRST */ - { 378, -1 }, /* (213) rollup_func_name ::= LAST */ - { 371, -1 }, /* (214) col_name_list ::= col_name */ - { 371, -3 }, /* (215) col_name_list ::= col_name_list NK_COMMA col_name */ - { 380, -1 }, /* (216) col_name ::= column_name */ - { 328, -2 }, /* (217) cmd ::= SHOW DNODES */ - { 328, -2 }, /* (218) cmd ::= SHOW USERS */ - { 328, -3 }, /* (219) cmd ::= SHOW USER PRIVILEGES */ - { 328, -2 }, /* (220) cmd ::= SHOW DATABASES */ - { 328, -4 }, /* (221) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 328, -4 }, /* (222) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 328, -3 }, /* (223) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 328, -2 }, /* (224) cmd ::= SHOW MNODES */ - { 328, -2 }, /* (225) cmd ::= SHOW QNODES */ - { 328, -2 }, /* (226) cmd ::= SHOW FUNCTIONS */ - { 328, -5 }, /* (227) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 328, -2 }, /* (228) cmd ::= SHOW STREAMS */ - { 328, -2 }, /* (229) cmd ::= SHOW ACCOUNTS */ - { 328, -2 }, /* (230) cmd ::= SHOW APPS */ - { 328, -2 }, /* (231) cmd ::= SHOW CONNECTIONS */ - { 328, -2 }, /* (232) cmd ::= SHOW LICENCES */ - { 328, -2 }, /* (233) cmd ::= SHOW GRANTS */ - { 328, -4 }, /* (234) cmd ::= SHOW CREATE DATABASE db_name */ - { 328, -4 }, /* (235) cmd ::= SHOW CREATE TABLE full_table_name */ - { 328, -4 }, /* (236) cmd ::= SHOW CREATE STABLE full_table_name */ - { 328, -2 }, /* (237) cmd ::= SHOW QUERIES */ - { 328, -2 }, /* (238) cmd ::= SHOW SCORES */ - { 328, -2 }, /* (239) cmd ::= SHOW TOPICS */ - { 328, -2 }, /* (240) cmd ::= SHOW VARIABLES */ - { 328, -3 }, /* (241) cmd ::= SHOW CLUSTER VARIABLES */ - { 328, -3 }, /* (242) cmd ::= SHOW LOCAL VARIABLES */ - { 328, -5 }, /* (243) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ - { 328, -2 }, /* (244) cmd ::= SHOW BNODES */ - { 328, -2 }, /* (245) cmd ::= SHOW SNODES */ - { 328, -2 }, /* (246) cmd ::= SHOW CLUSTER */ - { 328, -2 }, /* (247) cmd ::= SHOW TRANSACTIONS */ - { 328, -4 }, /* (248) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 328, -2 }, /* (249) cmd ::= SHOW CONSUMERS */ - { 328, -2 }, /* (250) cmd ::= SHOW SUBSCRIPTIONS */ - { 328, -5 }, /* (251) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 328, -7 }, /* (252) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ - { 328, -3 }, /* (253) cmd ::= SHOW VNODES NK_INTEGER */ - { 328, -3 }, /* (254) cmd ::= SHOW VNODES NK_STRING */ - { 328, -3 }, /* (255) cmd ::= SHOW db_name_cond_opt ALIVE */ - { 328, -3 }, /* (256) cmd ::= SHOW CLUSTER ALIVE */ - { 381, 0 }, /* (257) db_name_cond_opt ::= */ - { 381, -2 }, /* (258) db_name_cond_opt ::= db_name NK_DOT */ - { 382, 0 }, /* (259) like_pattern_opt ::= */ - { 382, -2 }, /* (260) like_pattern_opt ::= LIKE NK_STRING */ - { 383, -1 }, /* (261) table_name_cond ::= table_name */ - { 384, 0 }, /* (262) from_db_opt ::= */ - { 384, -2 }, /* (263) from_db_opt ::= FROM db_name */ - { 385, 0 }, /* (264) tag_list_opt ::= */ - { 385, -1 }, /* (265) tag_list_opt ::= tag_item */ - { 385, -3 }, /* (266) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ - { 386, -1 }, /* (267) tag_item ::= TBNAME */ - { 386, -1 }, /* (268) tag_item ::= QTAGS */ - { 386, -1 }, /* (269) tag_item ::= column_name */ - { 386, -2 }, /* (270) tag_item ::= column_name column_alias */ - { 386, -3 }, /* (271) tag_item ::= column_name AS column_alias */ - { 328, -8 }, /* (272) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ - { 328, -9 }, /* (273) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ - { 328, -4 }, /* (274) cmd ::= DROP INDEX exists_opt full_index_name */ - { 388, -1 }, /* (275) full_index_name ::= index_name */ - { 388, -3 }, /* (276) full_index_name ::= db_name NK_DOT index_name */ - { 389, -10 }, /* (277) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 389, -12 }, /* (278) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 391, -1 }, /* (279) func_list ::= func */ - { 391, -3 }, /* (280) func_list ::= func_list NK_COMMA func */ - { 394, -4 }, /* (281) func ::= sma_func_name NK_LP expression_list NK_RP */ - { 395, -1 }, /* (282) sma_func_name ::= function_name */ - { 395, -1 }, /* (283) sma_func_name ::= COUNT */ - { 395, -1 }, /* (284) sma_func_name ::= FIRST */ - { 395, -1 }, /* (285) sma_func_name ::= LAST */ - { 395, -1 }, /* (286) sma_func_name ::= LAST_ROW */ - { 393, 0 }, /* (287) sma_stream_opt ::= */ - { 393, -3 }, /* (288) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ - { 393, -3 }, /* (289) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ - { 393, -3 }, /* (290) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ - { 328, -6 }, /* (291) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ - { 328, -7 }, /* (292) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 328, -9 }, /* (293) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 328, -7 }, /* (294) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 328, -9 }, /* (295) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 328, -4 }, /* (296) cmd ::= DROP TOPIC exists_opt topic_name */ - { 328, -7 }, /* (297) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 328, -2 }, /* (298) cmd ::= DESC full_table_name */ - { 328, -2 }, /* (299) cmd ::= DESCRIBE full_table_name */ - { 328, -3 }, /* (300) cmd ::= RESET QUERY CACHE */ - { 328, -4 }, /* (301) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - { 328, -4 }, /* (302) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ - { 398, 0 }, /* (303) analyze_opt ::= */ - { 398, -1 }, /* (304) analyze_opt ::= ANALYZE */ - { 399, 0 }, /* (305) explain_options ::= */ - { 399, -3 }, /* (306) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 399, -3 }, /* (307) explain_options ::= explain_options RATIO NK_FLOAT */ - { 328, -10 }, /* (308) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 328, -4 }, /* (309) cmd ::= DROP FUNCTION exists_opt function_name */ - { 401, 0 }, /* (310) agg_func_opt ::= */ - { 401, -1 }, /* (311) agg_func_opt ::= AGGREGATE */ - { 402, 0 }, /* (312) bufsize_opt ::= */ - { 402, -2 }, /* (313) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 328, -12 }, /* (314) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ - { 328, -4 }, /* (315) cmd ::= DROP STREAM exists_opt stream_name */ - { 405, 0 }, /* (316) col_list_opt ::= */ - { 405, -3 }, /* (317) col_list_opt ::= NK_LP col_name_list NK_RP */ - { 406, 0 }, /* (318) tag_def_or_ref_opt ::= */ - { 406, -1 }, /* (319) tag_def_or_ref_opt ::= tags_def */ - { 406, -4 }, /* (320) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ - { 404, 0 }, /* (321) stream_options ::= */ - { 404, -3 }, /* (322) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 404, -3 }, /* (323) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 404, -4 }, /* (324) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 404, -3 }, /* (325) stream_options ::= stream_options WATERMARK duration_literal */ - { 404, -4 }, /* (326) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ - { 404, -3 }, /* (327) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ - { 404, -3 }, /* (328) stream_options ::= stream_options DELETE_MARK duration_literal */ - { 404, -4 }, /* (329) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ - { 407, 0 }, /* (330) subtable_opt ::= */ - { 407, -4 }, /* (331) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - { 328, -3 }, /* (332) cmd ::= KILL CONNECTION NK_INTEGER */ - { 328, -3 }, /* (333) cmd ::= KILL QUERY NK_STRING */ - { 328, -3 }, /* (334) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 328, -2 }, /* (335) cmd ::= BALANCE VGROUP */ - { 328, -4 }, /* (336) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 328, -4 }, /* (337) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 328, -3 }, /* (338) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 409, -2 }, /* (339) dnode_list ::= DNODE NK_INTEGER */ - { 409, -3 }, /* (340) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 328, -4 }, /* (341) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 328, -1 }, /* (342) cmd ::= query_or_subquery */ - { 328, -1 }, /* (343) cmd ::= insert_query */ - { 400, -7 }, /* (344) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ - { 400, -4 }, /* (345) insert_query ::= INSERT INTO full_table_name query_or_subquery */ - { 331, -1 }, /* (346) literal ::= NK_INTEGER */ - { 331, -1 }, /* (347) literal ::= NK_FLOAT */ - { 331, -1 }, /* (348) literal ::= NK_STRING */ - { 331, -1 }, /* (349) literal ::= NK_BOOL */ - { 331, -2 }, /* (350) literal ::= TIMESTAMP NK_STRING */ - { 331, -1 }, /* (351) literal ::= duration_literal */ - { 331, -1 }, /* (352) literal ::= NULL */ - { 331, -1 }, /* (353) literal ::= NK_QUESTION */ - { 377, -1 }, /* (354) duration_literal ::= NK_VARIABLE */ - { 411, -1 }, /* (355) signed ::= NK_INTEGER */ - { 411, -2 }, /* (356) signed ::= NK_PLUS NK_INTEGER */ - { 411, -2 }, /* (357) signed ::= NK_MINUS NK_INTEGER */ - { 411, -1 }, /* (358) signed ::= NK_FLOAT */ - { 411, -2 }, /* (359) signed ::= NK_PLUS NK_FLOAT */ - { 411, -2 }, /* (360) signed ::= NK_MINUS NK_FLOAT */ - { 366, -1 }, /* (361) signed_literal ::= signed */ - { 366, -1 }, /* (362) signed_literal ::= NK_STRING */ - { 366, -1 }, /* (363) signed_literal ::= NK_BOOL */ - { 366, -2 }, /* (364) signed_literal ::= TIMESTAMP NK_STRING */ - { 366, -1 }, /* (365) signed_literal ::= duration_literal */ - { 366, -1 }, /* (366) signed_literal ::= NULL */ - { 366, -1 }, /* (367) signed_literal ::= literal_func */ - { 366, -1 }, /* (368) signed_literal ::= NK_QUESTION */ - { 413, -1 }, /* (369) literal_list ::= signed_literal */ - { 413, -3 }, /* (370) literal_list ::= literal_list NK_COMMA signed_literal */ - { 339, -1 }, /* (371) db_name ::= NK_ID */ - { 372, -1 }, /* (372) table_name ::= NK_ID */ - { 364, -1 }, /* (373) column_name ::= NK_ID */ - { 379, -1 }, /* (374) function_name ::= NK_ID */ - { 414, -1 }, /* (375) table_alias ::= NK_ID */ - { 387, -1 }, /* (376) column_alias ::= NK_ID */ - { 333, -1 }, /* (377) user_name ::= NK_ID */ - { 340, -1 }, /* (378) topic_name ::= NK_ID */ - { 403, -1 }, /* (379) stream_name ::= NK_ID */ - { 397, -1 }, /* (380) cgroup_name ::= NK_ID */ - { 390, -1 }, /* (381) index_name ::= NK_ID */ - { 415, -1 }, /* (382) expr_or_subquery ::= expression */ - { 408, -1 }, /* (383) expression ::= literal */ - { 408, -1 }, /* (384) expression ::= pseudo_column */ - { 408, -1 }, /* (385) expression ::= column_reference */ - { 408, -1 }, /* (386) expression ::= function_expression */ - { 408, -1 }, /* (387) expression ::= case_when_expression */ - { 408, -3 }, /* (388) expression ::= NK_LP expression NK_RP */ - { 408, -2 }, /* (389) expression ::= NK_PLUS expr_or_subquery */ - { 408, -2 }, /* (390) expression ::= NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (391) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ - { 408, -3 }, /* (392) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ - { 408, -3 }, /* (393) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ - { 408, -3 }, /* (394) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ - { 408, -3 }, /* (395) expression ::= expr_or_subquery NK_REM expr_or_subquery */ - { 408, -3 }, /* (396) expression ::= column_reference NK_ARROW NK_STRING */ - { 408, -3 }, /* (397) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ - { 408, -3 }, /* (398) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ - { 369, -1 }, /* (399) expression_list ::= expr_or_subquery */ - { 369, -3 }, /* (400) expression_list ::= expression_list NK_COMMA expr_or_subquery */ - { 417, -1 }, /* (401) column_reference ::= column_name */ - { 417, -3 }, /* (402) column_reference ::= table_name NK_DOT column_name */ - { 416, -1 }, /* (403) pseudo_column ::= ROWTS */ - { 416, -1 }, /* (404) pseudo_column ::= TBNAME */ - { 416, -3 }, /* (405) pseudo_column ::= table_name NK_DOT TBNAME */ - { 416, -1 }, /* (406) pseudo_column ::= QSTART */ - { 416, -1 }, /* (407) pseudo_column ::= QEND */ - { 416, -1 }, /* (408) pseudo_column ::= QDURATION */ - { 416, -1 }, /* (409) pseudo_column ::= WSTART */ - { 416, -1 }, /* (410) pseudo_column ::= WEND */ - { 416, -1 }, /* (411) pseudo_column ::= WDURATION */ - { 416, -1 }, /* (412) pseudo_column ::= IROWTS */ - { 416, -1 }, /* (413) pseudo_column ::= ISFILLED */ - { 416, -1 }, /* (414) pseudo_column ::= QTAGS */ - { 418, -4 }, /* (415) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 418, -4 }, /* (416) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 418, -6 }, /* (417) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ - { 418, -1 }, /* (418) function_expression ::= literal_func */ - { 412, -3 }, /* (419) literal_func ::= noarg_func NK_LP NK_RP */ - { 412, -1 }, /* (420) literal_func ::= NOW */ - { 422, -1 }, /* (421) noarg_func ::= NOW */ - { 422, -1 }, /* (422) noarg_func ::= TODAY */ - { 422, -1 }, /* (423) noarg_func ::= TIMEZONE */ - { 422, -1 }, /* (424) noarg_func ::= DATABASE */ - { 422, -1 }, /* (425) noarg_func ::= CLIENT_VERSION */ - { 422, -1 }, /* (426) noarg_func ::= SERVER_VERSION */ - { 422, -1 }, /* (427) noarg_func ::= SERVER_STATUS */ - { 422, -1 }, /* (428) noarg_func ::= CURRENT_USER */ - { 422, -1 }, /* (429) noarg_func ::= USER */ - { 420, -1 }, /* (430) star_func ::= COUNT */ - { 420, -1 }, /* (431) star_func ::= FIRST */ - { 420, -1 }, /* (432) star_func ::= LAST */ - { 420, -1 }, /* (433) star_func ::= LAST_ROW */ - { 421, -1 }, /* (434) star_func_para_list ::= NK_STAR */ - { 421, -1 }, /* (435) star_func_para_list ::= other_para_list */ - { 423, -1 }, /* (436) other_para_list ::= star_func_para */ - { 423, -3 }, /* (437) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 424, -1 }, /* (438) star_func_para ::= expr_or_subquery */ - { 424, -3 }, /* (439) star_func_para ::= table_name NK_DOT NK_STAR */ - { 419, -4 }, /* (440) case_when_expression ::= CASE when_then_list case_when_else_opt END */ - { 419, -5 }, /* (441) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ - { 425, -1 }, /* (442) when_then_list ::= when_then_expr */ - { 425, -2 }, /* (443) when_then_list ::= when_then_list when_then_expr */ - { 428, -4 }, /* (444) when_then_expr ::= WHEN common_expression THEN common_expression */ - { 426, 0 }, /* (445) case_when_else_opt ::= */ - { 426, -2 }, /* (446) case_when_else_opt ::= ELSE common_expression */ - { 429, -3 }, /* (447) predicate ::= expr_or_subquery compare_op expr_or_subquery */ - { 429, -5 }, /* (448) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -6 }, /* (449) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ - { 429, -3 }, /* (450) predicate ::= expr_or_subquery IS NULL */ - { 429, -4 }, /* (451) predicate ::= expr_or_subquery IS NOT NULL */ - { 429, -3 }, /* (452) predicate ::= expr_or_subquery in_op in_predicate_value */ - { 430, -1 }, /* (453) compare_op ::= NK_LT */ - { 430, -1 }, /* (454) compare_op ::= NK_GT */ - { 430, -1 }, /* (455) compare_op ::= NK_LE */ - { 430, -1 }, /* (456) compare_op ::= NK_GE */ - { 430, -1 }, /* (457) compare_op ::= NK_NE */ - { 430, -1 }, /* (458) compare_op ::= NK_EQ */ - { 430, -1 }, /* (459) compare_op ::= LIKE */ - { 430, -2 }, /* (460) compare_op ::= NOT LIKE */ - { 430, -1 }, /* (461) compare_op ::= MATCH */ - { 430, -1 }, /* (462) compare_op ::= NMATCH */ - { 430, -1 }, /* (463) compare_op ::= CONTAINS */ - { 431, -1 }, /* (464) in_op ::= IN */ - { 431, -2 }, /* (465) in_op ::= NOT IN */ - { 432, -3 }, /* (466) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 433, -1 }, /* (467) boolean_value_expression ::= boolean_primary */ - { 433, -2 }, /* (468) boolean_value_expression ::= NOT boolean_primary */ - { 433, -3 }, /* (469) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 433, -3 }, /* (470) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 434, -1 }, /* (471) boolean_primary ::= predicate */ - { 434, -3 }, /* (472) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 427, -1 }, /* (473) common_expression ::= expr_or_subquery */ - { 427, -1 }, /* (474) common_expression ::= boolean_value_expression */ - { 435, 0 }, /* (475) from_clause_opt ::= */ - { 435, -2 }, /* (476) from_clause_opt ::= FROM table_reference_list */ - { 436, -1 }, /* (477) table_reference_list ::= table_reference */ - { 436, -3 }, /* (478) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 437, -1 }, /* (479) table_reference ::= table_primary */ - { 437, -1 }, /* (480) table_reference ::= joined_table */ - { 438, -2 }, /* (481) table_primary ::= table_name alias_opt */ - { 438, -4 }, /* (482) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 438, -2 }, /* (483) table_primary ::= subquery alias_opt */ - { 438, -1 }, /* (484) table_primary ::= parenthesized_joined_table */ - { 440, 0 }, /* (485) alias_opt ::= */ - { 440, -1 }, /* (486) alias_opt ::= table_alias */ - { 440, -2 }, /* (487) alias_opt ::= AS table_alias */ - { 442, -3 }, /* (488) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 442, -3 }, /* (489) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 439, -6 }, /* (490) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 443, 0 }, /* (491) join_type ::= */ - { 443, -1 }, /* (492) join_type ::= INNER */ - { 445, -12 }, /* (493) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 446, 0 }, /* (494) set_quantifier_opt ::= */ - { 446, -1 }, /* (495) set_quantifier_opt ::= DISTINCT */ - { 446, -1 }, /* (496) set_quantifier_opt ::= ALL */ - { 447, -1 }, /* (497) select_list ::= select_item */ - { 447, -3 }, /* (498) select_list ::= select_list NK_COMMA select_item */ - { 455, -1 }, /* (499) select_item ::= NK_STAR */ - { 455, -1 }, /* (500) select_item ::= common_expression */ - { 455, -2 }, /* (501) select_item ::= common_expression column_alias */ - { 455, -3 }, /* (502) select_item ::= common_expression AS column_alias */ - { 455, -3 }, /* (503) select_item ::= table_name NK_DOT NK_STAR */ - { 410, 0 }, /* (504) where_clause_opt ::= */ - { 410, -2 }, /* (505) where_clause_opt ::= WHERE search_condition */ - { 448, 0 }, /* (506) partition_by_clause_opt ::= */ - { 448, -3 }, /* (507) partition_by_clause_opt ::= PARTITION BY partition_list */ - { 456, -1 }, /* (508) partition_list ::= partition_item */ - { 456, -3 }, /* (509) partition_list ::= partition_list NK_COMMA partition_item */ - { 457, -1 }, /* (510) partition_item ::= expr_or_subquery */ - { 457, -2 }, /* (511) partition_item ::= expr_or_subquery column_alias */ - { 457, -3 }, /* (512) partition_item ::= expr_or_subquery AS column_alias */ - { 452, 0 }, /* (513) twindow_clause_opt ::= */ - { 452, -6 }, /* (514) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 452, -4 }, /* (515) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ - { 452, -6 }, /* (516) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 452, -8 }, /* (517) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 452, -7 }, /* (518) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ - { 392, 0 }, /* (519) sliding_opt ::= */ - { 392, -4 }, /* (520) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 451, 0 }, /* (521) fill_opt ::= */ - { 451, -4 }, /* (522) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 451, -6 }, /* (523) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 451, -6 }, /* (524) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ - { 458, -1 }, /* (525) fill_mode ::= NONE */ - { 458, -1 }, /* (526) fill_mode ::= PREV */ - { 458, -1 }, /* (527) fill_mode ::= NULL */ - { 458, -1 }, /* (528) fill_mode ::= NULL_F */ - { 458, -1 }, /* (529) fill_mode ::= LINEAR */ - { 458, -1 }, /* (530) fill_mode ::= NEXT */ - { 453, 0 }, /* (531) group_by_clause_opt ::= */ - { 453, -3 }, /* (532) group_by_clause_opt ::= GROUP BY group_by_list */ - { 459, -1 }, /* (533) group_by_list ::= expr_or_subquery */ - { 459, -3 }, /* (534) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ - { 454, 0 }, /* (535) having_clause_opt ::= */ - { 454, -2 }, /* (536) having_clause_opt ::= HAVING search_condition */ - { 449, 0 }, /* (537) range_opt ::= */ - { 449, -6 }, /* (538) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ - { 450, 0 }, /* (539) every_opt ::= */ - { 450, -4 }, /* (540) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 460, -4 }, /* (541) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 461, -1 }, /* (542) query_simple ::= query_specification */ - { 461, -1 }, /* (543) query_simple ::= union_query_expression */ - { 465, -4 }, /* (544) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ - { 465, -3 }, /* (545) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ - { 466, -1 }, /* (546) query_simple_or_subquery ::= query_simple */ - { 466, -1 }, /* (547) query_simple_or_subquery ::= subquery */ - { 396, -1 }, /* (548) query_or_subquery ::= query_expression */ - { 396, -1 }, /* (549) query_or_subquery ::= subquery */ - { 462, 0 }, /* (550) order_by_clause_opt ::= */ - { 462, -3 }, /* (551) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 463, 0 }, /* (552) slimit_clause_opt ::= */ - { 463, -2 }, /* (553) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 463, -4 }, /* (554) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 463, -4 }, /* (555) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 464, 0 }, /* (556) limit_clause_opt ::= */ - { 464, -2 }, /* (557) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 464, -4 }, /* (558) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 464, -4 }, /* (559) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 441, -3 }, /* (560) subquery ::= NK_LP query_expression NK_RP */ - { 441, -3 }, /* (561) subquery ::= NK_LP subquery NK_RP */ - { 444, -1 }, /* (562) search_condition ::= common_expression */ - { 467, -1 }, /* (563) sort_specification_list ::= sort_specification */ - { 467, -3 }, /* (564) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 468, -3 }, /* (565) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ - { 469, 0 }, /* (566) ordering_specification_opt ::= */ - { 469, -1 }, /* (567) ordering_specification_opt ::= ASC */ - { 469, -1 }, /* (568) ordering_specification_opt ::= DESC */ - { 470, 0 }, /* (569) null_ordering_opt ::= */ - { 470, -2 }, /* (570) null_ordering_opt ::= NULLS FIRST */ - { 470, -2 }, /* (571) null_ordering_opt ::= NULLS LAST */ + { 336, -3 }, /* (42) priv_level ::= db_name NK_DOT table_name */ + { 336, -1 }, /* (43) priv_level ::= topic_name */ + { 337, 0 }, /* (44) with_opt ::= */ + { 337, -2 }, /* (45) with_opt ::= WITH search_condition */ + { 328, -3 }, /* (46) cmd ::= CREATE DNODE dnode_endpoint */ + { 328, -5 }, /* (47) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 328, -4 }, /* (48) cmd ::= DROP DNODE NK_INTEGER force_opt */ + { 328, -4 }, /* (49) cmd ::= DROP DNODE dnode_endpoint force_opt */ + { 328, -4 }, /* (50) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 328, -5 }, /* (51) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 328, -4 }, /* (52) cmd ::= ALTER ALL DNODES NK_STRING */ + { 328, -5 }, /* (53) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 344, -1 }, /* (54) dnode_endpoint ::= NK_STRING */ + { 344, -1 }, /* (55) dnode_endpoint ::= NK_ID */ + { 344, -1 }, /* (56) dnode_endpoint ::= NK_IPTOKEN */ + { 345, 0 }, /* (57) force_opt ::= */ + { 345, -1 }, /* (58) force_opt ::= FORCE */ + { 328, -3 }, /* (59) cmd ::= ALTER LOCAL NK_STRING */ + { 328, -4 }, /* (60) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 328, -5 }, /* (61) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (62) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (63) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (64) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (65) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (66) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (67) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (68) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 328, -5 }, /* (69) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 328, -4 }, /* (70) cmd ::= DROP DATABASE exists_opt db_name */ + { 328, -2 }, /* (71) cmd ::= USE db_name */ + { 328, -4 }, /* (72) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 328, -3 }, /* (73) cmd ::= FLUSH DATABASE db_name */ + { 328, -4 }, /* (74) cmd ::= TRIM DATABASE db_name speed_opt */ + { 328, -5 }, /* (75) cmd ::= COMPACT DATABASE db_name start_opt end_opt */ + { 346, -3 }, /* (76) not_exists_opt ::= IF NOT EXISTS */ + { 346, 0 }, /* (77) not_exists_opt ::= */ + { 348, -2 }, /* (78) exists_opt ::= IF EXISTS */ + { 348, 0 }, /* (79) exists_opt ::= */ + { 347, 0 }, /* (80) db_options ::= */ + { 347, -3 }, /* (81) db_options ::= db_options BUFFER NK_INTEGER */ + { 347, -3 }, /* (82) db_options ::= db_options CACHEMODEL NK_STRING */ + { 347, -3 }, /* (83) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 347, -3 }, /* (84) db_options ::= db_options COMP NK_INTEGER */ + { 347, -3 }, /* (85) db_options ::= db_options DURATION NK_INTEGER */ + { 347, -3 }, /* (86) db_options ::= db_options DURATION NK_VARIABLE */ + { 347, -3 }, /* (87) db_options ::= db_options MAXROWS NK_INTEGER */ + { 347, -3 }, /* (88) db_options ::= db_options MINROWS NK_INTEGER */ + { 347, -3 }, /* (89) db_options ::= db_options KEEP integer_list */ + { 347, -3 }, /* (90) db_options ::= db_options KEEP variable_list */ + { 347, -3 }, /* (91) db_options ::= db_options PAGES NK_INTEGER */ + { 347, -3 }, /* (92) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 347, -3 }, /* (93) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ + { 347, -3 }, /* (94) db_options ::= db_options PRECISION NK_STRING */ + { 347, -3 }, /* (95) db_options ::= db_options REPLICA NK_INTEGER */ + { 347, -3 }, /* (96) db_options ::= db_options VGROUPS NK_INTEGER */ + { 347, -3 }, /* (97) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 347, -3 }, /* (98) db_options ::= db_options RETENTIONS retention_list */ + { 347, -3 }, /* (99) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 347, -3 }, /* (100) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 347, -3 }, /* (101) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 347, -3 }, /* (102) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 347, -4 }, /* (103) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 347, -3 }, /* (104) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 347, -4 }, /* (105) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 347, -3 }, /* (106) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 347, -3 }, /* (107) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 347, -3 }, /* (108) db_options ::= db_options STT_TRIGGER NK_INTEGER */ + { 347, -3 }, /* (109) db_options ::= db_options TABLE_PREFIX NK_INTEGER */ + { 347, -3 }, /* (110) db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ + { 349, -1 }, /* (111) alter_db_options ::= alter_db_option */ + { 349, -2 }, /* (112) alter_db_options ::= alter_db_options alter_db_option */ + { 356, -2 }, /* (113) alter_db_option ::= BUFFER NK_INTEGER */ + { 356, -2 }, /* (114) alter_db_option ::= CACHEMODEL NK_STRING */ + { 356, -2 }, /* (115) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 356, -2 }, /* (116) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 356, -2 }, /* (117) alter_db_option ::= KEEP integer_list */ + { 356, -2 }, /* (118) alter_db_option ::= KEEP variable_list */ + { 356, -2 }, /* (119) alter_db_option ::= PAGES NK_INTEGER */ + { 356, -2 }, /* (120) alter_db_option ::= REPLICA NK_INTEGER */ + { 356, -2 }, /* (121) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 356, -2 }, /* (122) alter_db_option ::= STT_TRIGGER NK_INTEGER */ + { 356, -2 }, /* (123) alter_db_option ::= MINROWS NK_INTEGER */ + { 353, -1 }, /* (124) integer_list ::= NK_INTEGER */ + { 353, -3 }, /* (125) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 354, -1 }, /* (126) variable_list ::= NK_VARIABLE */ + { 354, -3 }, /* (127) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 355, -1 }, /* (128) retention_list ::= retention */ + { 355, -3 }, /* (129) retention_list ::= retention_list NK_COMMA retention */ + { 357, -3 }, /* (130) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 350, 0 }, /* (131) speed_opt ::= */ + { 350, -2 }, /* (132) speed_opt ::= MAX_SPEED NK_INTEGER */ + { 351, 0 }, /* (133) start_opt ::= */ + { 351, -3 }, /* (134) start_opt ::= START WITH NK_INTEGER */ + { 351, -3 }, /* (135) start_opt ::= START WITH NK_STRING */ + { 351, -4 }, /* (136) start_opt ::= START WITH TIMESTAMP NK_STRING */ + { 352, 0 }, /* (137) end_opt ::= */ + { 352, -3 }, /* (138) end_opt ::= END WITH NK_INTEGER */ + { 352, -3 }, /* (139) end_opt ::= END WITH NK_STRING */ + { 352, -4 }, /* (140) end_opt ::= END WITH TIMESTAMP NK_STRING */ + { 328, -9 }, /* (141) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 328, -3 }, /* (142) cmd ::= CREATE TABLE multi_create_clause */ + { 328, -9 }, /* (143) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 328, -3 }, /* (144) cmd ::= DROP TABLE multi_drop_clause */ + { 328, -4 }, /* (145) cmd ::= DROP STABLE exists_opt full_table_name */ + { 328, -3 }, /* (146) cmd ::= ALTER TABLE alter_table_clause */ + { 328, -3 }, /* (147) cmd ::= ALTER STABLE alter_table_clause */ + { 365, -2 }, /* (148) alter_table_clause ::= full_table_name alter_table_options */ + { 365, -5 }, /* (149) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 365, -4 }, /* (150) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 365, -5 }, /* (151) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 365, -5 }, /* (152) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 365, -5 }, /* (153) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 365, -4 }, /* (154) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 365, -5 }, /* (155) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 365, -5 }, /* (156) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 365, -6 }, /* (157) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 362, -1 }, /* (158) multi_create_clause ::= create_subtable_clause */ + { 362, -2 }, /* (159) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 370, -10 }, /* (160) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 364, -1 }, /* (161) multi_drop_clause ::= drop_table_clause */ + { 364, -3 }, /* (162) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ + { 373, -2 }, /* (163) drop_table_clause ::= exists_opt full_table_name */ + { 371, 0 }, /* (164) specific_cols_opt ::= */ + { 371, -3 }, /* (165) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 358, -1 }, /* (166) full_table_name ::= table_name */ + { 358, -3 }, /* (167) full_table_name ::= db_name NK_DOT table_name */ + { 359, -1 }, /* (168) column_def_list ::= column_def */ + { 359, -3 }, /* (169) column_def_list ::= column_def_list NK_COMMA column_def */ + { 375, -2 }, /* (170) column_def ::= column_name type_name */ + { 375, -4 }, /* (171) column_def ::= column_name type_name COMMENT NK_STRING */ + { 368, -1 }, /* (172) type_name ::= BOOL */ + { 368, -1 }, /* (173) type_name ::= TINYINT */ + { 368, -1 }, /* (174) type_name ::= SMALLINT */ + { 368, -1 }, /* (175) type_name ::= INT */ + { 368, -1 }, /* (176) type_name ::= INTEGER */ + { 368, -1 }, /* (177) type_name ::= BIGINT */ + { 368, -1 }, /* (178) type_name ::= FLOAT */ + { 368, -1 }, /* (179) type_name ::= DOUBLE */ + { 368, -4 }, /* (180) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 368, -1 }, /* (181) type_name ::= TIMESTAMP */ + { 368, -4 }, /* (182) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 368, -2 }, /* (183) type_name ::= TINYINT UNSIGNED */ + { 368, -2 }, /* (184) type_name ::= SMALLINT UNSIGNED */ + { 368, -2 }, /* (185) type_name ::= INT UNSIGNED */ + { 368, -2 }, /* (186) type_name ::= BIGINT UNSIGNED */ + { 368, -1 }, /* (187) type_name ::= JSON */ + { 368, -4 }, /* (188) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 368, -1 }, /* (189) type_name ::= MEDIUMBLOB */ + { 368, -1 }, /* (190) type_name ::= BLOB */ + { 368, -4 }, /* (191) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 368, -1 }, /* (192) type_name ::= DECIMAL */ + { 368, -4 }, /* (193) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 368, -6 }, /* (194) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 360, 0 }, /* (195) tags_def_opt ::= */ + { 360, -1 }, /* (196) tags_def_opt ::= tags_def */ + { 363, -4 }, /* (197) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 361, 0 }, /* (198) table_options ::= */ + { 361, -3 }, /* (199) table_options ::= table_options COMMENT NK_STRING */ + { 361, -3 }, /* (200) table_options ::= table_options MAX_DELAY duration_list */ + { 361, -3 }, /* (201) table_options ::= table_options WATERMARK duration_list */ + { 361, -5 }, /* (202) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 361, -3 }, /* (203) table_options ::= table_options TTL NK_INTEGER */ + { 361, -5 }, /* (204) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 361, -3 }, /* (205) table_options ::= table_options DELETE_MARK duration_list */ + { 366, -1 }, /* (206) alter_table_options ::= alter_table_option */ + { 366, -2 }, /* (207) alter_table_options ::= alter_table_options alter_table_option */ + { 378, -2 }, /* (208) alter_table_option ::= COMMENT NK_STRING */ + { 378, -2 }, /* (209) alter_table_option ::= TTL NK_INTEGER */ + { 376, -1 }, /* (210) duration_list ::= duration_literal */ + { 376, -3 }, /* (211) duration_list ::= duration_list NK_COMMA duration_literal */ + { 377, -1 }, /* (212) rollup_func_list ::= rollup_func_name */ + { 377, -3 }, /* (213) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 380, -1 }, /* (214) rollup_func_name ::= function_name */ + { 380, -1 }, /* (215) rollup_func_name ::= FIRST */ + { 380, -1 }, /* (216) rollup_func_name ::= LAST */ + { 374, -1 }, /* (217) col_name_list ::= col_name */ + { 374, -3 }, /* (218) col_name_list ::= col_name_list NK_COMMA col_name */ + { 382, -1 }, /* (219) col_name ::= column_name */ + { 328, -2 }, /* (220) cmd ::= SHOW DNODES */ + { 328, -2 }, /* (221) cmd ::= SHOW USERS */ + { 328, -3 }, /* (222) cmd ::= SHOW USER PRIVILEGES */ + { 328, -2 }, /* (223) cmd ::= SHOW DATABASES */ + { 328, -4 }, /* (224) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 328, -4 }, /* (225) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 328, -3 }, /* (226) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 328, -2 }, /* (227) cmd ::= SHOW MNODES */ + { 328, -2 }, /* (228) cmd ::= SHOW QNODES */ + { 328, -2 }, /* (229) cmd ::= SHOW FUNCTIONS */ + { 328, -5 }, /* (230) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 328, -2 }, /* (231) cmd ::= SHOW STREAMS */ + { 328, -2 }, /* (232) cmd ::= SHOW ACCOUNTS */ + { 328, -2 }, /* (233) cmd ::= SHOW APPS */ + { 328, -2 }, /* (234) cmd ::= SHOW CONNECTIONS */ + { 328, -2 }, /* (235) cmd ::= SHOW LICENCES */ + { 328, -2 }, /* (236) cmd ::= SHOW GRANTS */ + { 328, -4 }, /* (237) cmd ::= SHOW CREATE DATABASE db_name */ + { 328, -4 }, /* (238) cmd ::= SHOW CREATE TABLE full_table_name */ + { 328, -4 }, /* (239) cmd ::= SHOW CREATE STABLE full_table_name */ + { 328, -2 }, /* (240) cmd ::= SHOW QUERIES */ + { 328, -2 }, /* (241) cmd ::= SHOW SCORES */ + { 328, -2 }, /* (242) cmd ::= SHOW TOPICS */ + { 328, -2 }, /* (243) cmd ::= SHOW VARIABLES */ + { 328, -3 }, /* (244) cmd ::= SHOW CLUSTER VARIABLES */ + { 328, -3 }, /* (245) cmd ::= SHOW LOCAL VARIABLES */ + { 328, -5 }, /* (246) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ + { 328, -2 }, /* (247) cmd ::= SHOW BNODES */ + { 328, -2 }, /* (248) cmd ::= SHOW SNODES */ + { 328, -2 }, /* (249) cmd ::= SHOW CLUSTER */ + { 328, -2 }, /* (250) cmd ::= SHOW TRANSACTIONS */ + { 328, -4 }, /* (251) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 328, -2 }, /* (252) cmd ::= SHOW CONSUMERS */ + { 328, -2 }, /* (253) cmd ::= SHOW SUBSCRIPTIONS */ + { 328, -5 }, /* (254) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 328, -7 }, /* (255) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ + { 328, -3 }, /* (256) cmd ::= SHOW VNODES NK_INTEGER */ + { 328, -3 }, /* (257) cmd ::= SHOW VNODES NK_STRING */ + { 328, -3 }, /* (258) cmd ::= SHOW db_name_cond_opt ALIVE */ + { 328, -3 }, /* (259) cmd ::= SHOW CLUSTER ALIVE */ + { 383, 0 }, /* (260) db_name_cond_opt ::= */ + { 383, -2 }, /* (261) db_name_cond_opt ::= db_name NK_DOT */ + { 384, 0 }, /* (262) like_pattern_opt ::= */ + { 384, -2 }, /* (263) like_pattern_opt ::= LIKE NK_STRING */ + { 385, -1 }, /* (264) table_name_cond ::= table_name */ + { 386, 0 }, /* (265) from_db_opt ::= */ + { 386, -2 }, /* (266) from_db_opt ::= FROM db_name */ + { 387, 0 }, /* (267) tag_list_opt ::= */ + { 387, -1 }, /* (268) tag_list_opt ::= tag_item */ + { 387, -3 }, /* (269) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ + { 388, -1 }, /* (270) tag_item ::= TBNAME */ + { 388, -1 }, /* (271) tag_item ::= QTAGS */ + { 388, -1 }, /* (272) tag_item ::= column_name */ + { 388, -2 }, /* (273) tag_item ::= column_name column_alias */ + { 388, -3 }, /* (274) tag_item ::= column_name AS column_alias */ + { 328, -8 }, /* (275) cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ + { 328, -9 }, /* (276) cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ + { 328, -4 }, /* (277) cmd ::= DROP INDEX exists_opt full_index_name */ + { 390, -1 }, /* (278) full_index_name ::= index_name */ + { 390, -3 }, /* (279) full_index_name ::= db_name NK_DOT index_name */ + { 391, -10 }, /* (280) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 391, -12 }, /* (281) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 393, -1 }, /* (282) func_list ::= func */ + { 393, -3 }, /* (283) func_list ::= func_list NK_COMMA func */ + { 396, -4 }, /* (284) func ::= sma_func_name NK_LP expression_list NK_RP */ + { 397, -1 }, /* (285) sma_func_name ::= function_name */ + { 397, -1 }, /* (286) sma_func_name ::= COUNT */ + { 397, -1 }, /* (287) sma_func_name ::= FIRST */ + { 397, -1 }, /* (288) sma_func_name ::= LAST */ + { 397, -1 }, /* (289) sma_func_name ::= LAST_ROW */ + { 395, 0 }, /* (290) sma_stream_opt ::= */ + { 395, -3 }, /* (291) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ + { 395, -3 }, /* (292) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ + { 395, -3 }, /* (293) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ + { 328, -6 }, /* (294) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ + { 328, -7 }, /* (295) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 328, -9 }, /* (296) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 328, -7 }, /* (297) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 328, -9 }, /* (298) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 328, -4 }, /* (299) cmd ::= DROP TOPIC exists_opt topic_name */ + { 328, -7 }, /* (300) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 328, -2 }, /* (301) cmd ::= DESC full_table_name */ + { 328, -2 }, /* (302) cmd ::= DESCRIBE full_table_name */ + { 328, -3 }, /* (303) cmd ::= RESET QUERY CACHE */ + { 328, -4 }, /* (304) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + { 328, -4 }, /* (305) cmd ::= EXPLAIN analyze_opt explain_options insert_query */ + { 400, 0 }, /* (306) analyze_opt ::= */ + { 400, -1 }, /* (307) analyze_opt ::= ANALYZE */ + { 401, 0 }, /* (308) explain_options ::= */ + { 401, -3 }, /* (309) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 401, -3 }, /* (310) explain_options ::= explain_options RATIO NK_FLOAT */ + { 328, -10 }, /* (311) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 328, -4 }, /* (312) cmd ::= DROP FUNCTION exists_opt function_name */ + { 403, 0 }, /* (313) agg_func_opt ::= */ + { 403, -1 }, /* (314) agg_func_opt ::= AGGREGATE */ + { 404, 0 }, /* (315) bufsize_opt ::= */ + { 404, -2 }, /* (316) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 328, -12 }, /* (317) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ + { 328, -4 }, /* (318) cmd ::= DROP STREAM exists_opt stream_name */ + { 407, 0 }, /* (319) col_list_opt ::= */ + { 407, -3 }, /* (320) col_list_opt ::= NK_LP col_name_list NK_RP */ + { 408, 0 }, /* (321) tag_def_or_ref_opt ::= */ + { 408, -1 }, /* (322) tag_def_or_ref_opt ::= tags_def */ + { 408, -4 }, /* (323) tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ + { 406, 0 }, /* (324) stream_options ::= */ + { 406, -3 }, /* (325) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 406, -3 }, /* (326) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 406, -4 }, /* (327) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 406, -3 }, /* (328) stream_options ::= stream_options WATERMARK duration_literal */ + { 406, -4 }, /* (329) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ + { 406, -3 }, /* (330) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ + { 406, -3 }, /* (331) stream_options ::= stream_options DELETE_MARK duration_literal */ + { 406, -4 }, /* (332) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ + { 409, 0 }, /* (333) subtable_opt ::= */ + { 409, -4 }, /* (334) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + { 328, -3 }, /* (335) cmd ::= KILL CONNECTION NK_INTEGER */ + { 328, -3 }, /* (336) cmd ::= KILL QUERY NK_STRING */ + { 328, -3 }, /* (337) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 328, -2 }, /* (338) cmd ::= BALANCE VGROUP */ + { 328, -4 }, /* (339) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 328, -4 }, /* (340) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 328, -3 }, /* (341) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 411, -2 }, /* (342) dnode_list ::= DNODE NK_INTEGER */ + { 411, -3 }, /* (343) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 328, -4 }, /* (344) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 328, -1 }, /* (345) cmd ::= query_or_subquery */ + { 328, -1 }, /* (346) cmd ::= insert_query */ + { 402, -7 }, /* (347) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ + { 402, -4 }, /* (348) insert_query ::= INSERT INTO full_table_name query_or_subquery */ + { 331, -1 }, /* (349) literal ::= NK_INTEGER */ + { 331, -1 }, /* (350) literal ::= NK_FLOAT */ + { 331, -1 }, /* (351) literal ::= NK_STRING */ + { 331, -1 }, /* (352) literal ::= NK_BOOL */ + { 331, -2 }, /* (353) literal ::= TIMESTAMP NK_STRING */ + { 331, -1 }, /* (354) literal ::= duration_literal */ + { 331, -1 }, /* (355) literal ::= NULL */ + { 331, -1 }, /* (356) literal ::= NK_QUESTION */ + { 379, -1 }, /* (357) duration_literal ::= NK_VARIABLE */ + { 413, -1 }, /* (358) signed ::= NK_INTEGER */ + { 413, -2 }, /* (359) signed ::= NK_PLUS NK_INTEGER */ + { 413, -2 }, /* (360) signed ::= NK_MINUS NK_INTEGER */ + { 413, -1 }, /* (361) signed ::= NK_FLOAT */ + { 413, -2 }, /* (362) signed ::= NK_PLUS NK_FLOAT */ + { 413, -2 }, /* (363) signed ::= NK_MINUS NK_FLOAT */ + { 369, -1 }, /* (364) signed_literal ::= signed */ + { 369, -1 }, /* (365) signed_literal ::= NK_STRING */ + { 369, -1 }, /* (366) signed_literal ::= NK_BOOL */ + { 369, -2 }, /* (367) signed_literal ::= TIMESTAMP NK_STRING */ + { 369, -1 }, /* (368) signed_literal ::= duration_literal */ + { 369, -1 }, /* (369) signed_literal ::= NULL */ + { 369, -1 }, /* (370) signed_literal ::= literal_func */ + { 369, -1 }, /* (371) signed_literal ::= NK_QUESTION */ + { 415, -1 }, /* (372) literal_list ::= signed_literal */ + { 415, -3 }, /* (373) literal_list ::= literal_list NK_COMMA signed_literal */ + { 340, -1 }, /* (374) db_name ::= NK_ID */ + { 341, -1 }, /* (375) table_name ::= NK_ID */ + { 367, -1 }, /* (376) column_name ::= NK_ID */ + { 381, -1 }, /* (377) function_name ::= NK_ID */ + { 416, -1 }, /* (378) table_alias ::= NK_ID */ + { 389, -1 }, /* (379) column_alias ::= NK_ID */ + { 333, -1 }, /* (380) user_name ::= NK_ID */ + { 342, -1 }, /* (381) topic_name ::= NK_ID */ + { 405, -1 }, /* (382) stream_name ::= NK_ID */ + { 399, -1 }, /* (383) cgroup_name ::= NK_ID */ + { 392, -1 }, /* (384) index_name ::= NK_ID */ + { 417, -1 }, /* (385) expr_or_subquery ::= expression */ + { 410, -1 }, /* (386) expression ::= literal */ + { 410, -1 }, /* (387) expression ::= pseudo_column */ + { 410, -1 }, /* (388) expression ::= column_reference */ + { 410, -1 }, /* (389) expression ::= function_expression */ + { 410, -1 }, /* (390) expression ::= case_when_expression */ + { 410, -3 }, /* (391) expression ::= NK_LP expression NK_RP */ + { 410, -2 }, /* (392) expression ::= NK_PLUS expr_or_subquery */ + { 410, -2 }, /* (393) expression ::= NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (394) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + { 410, -3 }, /* (395) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + { 410, -3 }, /* (396) expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + { 410, -3 }, /* (397) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + { 410, -3 }, /* (398) expression ::= expr_or_subquery NK_REM expr_or_subquery */ + { 410, -3 }, /* (399) expression ::= column_reference NK_ARROW NK_STRING */ + { 410, -3 }, /* (400) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + { 410, -3 }, /* (401) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + { 372, -1 }, /* (402) expression_list ::= expr_or_subquery */ + { 372, -3 }, /* (403) expression_list ::= expression_list NK_COMMA expr_or_subquery */ + { 419, -1 }, /* (404) column_reference ::= column_name */ + { 419, -3 }, /* (405) column_reference ::= table_name NK_DOT column_name */ + { 418, -1 }, /* (406) pseudo_column ::= ROWTS */ + { 418, -1 }, /* (407) pseudo_column ::= TBNAME */ + { 418, -3 }, /* (408) pseudo_column ::= table_name NK_DOT TBNAME */ + { 418, -1 }, /* (409) pseudo_column ::= QSTART */ + { 418, -1 }, /* (410) pseudo_column ::= QEND */ + { 418, -1 }, /* (411) pseudo_column ::= QDURATION */ + { 418, -1 }, /* (412) pseudo_column ::= WSTART */ + { 418, -1 }, /* (413) pseudo_column ::= WEND */ + { 418, -1 }, /* (414) pseudo_column ::= WDURATION */ + { 418, -1 }, /* (415) pseudo_column ::= IROWTS */ + { 418, -1 }, /* (416) pseudo_column ::= ISFILLED */ + { 418, -1 }, /* (417) pseudo_column ::= QTAGS */ + { 420, -4 }, /* (418) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 420, -4 }, /* (419) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 420, -6 }, /* (420) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ + { 420, -1 }, /* (421) function_expression ::= literal_func */ + { 414, -3 }, /* (422) literal_func ::= noarg_func NK_LP NK_RP */ + { 414, -1 }, /* (423) literal_func ::= NOW */ + { 424, -1 }, /* (424) noarg_func ::= NOW */ + { 424, -1 }, /* (425) noarg_func ::= TODAY */ + { 424, -1 }, /* (426) noarg_func ::= TIMEZONE */ + { 424, -1 }, /* (427) noarg_func ::= DATABASE */ + { 424, -1 }, /* (428) noarg_func ::= CLIENT_VERSION */ + { 424, -1 }, /* (429) noarg_func ::= SERVER_VERSION */ + { 424, -1 }, /* (430) noarg_func ::= SERVER_STATUS */ + { 424, -1 }, /* (431) noarg_func ::= CURRENT_USER */ + { 424, -1 }, /* (432) noarg_func ::= USER */ + { 422, -1 }, /* (433) star_func ::= COUNT */ + { 422, -1 }, /* (434) star_func ::= FIRST */ + { 422, -1 }, /* (435) star_func ::= LAST */ + { 422, -1 }, /* (436) star_func ::= LAST_ROW */ + { 423, -1 }, /* (437) star_func_para_list ::= NK_STAR */ + { 423, -1 }, /* (438) star_func_para_list ::= other_para_list */ + { 425, -1 }, /* (439) other_para_list ::= star_func_para */ + { 425, -3 }, /* (440) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 426, -1 }, /* (441) star_func_para ::= expr_or_subquery */ + { 426, -3 }, /* (442) star_func_para ::= table_name NK_DOT NK_STAR */ + { 421, -4 }, /* (443) case_when_expression ::= CASE when_then_list case_when_else_opt END */ + { 421, -5 }, /* (444) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ + { 427, -1 }, /* (445) when_then_list ::= when_then_expr */ + { 427, -2 }, /* (446) when_then_list ::= when_then_list when_then_expr */ + { 430, -4 }, /* (447) when_then_expr ::= WHEN common_expression THEN common_expression */ + { 428, 0 }, /* (448) case_when_else_opt ::= */ + { 428, -2 }, /* (449) case_when_else_opt ::= ELSE common_expression */ + { 431, -3 }, /* (450) predicate ::= expr_or_subquery compare_op expr_or_subquery */ + { 431, -5 }, /* (451) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -6 }, /* (452) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + { 431, -3 }, /* (453) predicate ::= expr_or_subquery IS NULL */ + { 431, -4 }, /* (454) predicate ::= expr_or_subquery IS NOT NULL */ + { 431, -3 }, /* (455) predicate ::= expr_or_subquery in_op in_predicate_value */ + { 432, -1 }, /* (456) compare_op ::= NK_LT */ + { 432, -1 }, /* (457) compare_op ::= NK_GT */ + { 432, -1 }, /* (458) compare_op ::= NK_LE */ + { 432, -1 }, /* (459) compare_op ::= NK_GE */ + { 432, -1 }, /* (460) compare_op ::= NK_NE */ + { 432, -1 }, /* (461) compare_op ::= NK_EQ */ + { 432, -1 }, /* (462) compare_op ::= LIKE */ + { 432, -2 }, /* (463) compare_op ::= NOT LIKE */ + { 432, -1 }, /* (464) compare_op ::= MATCH */ + { 432, -1 }, /* (465) compare_op ::= NMATCH */ + { 432, -1 }, /* (466) compare_op ::= CONTAINS */ + { 433, -1 }, /* (467) in_op ::= IN */ + { 433, -2 }, /* (468) in_op ::= NOT IN */ + { 434, -3 }, /* (469) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 435, -1 }, /* (470) boolean_value_expression ::= boolean_primary */ + { 435, -2 }, /* (471) boolean_value_expression ::= NOT boolean_primary */ + { 435, -3 }, /* (472) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 435, -3 }, /* (473) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 436, -1 }, /* (474) boolean_primary ::= predicate */ + { 436, -3 }, /* (475) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 429, -1 }, /* (476) common_expression ::= expr_or_subquery */ + { 429, -1 }, /* (477) common_expression ::= boolean_value_expression */ + { 437, 0 }, /* (478) from_clause_opt ::= */ + { 437, -2 }, /* (479) from_clause_opt ::= FROM table_reference_list */ + { 438, -1 }, /* (480) table_reference_list ::= table_reference */ + { 438, -3 }, /* (481) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 439, -1 }, /* (482) table_reference ::= table_primary */ + { 439, -1 }, /* (483) table_reference ::= joined_table */ + { 440, -2 }, /* (484) table_primary ::= table_name alias_opt */ + { 440, -4 }, /* (485) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 440, -2 }, /* (486) table_primary ::= subquery alias_opt */ + { 440, -1 }, /* (487) table_primary ::= parenthesized_joined_table */ + { 442, 0 }, /* (488) alias_opt ::= */ + { 442, -1 }, /* (489) alias_opt ::= table_alias */ + { 442, -2 }, /* (490) alias_opt ::= AS table_alias */ + { 444, -3 }, /* (491) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 444, -3 }, /* (492) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 441, -6 }, /* (493) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 445, 0 }, /* (494) join_type ::= */ + { 445, -1 }, /* (495) join_type ::= INNER */ + { 446, -12 }, /* (496) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 447, 0 }, /* (497) set_quantifier_opt ::= */ + { 447, -1 }, /* (498) set_quantifier_opt ::= DISTINCT */ + { 447, -1 }, /* (499) set_quantifier_opt ::= ALL */ + { 448, -1 }, /* (500) select_list ::= select_item */ + { 448, -3 }, /* (501) select_list ::= select_list NK_COMMA select_item */ + { 456, -1 }, /* (502) select_item ::= NK_STAR */ + { 456, -1 }, /* (503) select_item ::= common_expression */ + { 456, -2 }, /* (504) select_item ::= common_expression column_alias */ + { 456, -3 }, /* (505) select_item ::= common_expression AS column_alias */ + { 456, -3 }, /* (506) select_item ::= table_name NK_DOT NK_STAR */ + { 412, 0 }, /* (507) where_clause_opt ::= */ + { 412, -2 }, /* (508) where_clause_opt ::= WHERE search_condition */ + { 449, 0 }, /* (509) partition_by_clause_opt ::= */ + { 449, -3 }, /* (510) partition_by_clause_opt ::= PARTITION BY partition_list */ + { 457, -1 }, /* (511) partition_list ::= partition_item */ + { 457, -3 }, /* (512) partition_list ::= partition_list NK_COMMA partition_item */ + { 458, -1 }, /* (513) partition_item ::= expr_or_subquery */ + { 458, -2 }, /* (514) partition_item ::= expr_or_subquery column_alias */ + { 458, -3 }, /* (515) partition_item ::= expr_or_subquery AS column_alias */ + { 453, 0 }, /* (516) twindow_clause_opt ::= */ + { 453, -6 }, /* (517) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 453, -4 }, /* (518) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ + { 453, -6 }, /* (519) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 453, -8 }, /* (520) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 453, -7 }, /* (521) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ + { 394, 0 }, /* (522) sliding_opt ::= */ + { 394, -4 }, /* (523) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 452, 0 }, /* (524) fill_opt ::= */ + { 452, -4 }, /* (525) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 452, -6 }, /* (526) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 452, -6 }, /* (527) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ + { 459, -1 }, /* (528) fill_mode ::= NONE */ + { 459, -1 }, /* (529) fill_mode ::= PREV */ + { 459, -1 }, /* (530) fill_mode ::= NULL */ + { 459, -1 }, /* (531) fill_mode ::= NULL_F */ + { 459, -1 }, /* (532) fill_mode ::= LINEAR */ + { 459, -1 }, /* (533) fill_mode ::= NEXT */ + { 454, 0 }, /* (534) group_by_clause_opt ::= */ + { 454, -3 }, /* (535) group_by_clause_opt ::= GROUP BY group_by_list */ + { 460, -1 }, /* (536) group_by_list ::= expr_or_subquery */ + { 460, -3 }, /* (537) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ + { 455, 0 }, /* (538) having_clause_opt ::= */ + { 455, -2 }, /* (539) having_clause_opt ::= HAVING search_condition */ + { 450, 0 }, /* (540) range_opt ::= */ + { 450, -6 }, /* (541) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ + { 451, 0 }, /* (542) every_opt ::= */ + { 451, -4 }, /* (543) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 461, -4 }, /* (544) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 462, -1 }, /* (545) query_simple ::= query_specification */ + { 462, -1 }, /* (546) query_simple ::= union_query_expression */ + { 466, -4 }, /* (547) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ + { 466, -3 }, /* (548) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ + { 467, -1 }, /* (549) query_simple_or_subquery ::= query_simple */ + { 467, -1 }, /* (550) query_simple_or_subquery ::= subquery */ + { 398, -1 }, /* (551) query_or_subquery ::= query_expression */ + { 398, -1 }, /* (552) query_or_subquery ::= subquery */ + { 463, 0 }, /* (553) order_by_clause_opt ::= */ + { 463, -3 }, /* (554) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 464, 0 }, /* (555) slimit_clause_opt ::= */ + { 464, -2 }, /* (556) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 464, -4 }, /* (557) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 464, -4 }, /* (558) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 465, 0 }, /* (559) limit_clause_opt ::= */ + { 465, -2 }, /* (560) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 465, -4 }, /* (561) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 465, -4 }, /* (562) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 443, -3 }, /* (563) subquery ::= NK_LP query_expression NK_RP */ + { 443, -3 }, /* (564) subquery ::= NK_LP subquery NK_RP */ + { 343, -1 }, /* (565) search_condition ::= common_expression */ + { 468, -1 }, /* (566) sort_specification_list ::= sort_specification */ + { 468, -3 }, /* (567) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 469, -3 }, /* (568) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ + { 470, 0 }, /* (569) ordering_specification_opt ::= */ + { 470, -1 }, /* (570) ordering_specification_opt ::= ASC */ + { 470, -1 }, /* (571) ordering_specification_opt ::= DESC */ + { 471, 0 }, /* (572) null_ordering_opt ::= */ + { 471, -2 }, /* (573) null_ordering_opt ::= NULLS FIRST */ + { 471, -2 }, /* (574) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3760,1561 +3796,1570 @@ static YYACTIONTYPE yy_reduce( yy_destructor(yypParser,331,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy0, yymsp[0].minor.yy857); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy97, &yymsp[-1].minor.yy0, yymsp[0].minor.yy519); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy97, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy97, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy881, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy97, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy881); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy97); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy857 = 1; } +{ yymsp[1].minor.yy519 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy857 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy519 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + case 31: /* cmd ::= GRANT privileges ON priv_level with_opt TO user_name */ +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy93, &yymsp[-3].minor.yy569, &yymsp[0].minor.yy97, yymsp[-2].minor.yy792); } break; - case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy303, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + case 32: /* cmd ::= REVOKE privileges ON priv_level with_opt FROM user_name */ +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy93, &yymsp[-3].minor.yy569, &yymsp[0].minor.yy97, yymsp[-2].minor.yy792); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy93 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 36: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==36); -{ yylhsminor.yy303 = yymsp[0].minor.yy303; } - yymsp[0].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy93 = yymsp[0].minor.yy93; } + yymsp[0].minor.yy93 = yylhsminor.yy93; break; case 35: /* privileges ::= SUBSCRIBE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_SUBSCRIBE; } +{ yymsp[0].minor.yy93 = PRIVILEGE_TYPE_SUBSCRIBE; } break; case 37: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy303 = yymsp[-2].minor.yy303 | yymsp[0].minor.yy303; } - yymsp[-2].minor.yy303 = yylhsminor.yy303; +{ yylhsminor.yy93 = yymsp[-2].minor.yy93 | yymsp[0].minor.yy93; } + yymsp[-2].minor.yy93 = yylhsminor.yy93; break; case 38: /* priv_type ::= READ */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy93 = PRIVILEGE_TYPE_READ; } break; case 39: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy303 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy93 = PRIVILEGE_TYPE_WRITE; } break; case 40: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy569.first = yymsp[-2].minor.yy0; yylhsminor.yy569.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy569 = yylhsminor.yy569; break; case 41: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy881 = yymsp[-2].minor.yy881; } - yymsp[-2].minor.yy881 = yylhsminor.yy881; +{ yylhsminor.yy569.first = yymsp[-2].minor.yy97; yylhsminor.yy569.second = yymsp[0].minor.yy0; } + yymsp[-2].minor.yy569 = yylhsminor.yy569; break; - case 42: /* priv_level ::= topic_name */ - case 282: /* sma_func_name ::= function_name */ yytestcase(yyruleno==282); - case 486: /* alias_opt ::= table_alias */ yytestcase(yyruleno==486); -{ yylhsminor.yy881 = yymsp[0].minor.yy881; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 42: /* priv_level ::= db_name NK_DOT table_name */ +{ yylhsminor.yy569.first = yymsp[-2].minor.yy97; yylhsminor.yy569.second = yymsp[0].minor.yy97; } + yymsp[-2].minor.yy569 = yylhsminor.yy569; break; - case 43: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy881, NULL); } + case 43: /* priv_level ::= topic_name */ +{ yylhsminor.yy569.first = yymsp[0].minor.yy97; yylhsminor.yy569.second = nil_token; } + yymsp[0].minor.yy569 = yylhsminor.yy569; break; - case 44: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } + case 44: /* with_opt ::= */ + case 133: /* start_opt ::= */ yytestcase(yyruleno==133); + case 137: /* end_opt ::= */ yytestcase(yyruleno==137); + case 262: /* like_pattern_opt ::= */ yytestcase(yyruleno==262); + case 333: /* subtable_opt ::= */ yytestcase(yyruleno==333); + case 448: /* case_when_else_opt ::= */ yytestcase(yyruleno==448); + case 478: /* from_clause_opt ::= */ yytestcase(yyruleno==478); + case 507: /* where_clause_opt ::= */ yytestcase(yyruleno==507); + case 516: /* twindow_clause_opt ::= */ yytestcase(yyruleno==516); + case 522: /* sliding_opt ::= */ yytestcase(yyruleno==522); + case 524: /* fill_opt ::= */ yytestcase(yyruleno==524); + case 538: /* having_clause_opt ::= */ yytestcase(yyruleno==538); + case 540: /* range_opt ::= */ yytestcase(yyruleno==540); + case 542: /* every_opt ::= */ yytestcase(yyruleno==542); + case 555: /* slimit_clause_opt ::= */ yytestcase(yyruleno==555); + case 559: /* limit_clause_opt ::= */ yytestcase(yyruleno==559); +{ yymsp[1].minor.yy792 = NULL; } break; - case 45: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy587); } + case 45: /* with_opt ::= WITH search_condition */ + case 479: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==479); + case 508: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==508); + case 539: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==539); +{ yymsp[-1].minor.yy792 = yymsp[0].minor.yy792; } break; - case 46: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy587); } + case 46: /* cmd ::= CREATE DNODE dnode_endpoint */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy97, NULL); } break; - case 47: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + case 47: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy0); } + break; + case 48: /* cmd ::= DROP DNODE NK_INTEGER force_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy89); } + break; + case 49: /* cmd ::= DROP DNODE dnode_endpoint force_opt */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy97, yymsp[0].minor.yy89); } + break; + case 50: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } break; - case 48: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + case 51: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 49: /* cmd ::= ALTER ALL DNODES NK_STRING */ + case 52: /* cmd ::= ALTER ALL DNODES NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); } break; - case 50: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + case 53: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 51: /* dnode_endpoint ::= NK_STRING */ - case 52: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==52); - case 53: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==53); - case 283: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==283); - case 284: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==284); - case 285: /* sma_func_name ::= LAST */ yytestcase(yyruleno==285); - case 286: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==286); - case 371: /* db_name ::= NK_ID */ yytestcase(yyruleno==371); - case 372: /* table_name ::= NK_ID */ yytestcase(yyruleno==372); - case 373: /* column_name ::= NK_ID */ yytestcase(yyruleno==373); - case 374: /* function_name ::= NK_ID */ yytestcase(yyruleno==374); - case 375: /* table_alias ::= NK_ID */ yytestcase(yyruleno==375); - case 376: /* column_alias ::= NK_ID */ yytestcase(yyruleno==376); - case 377: /* user_name ::= NK_ID */ yytestcase(yyruleno==377); - case 378: /* topic_name ::= NK_ID */ yytestcase(yyruleno==378); - case 379: /* stream_name ::= NK_ID */ yytestcase(yyruleno==379); - case 380: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==380); - case 381: /* index_name ::= NK_ID */ yytestcase(yyruleno==381); - case 421: /* noarg_func ::= NOW */ yytestcase(yyruleno==421); - case 422: /* noarg_func ::= TODAY */ yytestcase(yyruleno==422); - case 423: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==423); - case 424: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==424); - case 425: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==425); - case 426: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==426); - case 427: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==427); - case 428: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==428); - case 429: /* noarg_func ::= USER */ yytestcase(yyruleno==429); - case 430: /* star_func ::= COUNT */ yytestcase(yyruleno==430); - case 431: /* star_func ::= FIRST */ yytestcase(yyruleno==431); - case 432: /* star_func ::= LAST */ yytestcase(yyruleno==432); - case 433: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==433); -{ yylhsminor.yy881 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy881 = yylhsminor.yy881; + case 54: /* dnode_endpoint ::= NK_STRING */ + case 55: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==55); + case 56: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==56); + case 286: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==286); + case 287: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==287); + case 288: /* sma_func_name ::= LAST */ yytestcase(yyruleno==288); + case 289: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==289); + case 374: /* db_name ::= NK_ID */ yytestcase(yyruleno==374); + case 375: /* table_name ::= NK_ID */ yytestcase(yyruleno==375); + case 376: /* column_name ::= NK_ID */ yytestcase(yyruleno==376); + case 377: /* function_name ::= NK_ID */ yytestcase(yyruleno==377); + case 378: /* table_alias ::= NK_ID */ yytestcase(yyruleno==378); + case 379: /* column_alias ::= NK_ID */ yytestcase(yyruleno==379); + case 380: /* user_name ::= NK_ID */ yytestcase(yyruleno==380); + case 381: /* topic_name ::= NK_ID */ yytestcase(yyruleno==381); + case 382: /* stream_name ::= NK_ID */ yytestcase(yyruleno==382); + case 383: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==383); + case 384: /* index_name ::= NK_ID */ yytestcase(yyruleno==384); + case 424: /* noarg_func ::= NOW */ yytestcase(yyruleno==424); + case 425: /* noarg_func ::= TODAY */ yytestcase(yyruleno==425); + case 426: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==426); + case 427: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==427); + case 428: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==428); + case 429: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==429); + case 430: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==430); + case 431: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==431); + case 432: /* noarg_func ::= USER */ yytestcase(yyruleno==432); + case 433: /* star_func ::= COUNT */ yytestcase(yyruleno==433); + case 434: /* star_func ::= FIRST */ yytestcase(yyruleno==434); + case 435: /* star_func ::= LAST */ yytestcase(yyruleno==435); + case 436: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==436); +{ yylhsminor.yy97 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy97 = yylhsminor.yy97; break; - case 54: /* force_opt ::= */ - case 74: /* not_exists_opt ::= */ yytestcase(yyruleno==74); - case 76: /* exists_opt ::= */ yytestcase(yyruleno==76); - case 303: /* analyze_opt ::= */ yytestcase(yyruleno==303); - case 310: /* agg_func_opt ::= */ yytestcase(yyruleno==310); - case 494: /* set_quantifier_opt ::= */ yytestcase(yyruleno==494); -{ yymsp[1].minor.yy587 = false; } + case 57: /* force_opt ::= */ + case 77: /* not_exists_opt ::= */ yytestcase(yyruleno==77); + case 79: /* exists_opt ::= */ yytestcase(yyruleno==79); + case 306: /* analyze_opt ::= */ yytestcase(yyruleno==306); + case 313: /* agg_func_opt ::= */ yytestcase(yyruleno==313); + case 497: /* set_quantifier_opt ::= */ yytestcase(yyruleno==497); +{ yymsp[1].minor.yy89 = false; } break; - case 55: /* force_opt ::= FORCE */ - case 304: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==304); - case 311: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==311); - case 495: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==495); -{ yymsp[0].minor.yy587 = true; } + case 58: /* force_opt ::= FORCE */ + case 307: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==307); + case 314: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==314); + case 498: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==498); +{ yymsp[0].minor.yy89 = true; } break; - case 56: /* cmd ::= ALTER LOCAL NK_STRING */ + case 59: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 57: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + case 60: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 58: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + case 61: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); } break; - case 59: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + case 62: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); } break; - case 60: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + case 63: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); } break; - case 61: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + case 64: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); } break; - case 62: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + case 65: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); } break; - case 63: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + case 66: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); } break; - case 64: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + case 67: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); } break; - case 65: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + case 68: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */ { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; - case 66: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy587, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } + case 69: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy89, &yymsp[-1].minor.yy97, yymsp[0].minor.yy792); } break; - case 67: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 70: /* cmd ::= DROP DATABASE exists_opt db_name */ +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy97); } break; - case 68: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } + case 71: /* cmd ::= USE db_name */ +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy97); } break; - case 69: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy140); } + case 72: /* cmd ::= ALTER DATABASE db_name alter_db_options */ +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy97, yymsp[0].minor.yy792); } break; - case 70: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } + case 73: /* cmd ::= FLUSH DATABASE db_name */ +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy97); } break; - case 71: /* cmd ::= TRIM DATABASE db_name speed_opt */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy214); } + case 74: /* cmd ::= TRIM DATABASE db_name speed_opt */ +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy97, yymsp[0].minor.yy20); } break; - case 72: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ -{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy881, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 75: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */ +{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy97, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 73: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy587 = true; } + case 76: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy89 = true; } break; - case 75: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy587 = true; } + case 78: /* exists_opt ::= IF EXISTS */ +{ yymsp[-1].minor.yy89 = true; } break; - case 77: /* db_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultDatabaseOptions(pCxt); } + case 80: /* db_options ::= */ +{ yymsp[1].minor.yy792 = createDefaultDatabaseOptions(pCxt); } break; - case 78: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 81: /* db_options ::= db_options BUFFER NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 79: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 82: /* db_options ::= db_options CACHEMODEL NK_STRING */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 80: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 83: /* db_options ::= db_options CACHESIZE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 81: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 84: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 82: /* db_options ::= db_options DURATION NK_INTEGER */ - case 83: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==83); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 85: /* db_options ::= db_options DURATION NK_INTEGER */ + case 86: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==86); +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 84: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 87: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 85: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 88: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 86: /* db_options ::= db_options KEEP integer_list */ - case 87: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==87); -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_KEEP, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 89: /* db_options ::= db_options KEEP integer_list */ + case 90: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==90); +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_KEEP, yymsp[0].minor.yy520); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 88: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 91: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 89: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 92: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 90: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 93: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 91: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 94: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 92: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 95: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 93: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 96: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 94: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 97: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 95: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_RETENTIONS, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 98: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_RETENTIONS, yymsp[0].minor.yy520); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 96: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 99: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 97: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 100: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 98: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 101: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 99: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 102: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 100: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + case 103: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-3].minor.yy792, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 101: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 104: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 102: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + case 105: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-3].minor.yy140, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-3].minor.yy792, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 103: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 104: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 105: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 106: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 107: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ -{ yylhsminor.yy140 = setDatabaseOption(pCxt, yymsp[-2].minor.yy140, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 108: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy140 = createAlterDatabaseOptions(pCxt); yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yylhsminor.yy140, &yymsp[0].minor.yy809); } - yymsp[0].minor.yy140 = yylhsminor.yy140; - break; - case 109: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy140 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy140, &yymsp[0].minor.yy809); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 110: /* alter_db_option ::= BUFFER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 111: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 112: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 113: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 114: /* alter_db_option ::= KEEP integer_list */ - case 115: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==115); -{ yymsp[-1].minor.yy809.type = DB_OPTION_KEEP; yymsp[-1].minor.yy809.pList = yymsp[0].minor.yy220; } - break; - case 116: /* alter_db_option ::= PAGES NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_PAGES; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 117: /* alter_db_option ::= REPLICA NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 118: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_WAL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 119: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 120: /* alter_db_option ::= MINROWS NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } - break; - case 121: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 122: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 340: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==340); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 123: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy220 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 124: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 125: /* retention_list ::= retention */ - case 155: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==155); - case 158: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==158); - case 165: /* column_def_list ::= column_def */ yytestcase(yyruleno==165); - case 209: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==209); - case 214: /* col_name_list ::= col_name */ yytestcase(yyruleno==214); - case 265: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==265); - case 279: /* func_list ::= func */ yytestcase(yyruleno==279); - case 369: /* literal_list ::= signed_literal */ yytestcase(yyruleno==369); - case 436: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==436); - case 442: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==442); - case 497: /* select_list ::= select_item */ yytestcase(yyruleno==497); - case 508: /* partition_list ::= partition_item */ yytestcase(yyruleno==508); - case 563: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==563); -{ yylhsminor.yy220 = createNodeList(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy220 = yylhsminor.yy220; - break; - case 126: /* retention_list ::= retention_list NK_COMMA retention */ - case 159: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==159); - case 166: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==166); - case 210: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==210); - case 215: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==215); - case 266: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==266); - case 280: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==280); - case 370: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==370); - case 437: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==437); - case 498: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==498); - case 509: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==509); - case 564: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==564); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; - break; - case 127: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy140 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; - break; - case 128: /* speed_opt ::= */ - case 312: /* bufsize_opt ::= */ yytestcase(yyruleno==312); -{ yymsp[1].minor.yy214 = 0; } - break; - case 129: /* speed_opt ::= MAX_SPEED NK_INTEGER */ - case 313: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==313); -{ yymsp[-1].minor.yy214 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } - break; - case 130: /* start_opt ::= */ - case 134: /* end_opt ::= */ yytestcase(yyruleno==134); - case 259: /* like_pattern_opt ::= */ yytestcase(yyruleno==259); - case 330: /* subtable_opt ::= */ yytestcase(yyruleno==330); - case 445: /* case_when_else_opt ::= */ yytestcase(yyruleno==445); - case 475: /* from_clause_opt ::= */ yytestcase(yyruleno==475); - case 504: /* where_clause_opt ::= */ yytestcase(yyruleno==504); - case 513: /* twindow_clause_opt ::= */ yytestcase(yyruleno==513); - case 519: /* sliding_opt ::= */ yytestcase(yyruleno==519); - case 521: /* fill_opt ::= */ yytestcase(yyruleno==521); - case 535: /* having_clause_opt ::= */ yytestcase(yyruleno==535); - case 537: /* range_opt ::= */ yytestcase(yyruleno==537); - case 539: /* every_opt ::= */ yytestcase(yyruleno==539); - case 552: /* slimit_clause_opt ::= */ yytestcase(yyruleno==552); - case 556: /* limit_clause_opt ::= */ yytestcase(yyruleno==556); -{ yymsp[1].minor.yy140 = NULL; } - break; - case 131: /* start_opt ::= START WITH NK_INTEGER */ - case 135: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==135); -{ yymsp[-2].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } - break; - case 132: /* start_opt ::= START WITH NK_STRING */ - case 136: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==136); -{ yymsp[-2].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 133: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ - case 137: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==137); -{ yymsp[-3].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } - break; - case 138: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 140: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==140); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy220, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } - break; - case 139: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy220); } - break; - case 141: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy220); } - break; - case 142: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } - break; - case 143: /* cmd ::= ALTER TABLE alter_table_clause */ - case 342: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==342); - case 343: /* cmd ::= insert_query */ yytestcase(yyruleno==343); -{ pCxt->pRootNode = yymsp[0].minor.yy140; } - break; - case 144: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy140); } - break; - case 145: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy140 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; - break; - case 146: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 147: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 148: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 149: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 150: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 151: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy140 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy140, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; - break; - case 152: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy140 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; - break; - case 153: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy140 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy140, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy792 = yylhsminor.yy792; + break; + case 106: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 107: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 108: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 109: /* db_options ::= db_options TABLE_PREFIX NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_TABLE_PREFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 110: /* db_options ::= db_options TABLE_SUFFIX NK_INTEGER */ +{ yylhsminor.yy792 = setDatabaseOption(pCxt, yymsp[-2].minor.yy792, DB_OPTION_TABLE_SUFFIX, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 111: /* alter_db_options ::= alter_db_option */ +{ yylhsminor.yy792 = createAlterDatabaseOptions(pCxt); yylhsminor.yy792 = setAlterDatabaseOption(pCxt, yylhsminor.yy792, &yymsp[0].minor.yy285); } + yymsp[0].minor.yy792 = yylhsminor.yy792; + break; + case 112: /* alter_db_options ::= alter_db_options alter_db_option */ +{ yylhsminor.yy792 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy792, &yymsp[0].minor.yy285); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; + break; + case 113: /* alter_db_option ::= BUFFER NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 114: /* alter_db_option ::= CACHEMODEL NK_STRING */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 115: /* alter_db_option ::= CACHESIZE NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 116: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 117: /* alter_db_option ::= KEEP integer_list */ + case 118: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==118); +{ yymsp[-1].minor.yy285.type = DB_OPTION_KEEP; yymsp[-1].minor.yy285.pList = yymsp[0].minor.yy520; } + break; + case 119: /* alter_db_option ::= PAGES NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_PAGES; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 120: /* alter_db_option ::= REPLICA NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 121: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_WAL; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 122: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 123: /* alter_db_option ::= MINROWS NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } + break; + case 124: /* integer_list ::= NK_INTEGER */ +{ yylhsminor.yy520 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy520 = yylhsminor.yy520; + break; + case 125: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ + case 343: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==343); +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-2].minor.yy520, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy520 = yylhsminor.yy520; + break; + case 126: /* variable_list ::= NK_VARIABLE */ +{ yylhsminor.yy520 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy520 = yylhsminor.yy520; + break; + case 127: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-2].minor.yy520, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy520 = yylhsminor.yy520; + break; + case 128: /* retention_list ::= retention */ + case 158: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==158); + case 161: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==161); + case 168: /* column_def_list ::= column_def */ yytestcase(yyruleno==168); + case 212: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==212); + case 217: /* col_name_list ::= col_name */ yytestcase(yyruleno==217); + case 268: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==268); + case 282: /* func_list ::= func */ yytestcase(yyruleno==282); + case 372: /* literal_list ::= signed_literal */ yytestcase(yyruleno==372); + case 439: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==439); + case 445: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==445); + case 500: /* select_list ::= select_item */ yytestcase(yyruleno==500); + case 511: /* partition_list ::= partition_item */ yytestcase(yyruleno==511); + case 566: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==566); +{ yylhsminor.yy520 = createNodeList(pCxt, yymsp[0].minor.yy792); } + yymsp[0].minor.yy520 = yylhsminor.yy520; + break; + case 129: /* retention_list ::= retention_list NK_COMMA retention */ + case 162: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==162); + case 169: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==169); + case 213: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==213); + case 218: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==218); + case 269: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==269); + case 283: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==283); + case 373: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==373); + case 440: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==440); + case 501: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==501); + case 512: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==512); + case 567: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==567); +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-2].minor.yy520, yymsp[0].minor.yy792); } + yymsp[-2].minor.yy520 = yylhsminor.yy520; + break; + case 130: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ +{ yylhsminor.yy792 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; + break; + case 131: /* speed_opt ::= */ + case 315: /* bufsize_opt ::= */ yytestcase(yyruleno==315); +{ yymsp[1].minor.yy20 = 0; } + break; + case 132: /* speed_opt ::= MAX_SPEED NK_INTEGER */ + case 316: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==316); +{ yymsp[-1].minor.yy20 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + break; + case 134: /* start_opt ::= START WITH NK_INTEGER */ + case 138: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==138); +{ yymsp[-2].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); } + break; + case 135: /* start_opt ::= START WITH NK_STRING */ + case 139: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==139); +{ yymsp[-2].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 136: /* start_opt ::= START WITH TIMESTAMP NK_STRING */ + case 140: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==140); +{ yymsp[-3].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + break; + case 141: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 143: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==143); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy89, yymsp[-5].minor.yy792, yymsp[-3].minor.yy520, yymsp[-1].minor.yy520, yymsp[0].minor.yy792); } + break; + case 142: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy520); } + break; + case 144: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy520); } + break; + case 145: /* cmd ::= DROP STABLE exists_opt full_table_name */ +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy792); } + break; + case 146: /* cmd ::= ALTER TABLE alter_table_clause */ + case 345: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==345); + case 346: /* cmd ::= insert_query */ yytestcase(yyruleno==346); +{ pCxt->pRootNode = yymsp[0].minor.yy792; } + break; + case 147: /* cmd ::= ALTER STABLE alter_table_clause */ +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy792); } + break; + case 148: /* alter_table_clause ::= full_table_name alter_table_options */ +{ yylhsminor.yy792 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; + break; + case 149: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ +{ yylhsminor.yy792 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy97, yymsp[0].minor.yy848); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; + break; + case 150: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ +{ yylhsminor.yy792 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy792, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy97); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; + break; + case 151: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ +{ yylhsminor.yy792 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy97, yymsp[0].minor.yy848); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; + break; + case 152: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ +{ yylhsminor.yy792 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy97, &yymsp[0].minor.yy97); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; + break; + case 153: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ +{ yylhsminor.yy792 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy97, yymsp[0].minor.yy848); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; + break; + case 154: /* alter_table_clause ::= full_table_name DROP TAG column_name */ +{ yylhsminor.yy792 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy792, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy97); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; + break; + case 155: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ +{ yylhsminor.yy792 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy97, yymsp[0].minor.yy848); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; + break; + case 156: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ +{ yylhsminor.yy792 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy792, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy97, &yymsp[0].minor.yy97); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; break; - case 154: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy140 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy140, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 157: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ +{ yylhsminor.yy792 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy792, &yymsp[-2].minor.yy97, yymsp[0].minor.yy792); } + yymsp[-5].minor.yy792 = yylhsminor.yy792; break; - case 156: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ - case 443: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==443); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-1].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy220 = yylhsminor.yy220; + case 159: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 446: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==446); +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-1].minor.yy520, yymsp[0].minor.yy792); } + yymsp[-1].minor.yy520 = yylhsminor.yy520; break; - case 157: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy140 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy587, yymsp[-8].minor.yy140, yymsp[-6].minor.yy140, yymsp[-5].minor.yy220, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } - yymsp[-9].minor.yy140 = yylhsminor.yy140; + case 160: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ +{ yylhsminor.yy792 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy89, yymsp[-8].minor.yy792, yymsp[-6].minor.yy792, yymsp[-5].minor.yy520, yymsp[-2].minor.yy520, yymsp[0].minor.yy792); } + yymsp[-9].minor.yy792 = yylhsminor.yy792; break; - case 160: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy140 = createDropTableClause(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 163: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy792 = createDropTableClause(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy792); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 161: /* specific_cols_opt ::= */ - case 192: /* tags_def_opt ::= */ yytestcase(yyruleno==192); - case 264: /* tag_list_opt ::= */ yytestcase(yyruleno==264); - case 316: /* col_list_opt ::= */ yytestcase(yyruleno==316); - case 318: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==318); - case 506: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==506); - case 531: /* group_by_clause_opt ::= */ yytestcase(yyruleno==531); - case 550: /* order_by_clause_opt ::= */ yytestcase(yyruleno==550); -{ yymsp[1].minor.yy220 = NULL; } + case 164: /* specific_cols_opt ::= */ + case 195: /* tags_def_opt ::= */ yytestcase(yyruleno==195); + case 267: /* tag_list_opt ::= */ yytestcase(yyruleno==267); + case 319: /* col_list_opt ::= */ yytestcase(yyruleno==319); + case 321: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==321); + case 509: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==509); + case 534: /* group_by_clause_opt ::= */ yytestcase(yyruleno==534); + case 553: /* order_by_clause_opt ::= */ yytestcase(yyruleno==553); +{ yymsp[1].minor.yy520 = NULL; } break; - case 162: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ - case 317: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==317); -{ yymsp[-2].minor.yy220 = yymsp[-1].minor.yy220; } + case 165: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ + case 320: /* col_list_opt ::= NK_LP col_name_list NK_RP */ yytestcase(yyruleno==320); +{ yymsp[-2].minor.yy520 = yymsp[-1].minor.yy520; } break; - case 163: /* full_table_name ::= table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 166: /* full_table_name ::= table_name */ +{ yylhsminor.yy792 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy97, NULL); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 164: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 167: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy792 = createRealTableNode(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy97, NULL); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 167: /* column_def ::= column_name type_name */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy881, yymsp[0].minor.yy682, NULL); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 170: /* column_def ::= column_name type_name */ +{ yylhsminor.yy792 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy97, yymsp[0].minor.yy848, NULL); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 168: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy140 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-2].minor.yy682, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 171: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy792 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy97, yymsp[-2].minor.yy848, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 169: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 172: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 170: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 173: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 171: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 174: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 172: /* type_name ::= INT */ - case 173: /* type_name ::= INTEGER */ yytestcase(yyruleno==173); -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_INT); } + case 175: /* type_name ::= INT */ + case 176: /* type_name ::= INTEGER */ yytestcase(yyruleno==176); +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 174: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 177: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 175: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 178: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 176: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 179: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 177: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 180: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy848 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 178: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 181: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; - case 179: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 182: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy848 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; - case 180: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 183: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy848 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; - case 181: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 184: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy848 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; - case 182: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UINT); } + case 185: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy848 = createDataType(TSDB_DATA_TYPE_UINT); } break; - case 183: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy682 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 186: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy848 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; - case 184: /* type_name ::= JSON */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_JSON); } + case 187: /* type_name ::= JSON */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_JSON); } break; - case 185: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 188: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy848 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; - case 186: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 189: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; - case 187: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 190: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_BLOB); } break; - case 188: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 191: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy848 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; - case 189: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 192: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy848 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 190: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 193: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy848 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 191: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy682 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 194: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy848 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 193: /* tags_def_opt ::= tags_def */ - case 319: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==319); - case 435: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==435); -{ yylhsminor.yy220 = yymsp[0].minor.yy220; } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 196: /* tags_def_opt ::= tags_def */ + case 322: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==322); + case 438: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==438); +{ yylhsminor.yy520 = yymsp[0].minor.yy520; } + yymsp[0].minor.yy520 = yylhsminor.yy520; break; - case 194: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ - case 320: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==320); -{ yymsp[-3].minor.yy220 = yymsp[-1].minor.yy220; } + case 197: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ + case 323: /* tag_def_or_ref_opt ::= TAGS NK_LP col_name_list NK_RP */ yytestcase(yyruleno==323); +{ yymsp[-3].minor.yy520 = yymsp[-1].minor.yy520; } break; - case 195: /* table_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultTableOptions(pCxt); } + case 198: /* table_options ::= */ +{ yymsp[1].minor.yy792 = createDefaultTableOptions(pCxt); } break; - case 196: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 199: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-2].minor.yy792, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 197: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 200: /* table_options ::= table_options MAX_DELAY duration_list */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-2].minor.yy792, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy520); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 198: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 201: /* table_options ::= table_options WATERMARK duration_list */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-2].minor.yy792, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy520); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 199: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 202: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-4].minor.yy792, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy520); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; break; - case 200: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 203: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-2].minor.yy792, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 201: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-4].minor.yy140, TABLE_OPTION_SMA, yymsp[-1].minor.yy220); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 204: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-4].minor.yy792, TABLE_OPTION_SMA, yymsp[-1].minor.yy520); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; break; - case 202: /* table_options ::= table_options DELETE_MARK duration_list */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-2].minor.yy140, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy220); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 205: /* table_options ::= table_options DELETE_MARK duration_list */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-2].minor.yy792, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy520); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 203: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy140 = createAlterTableOptions(pCxt); yylhsminor.yy140 = setTableOption(pCxt, yylhsminor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 206: /* alter_table_options ::= alter_table_option */ +{ yylhsminor.yy792 = createAlterTableOptions(pCxt); yylhsminor.yy792 = setTableOption(pCxt, yylhsminor.yy792, yymsp[0].minor.yy285.type, &yymsp[0].minor.yy285.val); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 204: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy140 = setTableOption(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy809.type, &yymsp[0].minor.yy809.val); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 207: /* alter_table_options ::= alter_table_options alter_table_option */ +{ yylhsminor.yy792 = setTableOption(pCxt, yymsp[-1].minor.yy792, yymsp[0].minor.yy285.type, &yymsp[0].minor.yy285.val); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 205: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } + case 208: /* alter_table_option ::= COMMENT NK_STRING */ +{ yymsp[-1].minor.yy285.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } break; - case 206: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy809.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy809.val = yymsp[0].minor.yy0; } + case 209: /* alter_table_option ::= TTL NK_INTEGER */ +{ yymsp[-1].minor.yy285.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy285.val = yymsp[0].minor.yy0; } break; - case 207: /* duration_list ::= duration_literal */ - case 399: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==399); -{ yylhsminor.yy220 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 210: /* duration_list ::= duration_literal */ + case 402: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==402); +{ yylhsminor.yy520 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } + yymsp[0].minor.yy520 = yylhsminor.yy520; break; - case 208: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 400: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==400); -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 211: /* duration_list ::= duration_list NK_COMMA duration_literal */ + case 403: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==403); +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-2].minor.yy520, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } + yymsp[-2].minor.yy520 = yylhsminor.yy520; break; - case 211: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy881, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 214: /* rollup_func_name ::= function_name */ +{ yylhsminor.yy792 = createFunctionNode(pCxt, &yymsp[0].minor.yy97, NULL); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 212: /* rollup_func_name ::= FIRST */ - case 213: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==213); - case 268: /* tag_item ::= QTAGS */ yytestcase(yyruleno==268); -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 215: /* rollup_func_name ::= FIRST */ + case 216: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==216); + case 271: /* tag_item ::= QTAGS */ yytestcase(yyruleno==271); +{ yylhsminor.yy792 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 216: /* col_name ::= column_name */ - case 269: /* tag_item ::= column_name */ yytestcase(yyruleno==269); -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 219: /* col_name ::= column_name */ + case 272: /* tag_item ::= column_name */ yytestcase(yyruleno==272); +{ yylhsminor.yy792 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy97); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 217: /* cmd ::= SHOW DNODES */ + case 220: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 218: /* cmd ::= SHOW USERS */ + case 221: /* cmd ::= SHOW USERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 219: /* cmd ::= SHOW USER PRIVILEGES */ + case 222: /* cmd ::= SHOW USER PRIVILEGES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); } break; - case 220: /* cmd ::= SHOW DATABASES */ + case 223: /* cmd ::= SHOW DATABASES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 221: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 224: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy792, yymsp[0].minor.yy792, OP_TYPE_LIKE); } break; - case 222: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, OP_TYPE_LIKE); } + case 225: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy792, yymsp[0].minor.yy792, OP_TYPE_LIKE); } break; - case 223: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy140, NULL, OP_TYPE_LIKE); } + case 226: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy792, NULL, OP_TYPE_LIKE); } break; - case 224: /* cmd ::= SHOW MNODES */ + case 227: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } break; - case 225: /* cmd ::= SHOW QNODES */ + case 228: /* cmd ::= SHOW QNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); } break; - case 226: /* cmd ::= SHOW FUNCTIONS */ + case 229: /* cmd ::= SHOW FUNCTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; - case 227: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 230: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy792, yymsp[-1].minor.yy792, OP_TYPE_EQUAL); } break; - case 228: /* cmd ::= SHOW STREAMS */ + case 231: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } break; - case 229: /* cmd ::= SHOW ACCOUNTS */ + case 232: /* cmd ::= SHOW ACCOUNTS */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } break; - case 230: /* cmd ::= SHOW APPS */ + case 233: /* cmd ::= SHOW APPS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); } break; - case 231: /* cmd ::= SHOW CONNECTIONS */ + case 234: /* cmd ::= SHOW CONNECTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); } break; - case 232: /* cmd ::= SHOW LICENCES */ - case 233: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==233); + case 235: /* cmd ::= SHOW LICENCES */ + case 236: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==236); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); } break; - case 234: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy881); } + case 237: /* cmd ::= SHOW CREATE DATABASE db_name */ +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy97); } break; - case 235: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy140); } + case 238: /* cmd ::= SHOW CREATE TABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy792); } break; - case 236: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy140); } + case 239: /* cmd ::= SHOW CREATE STABLE full_table_name */ +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy792); } break; - case 237: /* cmd ::= SHOW QUERIES */ + case 240: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } break; - case 238: /* cmd ::= SHOW SCORES */ + case 241: /* cmd ::= SHOW SCORES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); } break; - case 239: /* cmd ::= SHOW TOPICS */ + case 242: /* cmd ::= SHOW TOPICS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); } break; - case 240: /* cmd ::= SHOW VARIABLES */ - case 241: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==241); + case 243: /* cmd ::= SHOW VARIABLES */ + case 244: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==244); { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); } break; - case 242: /* cmd ::= SHOW LOCAL VARIABLES */ + case 245: /* cmd ::= SHOW LOCAL VARIABLES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); } break; - case 243: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy140); } + case 246: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */ +{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy792); } break; - case 244: /* cmd ::= SHOW BNODES */ + case 247: /* cmd ::= SHOW BNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); } break; - case 245: /* cmd ::= SHOW SNODES */ + case 248: /* cmd ::= SHOW SNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); } break; - case 246: /* cmd ::= SHOW CLUSTER */ + case 249: /* cmd ::= SHOW CLUSTER */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); } break; - case 247: /* cmd ::= SHOW TRANSACTIONS */ + case 250: /* cmd ::= SHOW TRANSACTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; - case 248: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy140); } + case 251: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy792); } break; - case 249: /* cmd ::= SHOW CONSUMERS */ + case 252: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } break; - case 250: /* cmd ::= SHOW SUBSCRIPTIONS */ + case 253: /* cmd ::= SHOW SUBSCRIPTIONS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; - case 251: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy140, yymsp[-1].minor.yy140, OP_TYPE_EQUAL); } + case 254: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy792, yymsp[-1].minor.yy792, OP_TYPE_EQUAL); } break; - case 252: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140, yymsp[-3].minor.yy220); } + case 255: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */ +{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy792, yymsp[0].minor.yy792, yymsp[-3].minor.yy520); } break; - case 253: /* cmd ::= SHOW VNODES NK_INTEGER */ + case 256: /* cmd ::= SHOW VNODES NK_INTEGER */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); } break; - case 254: /* cmd ::= SHOW VNODES NK_STRING */ + case 257: /* cmd ::= SHOW VNODES NK_STRING */ { pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, createValueNode(pCxt, TSDB_DATA_TYPE_VARCHAR, &yymsp[0].minor.yy0)); } break; - case 255: /* cmd ::= SHOW db_name_cond_opt ALIVE */ -{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy140, QUERY_NODE_SHOW_DB_ALIVE_STMT); } + case 258: /* cmd ::= SHOW db_name_cond_opt ALIVE */ +{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy792, QUERY_NODE_SHOW_DB_ALIVE_STMT); } break; - case 256: /* cmd ::= SHOW CLUSTER ALIVE */ + case 259: /* cmd ::= SHOW CLUSTER ALIVE */ { pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); } break; - case 257: /* db_name_cond_opt ::= */ - case 262: /* from_db_opt ::= */ yytestcase(yyruleno==262); -{ yymsp[1].minor.yy140 = createDefaultDatabaseCondValue(pCxt); } + case 260: /* db_name_cond_opt ::= */ + case 265: /* from_db_opt ::= */ yytestcase(yyruleno==265); +{ yymsp[1].minor.yy792 = createDefaultDatabaseCondValue(pCxt); } break; - case 258: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 261: /* db_name_cond_opt ::= db_name NK_DOT */ +{ yylhsminor.yy792 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy97); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 260: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + case 263: /* like_pattern_opt ::= LIKE NK_STRING */ +{ yymsp[-1].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; - case 261: /* table_name_cond ::= table_name */ -{ yylhsminor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 264: /* table_name_cond ::= table_name */ +{ yylhsminor.yy792 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy97); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 263: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy140 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy881); } + case 266: /* from_db_opt ::= FROM db_name */ +{ yymsp[-1].minor.yy792 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy97); } break; - case 267: /* tag_item ::= TBNAME */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 270: /* tag_item ::= TBNAME */ +{ yylhsminor.yy792 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 270: /* tag_item ::= column_name column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 273: /* tag_item ::= column_name column_alias */ +{ yylhsminor.yy792 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy97), &yymsp[0].minor.yy97); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 271: /* tag_item ::= column_name AS column_alias */ -{ yylhsminor.yy140 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy881), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 274: /* tag_item ::= column_name AS column_alias */ +{ yylhsminor.yy792 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy97), &yymsp[0].minor.yy97); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 272: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy587, yymsp[-3].minor.yy140, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } + case 275: /* cmd ::= CREATE SMA INDEX not_exists_opt full_index_name ON full_table_name index_options */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy89, yymsp[-3].minor.yy792, yymsp[-1].minor.yy792, NULL, yymsp[0].minor.yy792); } break; - case 273: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy587, yymsp[-5].minor.yy140, yymsp[-3].minor.yy140, yymsp[-1].minor.yy220, NULL); } + case 276: /* cmd ::= CREATE INDEX not_exists_opt full_index_name ON full_table_name NK_LP col_name_list NK_RP */ +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy89, yymsp[-5].minor.yy792, yymsp[-3].minor.yy792, yymsp[-1].minor.yy520, NULL); } break; - case 274: /* cmd ::= DROP INDEX exists_opt full_index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy587, yymsp[0].minor.yy140); } + case 277: /* cmd ::= DROP INDEX exists_opt full_index_name */ +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy89, yymsp[0].minor.yy792); } break; - case 275: /* full_index_name ::= index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy881); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 278: /* full_index_name ::= index_name */ +{ yylhsminor.yy792 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy97); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 276: /* full_index_name ::= db_name NK_DOT index_name */ -{ yylhsminor.yy140 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 279: /* full_index_name ::= db_name NK_DOT index_name */ +{ yylhsminor.yy792 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy97); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 277: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy140 = createIndexOption(pCxt, yymsp[-7].minor.yy220, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 280: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-9].minor.yy792 = createIndexOption(pCxt, yymsp[-7].minor.yy520, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), NULL, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 278: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy140 = createIndexOption(pCxt, yymsp[-9].minor.yy220, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 281: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ +{ yymsp[-11].minor.yy792 = createIndexOption(pCxt, yymsp[-9].minor.yy520, releaseRawExprNode(pCxt, yymsp[-5].minor.yy792), releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 281: /* func ::= sma_func_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy140 = createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 284: /* func ::= sma_func_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy792 = createFunctionNode(pCxt, &yymsp[-3].minor.yy97, yymsp[-1].minor.yy520); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 287: /* sma_stream_opt ::= */ - case 321: /* stream_options ::= */ yytestcase(yyruleno==321); -{ yymsp[1].minor.yy140 = createStreamOptions(pCxt); } + case 285: /* sma_func_name ::= function_name */ + case 489: /* alias_opt ::= table_alias */ yytestcase(yyruleno==489); +{ yylhsminor.yy97 = yymsp[0].minor.yy97; } + yymsp[0].minor.yy97 = yylhsminor.yy97; break; - case 288: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 290: /* sma_stream_opt ::= */ + case 324: /* stream_options ::= */ yytestcase(yyruleno==324); +{ yymsp[1].minor.yy792 = createStreamOptions(pCxt); } break; - case 289: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 291: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy792)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy792); yylhsminor.yy792 = yymsp[-2].minor.yy792; } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 290: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy140)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); yylhsminor.yy140 = yymsp[-2].minor.yy140; } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 292: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy792)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy792); yylhsminor.yy792 = yymsp[-2].minor.yy792; } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 291: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, yymsp[0].minor.yy140); } + case 293: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */ +{ ((SStreamOptions*)yymsp[-2].minor.yy792)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy792); yylhsminor.yy792 = yymsp[-2].minor.yy792; } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 292: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy881, false); } + case 294: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */ +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy97, yymsp[0].minor.yy792); } break; - case 293: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[0].minor.yy881, true); } + case 295: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy97, &yymsp[0].minor.yy97, false); } break; - case 294: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy587, &yymsp[-3].minor.yy881, yymsp[0].minor.yy140, false); } + case 296: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy89, &yymsp[-5].minor.yy97, &yymsp[0].minor.yy97, true); } break; - case 295: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy587, &yymsp[-5].minor.yy881, yymsp[0].minor.yy140, true); } + case 297: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy89, &yymsp[-3].minor.yy97, yymsp[0].minor.yy792, false); } break; - case 296: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 298: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy89, &yymsp[-5].minor.yy97, yymsp[0].minor.yy792, true); } break; - case 297: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy587, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881); } + case 299: /* cmd ::= DROP TOPIC exists_opt topic_name */ +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy97); } break; - case 298: /* cmd ::= DESC full_table_name */ - case 299: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==299); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy140); } + case 300: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy89, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy97); } break; - case 300: /* cmd ::= RESET QUERY CACHE */ + case 301: /* cmd ::= DESC full_table_name */ + case 302: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==302); +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy792); } + break; + case 303: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; - case 301: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ - case 302: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==302); -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy587, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 304: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */ + case 305: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==305); +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy89, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 305: /* explain_options ::= */ -{ yymsp[1].minor.yy140 = createDefaultExplainOptions(pCxt); } + case 308: /* explain_options ::= */ +{ yymsp[1].minor.yy792 = createDefaultExplainOptions(pCxt); } break; - case 306: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy140 = setExplainVerbose(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 309: /* explain_options ::= explain_options VERBOSE NK_BOOL */ +{ yylhsminor.yy792 = setExplainVerbose(pCxt, yymsp[-2].minor.yy792, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 307: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy140 = setExplainRatio(pCxt, yymsp[-2].minor.yy140, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 310: /* explain_options ::= explain_options RATIO NK_FLOAT */ +{ yylhsminor.yy792 = setExplainRatio(pCxt, yymsp[-2].minor.yy792, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 308: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy587, yymsp[-8].minor.yy587, &yymsp[-5].minor.yy881, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy682, yymsp[0].minor.yy214); } + case 311: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy89, yymsp[-8].minor.yy89, &yymsp[-5].minor.yy97, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy848, yymsp[0].minor.yy20); } break; - case 309: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 312: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy97); } break; - case 314: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy587, &yymsp[-8].minor.yy881, yymsp[-5].minor.yy140, yymsp[-7].minor.yy140, yymsp[-3].minor.yy220, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, yymsp[-4].minor.yy220); } + case 317: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy89, &yymsp[-8].minor.yy97, yymsp[-5].minor.yy792, yymsp[-7].minor.yy792, yymsp[-3].minor.yy520, yymsp[-2].minor.yy792, yymsp[0].minor.yy792, yymsp[-4].minor.yy520); } break; - case 315: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy587, &yymsp[0].minor.yy881); } + case 318: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy89, &yymsp[0].minor.yy97); } break; - case 322: /* stream_options ::= stream_options TRIGGER AT_ONCE */ - case 323: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==323); -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 325: /* stream_options ::= stream_options TRIGGER AT_ONCE */ + case 326: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==326); +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-2].minor.yy792, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 324: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 327: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-3].minor.yy792, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 325: /* stream_options ::= stream_options WATERMARK duration_literal */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 328: /* stream_options ::= stream_options WATERMARK duration_literal */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-2].minor.yy792, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 326: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 329: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-3].minor.yy792, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 327: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 330: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-2].minor.yy792, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 328: /* stream_options ::= stream_options DELETE_MARK duration_literal */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-2].minor.yy140, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 331: /* stream_options ::= stream_options DELETE_MARK duration_literal */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-2].minor.yy792, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 329: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ -{ yylhsminor.yy140 = setStreamOptions(pCxt, yymsp[-3].minor.yy140, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 332: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */ +{ yylhsminor.yy792 = setStreamOptions(pCxt, yymsp[-3].minor.yy792, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 331: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ - case 520: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==520); - case 540: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==540); -{ yymsp[-3].minor.yy140 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy140); } + case 334: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */ + case 523: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ yytestcase(yyruleno==523); + case 543: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==543); +{ yymsp[-3].minor.yy792 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy792); } break; - case 332: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 335: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 333: /* cmd ::= KILL QUERY NK_STRING */ + case 336: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 334: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 337: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 335: /* cmd ::= BALANCE VGROUP */ + case 338: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 336: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 339: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 337: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy220); } + case 340: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy520); } break; - case 338: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 341: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 339: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy220 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 342: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy520 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 341: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 344: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 344: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ -{ yymsp[-6].minor.yy140 = createInsertStmt(pCxt, yymsp[-4].minor.yy140, yymsp[-2].minor.yy220, yymsp[0].minor.yy140); } + case 347: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */ +{ yymsp[-6].minor.yy792 = createInsertStmt(pCxt, yymsp[-4].minor.yy792, yymsp[-2].minor.yy520, yymsp[0].minor.yy792); } break; - case 345: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ -{ yymsp[-3].minor.yy140 = createInsertStmt(pCxt, yymsp[-1].minor.yy140, NULL, yymsp[0].minor.yy140); } + case 348: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */ +{ yymsp[-3].minor.yy792 = createInsertStmt(pCxt, yymsp[-1].minor.yy792, NULL, yymsp[0].minor.yy792); } break; - case 346: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 349: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 347: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 350: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 348: /* literal ::= NK_STRING */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 351: /* literal ::= NK_STRING */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 349: /* literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 352: /* literal ::= NK_BOOL */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 350: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 353: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 351: /* literal ::= duration_literal */ - case 361: /* signed_literal ::= signed */ yytestcase(yyruleno==361); - case 382: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==382); - case 383: /* expression ::= literal */ yytestcase(yyruleno==383); - case 384: /* expression ::= pseudo_column */ yytestcase(yyruleno==384); - case 385: /* expression ::= column_reference */ yytestcase(yyruleno==385); - case 386: /* expression ::= function_expression */ yytestcase(yyruleno==386); - case 387: /* expression ::= case_when_expression */ yytestcase(yyruleno==387); - case 418: /* function_expression ::= literal_func */ yytestcase(yyruleno==418); - case 467: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==467); - case 471: /* boolean_primary ::= predicate */ yytestcase(yyruleno==471); - case 473: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==473); - case 474: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==474); - case 477: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==477); - case 479: /* table_reference ::= table_primary */ yytestcase(yyruleno==479); - case 480: /* table_reference ::= joined_table */ yytestcase(yyruleno==480); - case 484: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==484); - case 542: /* query_simple ::= query_specification */ yytestcase(yyruleno==542); - case 543: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==543); - case 546: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==546); - case 548: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==548); -{ yylhsminor.yy140 = yymsp[0].minor.yy140; } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 354: /* literal ::= duration_literal */ + case 364: /* signed_literal ::= signed */ yytestcase(yyruleno==364); + case 385: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==385); + case 386: /* expression ::= literal */ yytestcase(yyruleno==386); + case 387: /* expression ::= pseudo_column */ yytestcase(yyruleno==387); + case 388: /* expression ::= column_reference */ yytestcase(yyruleno==388); + case 389: /* expression ::= function_expression */ yytestcase(yyruleno==389); + case 390: /* expression ::= case_when_expression */ yytestcase(yyruleno==390); + case 421: /* function_expression ::= literal_func */ yytestcase(yyruleno==421); + case 470: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==470); + case 474: /* boolean_primary ::= predicate */ yytestcase(yyruleno==474); + case 476: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==476); + case 477: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==477); + case 480: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==480); + case 482: /* table_reference ::= table_primary */ yytestcase(yyruleno==482); + case 483: /* table_reference ::= joined_table */ yytestcase(yyruleno==483); + case 487: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==487); + case 545: /* query_simple ::= query_specification */ yytestcase(yyruleno==545); + case 546: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==546); + case 549: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==549); + case 551: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==551); +{ yylhsminor.yy792 = yymsp[0].minor.yy792; } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 352: /* literal ::= NULL */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 355: /* literal ::= NULL */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 353: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 356: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 354: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 357: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 355: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 358: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 356: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + case 359: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 357: /* signed ::= NK_MINUS NK_INTEGER */ + case 360: /* 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.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 358: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 361: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 359: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 362: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 360: /* signed ::= NK_MINUS NK_FLOAT */ + case 363: /* 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.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 362: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 365: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 363: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 366: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 364: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 367: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 365: /* signed_literal ::= duration_literal */ - case 367: /* signed_literal ::= literal_func */ yytestcase(yyruleno==367); - case 438: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==438); - case 500: /* select_item ::= common_expression */ yytestcase(yyruleno==500); - case 510: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==510); - case 547: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==547); - case 549: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==549); - case 562: /* search_condition ::= common_expression */ yytestcase(yyruleno==562); -{ yylhsminor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 368: /* signed_literal ::= duration_literal */ + case 370: /* signed_literal ::= literal_func */ yytestcase(yyruleno==370); + case 441: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==441); + case 503: /* select_item ::= common_expression */ yytestcase(yyruleno==503); + case 513: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==513); + case 550: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==550); + case 552: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==552); + case 565: /* search_condition ::= common_expression */ yytestcase(yyruleno==565); +{ yylhsminor.yy792 = releaseRawExprNode(pCxt, yymsp[0].minor.yy792); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 366: /* signed_literal ::= NULL */ -{ yylhsminor.yy140 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 369: /* signed_literal ::= NULL */ +{ yylhsminor.yy792 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 368: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy140 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 371: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy792 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 388: /* expression ::= NK_LP expression NK_RP */ - case 472: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==472); - case 561: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==561); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 391: /* expression ::= NK_LP expression NK_RP */ + case 475: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==475); + case 564: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==564); +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy792)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 389: /* expression ::= NK_PLUS expr_or_subquery */ + case 392: /* expression ::= NK_PLUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 390: /* expression ::= NK_MINUS expr_or_subquery */ + case 393: /* expression ::= NK_MINUS expr_or_subquery */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy792), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 391: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ + case 394: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 392: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ + case 395: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 393: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ + case 396: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 394: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ + case 397: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 395: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ + case 398: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 396: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 399: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 397: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ + case 400: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 398: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ + case 401: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 401: /* column_reference ::= column_name */ -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy881, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy881)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 404: /* column_reference ::= column_name */ +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy97, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy97)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 402: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881, createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy881)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 405: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy97, createColumnNode(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy97)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 403: /* pseudo_column ::= ROWTS */ - case 404: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==404); - case 406: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==406); - case 407: /* pseudo_column ::= QEND */ yytestcase(yyruleno==407); - case 408: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==408); - case 409: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==409); - case 410: /* pseudo_column ::= WEND */ yytestcase(yyruleno==410); - case 411: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==411); - case 412: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==412); - case 413: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==413); - case 414: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==414); - case 420: /* literal_func ::= NOW */ yytestcase(yyruleno==420); -{ yylhsminor.yy140 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 406: /* pseudo_column ::= ROWTS */ + case 407: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==407); + case 409: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==409); + case 410: /* pseudo_column ::= QEND */ yytestcase(yyruleno==410); + case 411: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==411); + case 412: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==412); + case 413: /* pseudo_column ::= WEND */ yytestcase(yyruleno==413); + case 414: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==414); + case 415: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==415); + case 416: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==416); + case 417: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==417); + case 423: /* literal_func ::= NOW */ yytestcase(yyruleno==423); +{ yylhsminor.yy792 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 405: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy881)))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 408: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy97)))); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 415: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 416: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==416); -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy881, yymsp[-1].minor.yy220)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 418: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 419: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==419); +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy97, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy97, yymsp[-1].minor.yy520)); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 417: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy682)); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 420: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), yymsp[-1].minor.yy848)); } + yymsp[-5].minor.yy792 = yylhsminor.yy792; break; - case 419: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy881, NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 422: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy97, NULL)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 434: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy220 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 437: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy520 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy520 = yylhsminor.yy520; break; - case 439: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 503: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==503); -{ yylhsminor.yy140 = createColumnNode(pCxt, &yymsp[-2].minor.yy881, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 442: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 506: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==506); +{ yylhsminor.yy792 = createColumnNode(pCxt, &yymsp[-2].minor.yy97, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 440: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 443: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy520, yymsp[-1].minor.yy792)); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 441: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-2].minor.yy220, yymsp[-1].minor.yy140)); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + case 444: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), yymsp[-2].minor.yy520, yymsp[-1].minor.yy792)); } + yymsp[-4].minor.yy792 = yylhsminor.yy792; break; - case 444: /* when_then_expr ::= WHEN common_expression THEN common_expression */ -{ yymsp[-3].minor.yy140 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140)); } + case 447: /* when_then_expr ::= WHEN common_expression THEN common_expression */ +{ yymsp[-3].minor.yy792 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792)); } break; - case 446: /* case_when_else_opt ::= ELSE common_expression */ -{ yymsp[-1].minor.yy140 = releaseRawExprNode(pCxt, yymsp[0].minor.yy140); } + case 449: /* case_when_else_opt ::= ELSE common_expression */ +{ yymsp[-1].minor.yy792 = releaseRawExprNode(pCxt, yymsp[0].minor.yy792); } break; - case 447: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ - case 452: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==452); + case 450: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */ + case 455: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==455); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy794, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy396, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 448: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ + case 451: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy792), releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-4].minor.yy140 = yylhsminor.yy140; + yymsp[-4].minor.yy792 = yylhsminor.yy792; break; - case 449: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ + case 452: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy792), releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + yymsp[-5].minor.yy792 = yylhsminor.yy792; break; - case 450: /* predicate ::= expr_or_subquery IS NULL */ + case 453: /* predicate ::= expr_or_subquery IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), NULL)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 451: /* predicate ::= expr_or_subquery IS NOT NULL */ + case 454: /* predicate ::= expr_or_subquery IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), NULL)); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 453: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_THAN; } + case 456: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy396 = OP_TYPE_LOWER_THAN; } break; - case 454: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_THAN; } + case 457: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy396 = OP_TYPE_GREATER_THAN; } break; - case 455: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LOWER_EQUAL; } + case 458: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy396 = OP_TYPE_LOWER_EQUAL; } break; - case 456: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy794 = OP_TYPE_GREATER_EQUAL; } + case 459: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy396 = OP_TYPE_GREATER_EQUAL; } break; - case 457: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy794 = OP_TYPE_NOT_EQUAL; } + case 460: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy396 = OP_TYPE_NOT_EQUAL; } break; - case 458: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy794 = OP_TYPE_EQUAL; } + case 461: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy396 = OP_TYPE_EQUAL; } break; - case 459: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy794 = OP_TYPE_LIKE; } + case 462: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy396 = OP_TYPE_LIKE; } break; - case 460: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_LIKE; } + case 463: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy396 = OP_TYPE_NOT_LIKE; } break; - case 461: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_MATCH; } + case 464: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy396 = OP_TYPE_MATCH; } break; - case 462: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy794 = OP_TYPE_NMATCH; } + case 465: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy396 = OP_TYPE_NMATCH; } break; - case 463: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy794 = OP_TYPE_JSON_CONTAINS; } + case 466: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy396 = OP_TYPE_JSON_CONTAINS; } break; - case 464: /* in_op ::= IN */ -{ yymsp[0].minor.yy794 = OP_TYPE_IN; } + case 467: /* in_op ::= IN */ +{ yymsp[0].minor.yy396 = OP_TYPE_IN; } break; - case 465: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy794 = OP_TYPE_NOT_IN; } + case 468: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy396 = OP_TYPE_NOT_IN; } break; - case 466: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 469: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy520)); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 468: /* boolean_value_expression ::= NOT boolean_primary */ + case 471: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy140), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy792), NULL)); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 469: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 472: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 470: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 473: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy140); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy140); - yylhsminor.yy140 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy792); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy792); + yylhsminor.yy792 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 476: /* from_clause_opt ::= FROM table_reference_list */ - case 505: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==505); - case 536: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==536); -{ yymsp[-1].minor.yy140 = yymsp[0].minor.yy140; } + case 481: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy792 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy792, yymsp[0].minor.yy792, NULL); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 478: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy140, yymsp[0].minor.yy140, NULL); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 484: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy792 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy97, &yymsp[0].minor.yy97); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 481: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 485: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy792 = createRealTableNode(pCxt, &yymsp[-3].minor.yy97, &yymsp[-1].minor.yy97, &yymsp[0].minor.yy97); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 482: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy140 = createRealTableNode(pCxt, &yymsp[-3].minor.yy881, &yymsp[-1].minor.yy881, &yymsp[0].minor.yy881); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 486: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy792 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy792), &yymsp[0].minor.yy97); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 483: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy140 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 488: /* alias_opt ::= */ +{ yymsp[1].minor.yy97 = nil_token; } break; - case 485: /* alias_opt ::= */ -{ yymsp[1].minor.yy881 = nil_token; } + case 490: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy97 = yymsp[0].minor.yy97; } break; - case 487: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy881 = yymsp[0].minor.yy881; } + case 491: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 492: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==492); +{ yymsp[-2].minor.yy792 = yymsp[-1].minor.yy792; } break; - case 488: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 489: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==489); -{ yymsp[-2].minor.yy140 = yymsp[-1].minor.yy140; } + case 493: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy792 = createJoinTableNode(pCxt, yymsp[-4].minor.yy116, yymsp[-5].minor.yy792, yymsp[-2].minor.yy792, yymsp[0].minor.yy792); } + yymsp[-5].minor.yy792 = yylhsminor.yy792; break; - case 490: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy140 = createJoinTableNode(pCxt, yymsp[-4].minor.yy852, yymsp[-5].minor.yy140, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-5].minor.yy140 = yylhsminor.yy140; + case 494: /* join_type ::= */ +{ yymsp[1].minor.yy116 = JOIN_TYPE_INNER; } break; - case 491: /* join_type ::= */ -{ yymsp[1].minor.yy852 = JOIN_TYPE_INNER; } + case 495: /* join_type ::= INNER */ +{ yymsp[0].minor.yy116 = JOIN_TYPE_INNER; } break; - case 492: /* join_type ::= INNER */ -{ yymsp[0].minor.yy852 = JOIN_TYPE_INNER; } - break; - case 493: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 496: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy140 = createSelectStmt(pCxt, yymsp[-10].minor.yy587, yymsp[-9].minor.yy220, yymsp[-8].minor.yy140); - yymsp[-11].minor.yy140 = addWhereClause(pCxt, yymsp[-11].minor.yy140, yymsp[-7].minor.yy140); - yymsp[-11].minor.yy140 = addPartitionByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-6].minor.yy220); - yymsp[-11].minor.yy140 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy140, yymsp[-2].minor.yy140); - yymsp[-11].minor.yy140 = addGroupByClause(pCxt, yymsp[-11].minor.yy140, yymsp[-1].minor.yy220); - yymsp[-11].minor.yy140 = addHavingClause(pCxt, yymsp[-11].minor.yy140, yymsp[0].minor.yy140); - yymsp[-11].minor.yy140 = addRangeClause(pCxt, yymsp[-11].minor.yy140, yymsp[-5].minor.yy140); - yymsp[-11].minor.yy140 = addEveryClause(pCxt, yymsp[-11].minor.yy140, yymsp[-4].minor.yy140); - yymsp[-11].minor.yy140 = addFillClause(pCxt, yymsp[-11].minor.yy140, yymsp[-3].minor.yy140); + yymsp[-11].minor.yy792 = createSelectStmt(pCxt, yymsp[-10].minor.yy89, yymsp[-9].minor.yy520, yymsp[-8].minor.yy792); + yymsp[-11].minor.yy792 = addWhereClause(pCxt, yymsp[-11].minor.yy792, yymsp[-7].minor.yy792); + yymsp[-11].minor.yy792 = addPartitionByClause(pCxt, yymsp[-11].minor.yy792, yymsp[-6].minor.yy520); + yymsp[-11].minor.yy792 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy792, yymsp[-2].minor.yy792); + yymsp[-11].minor.yy792 = addGroupByClause(pCxt, yymsp[-11].minor.yy792, yymsp[-1].minor.yy520); + yymsp[-11].minor.yy792 = addHavingClause(pCxt, yymsp[-11].minor.yy792, yymsp[0].minor.yy792); + yymsp[-11].minor.yy792 = addRangeClause(pCxt, yymsp[-11].minor.yy792, yymsp[-5].minor.yy792); + yymsp[-11].minor.yy792 = addEveryClause(pCxt, yymsp[-11].minor.yy792, yymsp[-4].minor.yy792); + yymsp[-11].minor.yy792 = addFillClause(pCxt, yymsp[-11].minor.yy792, yymsp[-3].minor.yy792); } break; - case 496: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy587 = false; } + case 499: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy89 = false; } break; - case 499: /* select_item ::= NK_STAR */ -{ yylhsminor.yy140 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy140 = yylhsminor.yy140; + case 502: /* select_item ::= NK_STAR */ +{ yylhsminor.yy792 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy792 = yylhsminor.yy792; break; - case 501: /* select_item ::= common_expression column_alias */ - case 511: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==511); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-1].minor.yy140 = yylhsminor.yy140; + case 504: /* select_item ::= common_expression column_alias */ + case 514: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==514); +{ yylhsminor.yy792 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy792), &yymsp[0].minor.yy97); } + yymsp[-1].minor.yy792 = yylhsminor.yy792; break; - case 502: /* select_item ::= common_expression AS column_alias */ - case 512: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==512); -{ yylhsminor.yy140 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), &yymsp[0].minor.yy881); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 505: /* select_item ::= common_expression AS column_alias */ + case 515: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==515); +{ yylhsminor.yy792 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), &yymsp[0].minor.yy97); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 507: /* partition_by_clause_opt ::= PARTITION BY partition_list */ - case 532: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==532); - case 551: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==551); -{ yymsp[-2].minor.yy220 = yymsp[0].minor.yy220; } + case 510: /* partition_by_clause_opt ::= PARTITION BY partition_list */ + case 535: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==535); + case 554: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==554); +{ yymsp[-2].minor.yy520 = yymsp[0].minor.yy520; } break; - case 514: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy140 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 517: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy792 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), releaseRawExprNode(pCxt, yymsp[-1].minor.yy792)); } break; - case 515: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ -{ yymsp[-3].minor.yy140 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 518: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */ +{ yymsp[-3].minor.yy792 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy792)); } break; - case 516: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), NULL, yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 519: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy792 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), NULL, yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 517: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy140 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy140), releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), yymsp[-1].minor.yy140, yymsp[0].minor.yy140); } + case 520: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy792 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy792), releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), yymsp[-1].minor.yy792, yymsp[0].minor.yy792); } break; - case 518: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ -{ yymsp[-6].minor.yy140 = createEventWindowNode(pCxt, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } + case 521: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */ +{ yymsp[-6].minor.yy792 = createEventWindowNode(pCxt, yymsp[-3].minor.yy792, yymsp[0].minor.yy792); } break; - case 522: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy140 = createFillNode(pCxt, yymsp[-1].minor.yy174, NULL); } + case 525: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy792 = createFillNode(pCxt, yymsp[-1].minor.yy646, NULL); } break; - case 523: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 526: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy792 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy520)); } break; - case 524: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy140 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy220)); } + case 527: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy792 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy520)); } break; - case 525: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy174 = FILL_MODE_NONE; } + case 528: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy646 = FILL_MODE_NONE; } break; - case 526: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy174 = FILL_MODE_PREV; } + case 529: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy646 = FILL_MODE_PREV; } break; - case 527: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL; } + case 530: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy646 = FILL_MODE_NULL; } break; - case 528: /* fill_mode ::= NULL_F */ -{ yymsp[0].minor.yy174 = FILL_MODE_NULL_F; } + case 531: /* fill_mode ::= NULL_F */ +{ yymsp[0].minor.yy646 = FILL_MODE_NULL_F; } break; - case 529: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy174 = FILL_MODE_LINEAR; } + case 532: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy646 = FILL_MODE_LINEAR; } break; - case 530: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy174 = FILL_MODE_NEXT; } + case 533: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy646 = FILL_MODE_NEXT; } break; - case 533: /* group_by_list ::= expr_or_subquery */ -{ yylhsminor.yy220 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[0].minor.yy220 = yylhsminor.yy220; + case 536: /* group_by_list ::= expr_or_subquery */ +{ yylhsminor.yy520 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } + yymsp[0].minor.yy520 = yylhsminor.yy520; break; - case 534: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ -{ yylhsminor.yy220 = addNodeToList(pCxt, yymsp[-2].minor.yy220, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy140))); } - yymsp[-2].minor.yy220 = yylhsminor.yy220; + case 537: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */ +{ yylhsminor.yy520 = addNodeToList(pCxt, yymsp[-2].minor.yy520, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy792))); } + yymsp[-2].minor.yy520 = yylhsminor.yy520; break; - case 538: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ -{ yymsp[-5].minor.yy140 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy140), releaseRawExprNode(pCxt, yymsp[-1].minor.yy140)); } + case 541: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */ +{ yymsp[-5].minor.yy792 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy792), releaseRawExprNode(pCxt, yymsp[-1].minor.yy792)); } break; - case 541: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 544: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy140 = addOrderByClause(pCxt, yymsp[-3].minor.yy140, yymsp[-2].minor.yy220); - yylhsminor.yy140 = addSlimitClause(pCxt, yylhsminor.yy140, yymsp[-1].minor.yy140); - yylhsminor.yy140 = addLimitClause(pCxt, yylhsminor.yy140, yymsp[0].minor.yy140); + yylhsminor.yy792 = addOrderByClause(pCxt, yymsp[-3].minor.yy792, yymsp[-2].minor.yy520); + yylhsminor.yy792 = addSlimitClause(pCxt, yylhsminor.yy792, yymsp[-1].minor.yy792); + yylhsminor.yy792 = addLimitClause(pCxt, yylhsminor.yy792, yymsp[0].minor.yy792); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 544: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-3].minor.yy140 = yylhsminor.yy140; + case 547: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */ +{ yylhsminor.yy792 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy792, yymsp[0].minor.yy792); } + yymsp[-3].minor.yy792 = yylhsminor.yy792; break; - case 545: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ -{ yylhsminor.yy140 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy140, yymsp[0].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 548: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */ +{ yylhsminor.yy792 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy792, yymsp[0].minor.yy792); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 553: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 557: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==557); -{ yymsp[-1].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 556: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 560: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==560); +{ yymsp[-1].minor.yy792 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 554: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 558: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==558); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 557: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 561: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==561); +{ yymsp[-3].minor.yy792 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 555: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 559: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==559); -{ yymsp[-3].minor.yy140 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 558: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 562: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==562); +{ yymsp[-3].minor.yy792 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 560: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy140 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy140); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 563: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy792 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy792); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 565: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy140 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy140), yymsp[-1].minor.yy866, yymsp[0].minor.yy697); } - yymsp[-2].minor.yy140 = yylhsminor.yy140; + case 568: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy792 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy792), yymsp[-1].minor.yy34, yymsp[0].minor.yy265); } + yymsp[-2].minor.yy792 = yylhsminor.yy792; break; - case 566: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy866 = ORDER_ASC; } + case 569: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy34 = ORDER_ASC; } break; - case 567: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy866 = ORDER_ASC; } + case 570: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy34 = ORDER_ASC; } break; - case 568: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy866 = ORDER_DESC; } + case 571: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy34 = ORDER_DESC; } break; - case 569: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy697 = NULL_ORDER_DEFAULT; } + case 572: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy265 = NULL_ORDER_DEFAULT; } break; - case 570: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_FIRST; } + case 573: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy265 = NULL_ORDER_FIRST; } break; - case 571: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy697 = NULL_ORDER_LAST; } + case 574: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy265 = NULL_ORDER_LAST; } break; default: break; From 4d04f0f44dbe231c56d78f489086840a4c378eb8 Mon Sep 17 00:00:00 2001 From: cademfly Date: Tue, 28 Mar 2023 20:14:50 +0800 Subject: [PATCH 02/71] add stb msg --- include/common/tmsg.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index eb1ed592de..3bb8afe086 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -177,6 +177,12 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_SYSINFO 0xA #define TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC 0xB #define TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC 0xC +#define TSDB_ALTER_USER_ADD_READ_STABLE 0xD +#define TSDB_ALTER_USER_REMOVE_READ_STABLE 0xE +#define TSDB_ALTER_USER_ADD_WRITE_STABLE 0x10 +#define TSDB_ALTER_USER_REMOVE_WRITE_STABLE 0x11 +#define TSDB_ALTER_USER_ADD_ALL_STABLE 0x12 +#define TSDB_ALTER_USER_REMOVE_ALL_STABLE 0x13 #define TSDB_ALTER_USER_PRIVILEGES 0x2 From 28584839ea593063b360906a997a0728110e0351 Mon Sep 17 00:00:00 2001 From: cademfly Date: Tue, 28 Mar 2023 20:19:01 +0800 Subject: [PATCH 03/71] change msg number --- include/common/tmsg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 3bb8afe086..79b51e6cf8 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -179,10 +179,10 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC 0xC #define TSDB_ALTER_USER_ADD_READ_STABLE 0xD #define TSDB_ALTER_USER_REMOVE_READ_STABLE 0xE -#define TSDB_ALTER_USER_ADD_WRITE_STABLE 0x10 -#define TSDB_ALTER_USER_REMOVE_WRITE_STABLE 0x11 -#define TSDB_ALTER_USER_ADD_ALL_STABLE 0x12 -#define TSDB_ALTER_USER_REMOVE_ALL_STABLE 0x13 +#define TSDB_ALTER_USER_ADD_WRITE_STABLE 0xF +#define TSDB_ALTER_USER_REMOVE_WRITE_STABLE 0x10 +#define TSDB_ALTER_USER_ADD_ALL_STABLE 0x11 +#define TSDB_ALTER_USER_REMOVE_ALL_STABLE 0x12 #define TSDB_ALTER_USER_PRIVILEGES 0x2 From 2fd10c2aa0df2a81bd7277e186f443f6ebc39e4a Mon Sep 17 00:00:00 2001 From: cademfly Date: Wed, 29 Mar 2023 13:30:32 +0800 Subject: [PATCH 04/71] table --- include/common/tmsg.h | 18 ++- source/dnode/mnode/impl/inc/mndDef.h | 2 + source/dnode/mnode/impl/src/mndUser.c | 162 +++++++++++++++++++++++++- 3 files changed, 173 insertions(+), 9 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 79b51e6cf8..59676fc7cb 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -177,12 +177,16 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_SYSINFO 0xA #define TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC 0xB #define TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC 0xC -#define TSDB_ALTER_USER_ADD_READ_STABLE 0xD -#define TSDB_ALTER_USER_REMOVE_READ_STABLE 0xE -#define TSDB_ALTER_USER_ADD_WRITE_STABLE 0xF -#define TSDB_ALTER_USER_REMOVE_WRITE_STABLE 0x10 -#define TSDB_ALTER_USER_ADD_ALL_STABLE 0x11 -#define TSDB_ALTER_USER_REMOVE_ALL_STABLE 0x12 +#define TSDB_ALTER_USER_ADD_READ_TABLE 0xD +#define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE +#define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF +#define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10 +#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x11 +#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x12 +#define TSDB_ALTER_USER_ADD_READ_TAG 0x13 +#define TSDB_ALTER_USER_REMOVE_READ_TAG 0x14 +#define TSDB_ALTER_USER_ADD_WRITE_TAG 0x15 +#define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x16 #define TSDB_ALTER_USER_PRIVILEGES 0x2 @@ -706,6 +710,8 @@ typedef struct { SHashObj* createdDbs; SHashObj* readDbs; SHashObj* writeDbs; + SHashObj* readTbs; + SHashObj* writeTbs; } SGetUserAuthRsp; int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp); diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index e891eef1d8..2d06c42a43 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -280,6 +280,8 @@ typedef struct { SHashObj* readDbs; SHashObj* writeDbs; SHashObj* topics; + SHashObj* readStbs; + SHashObj* writeStbs; SRWLatch lock; } SUserObj; diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 92b73aed96..2e50e3430a 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -21,8 +21,9 @@ #include "mndTopic.h" #include "mndTrans.h" #include "tbase64.h" +#include "mndStb.h" -#define USER_VER_NUMBER 2 +#define USER_VER_NUMBER 3 #define USER_RESERVE_SIZE 64 static int32_t mndCreateDefaultUsers(SMnode *pMnode); @@ -124,8 +125,12 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs); + int32_t numOfReadStbs = taosHashGetSize(pUser->readStbs); + int32_t numOfWriteStbs = taosHashGetSize(pUser->writeStbs); int32_t numOfTopics = taosHashGetSize(pUser->topics); - int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs) * TSDB_DB_FNAME_LEN + + int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + + (numOfReadDbs + numOfWriteDbs ) * TSDB_DB_FNAME_LEN + + (numOfReadStbs + numOfWriteStbs) * TSDB_TABLE_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN; SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size); @@ -145,6 +150,8 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { SDB_SET_INT32(pRaw, dataPos, numOfReadDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfWriteDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfTopics, _OVER) + SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER) + SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER) char *db = taosHashIterate(pUser->readDbs, NULL); while (db != NULL) { @@ -164,6 +171,18 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { topic = taosHashIterate(pUser->topics, topic); } + char *stb = taosHashIterate(pUser->readStbs, NULL); + while (stb != NULL) { + SDB_SET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER); + stb = taosHashIterate(pUser->readStbs, stb); + } + + stb = taosHashIterate(pUser->writeStbs, NULL); + while (stb != NULL) { + SDB_SET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER); + stb = taosHashIterate(pUser->writeStbs, stb); + } + SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER) @@ -188,7 +207,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; - if (sver != 1 && sver != 2) { + if (sver != 1 && sver != 2 && sver != 3) { terrno = TSDB_CODE_SDB_INVALID_DATA_VER; goto _OVER; } @@ -214,16 +233,25 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t numOfReadDbs = 0; int32_t numOfWriteDbs = 0; int32_t numOfTopics = 0; + int32_t numOfReadStbs = 0; + int32_t numOfWriteStbs = 0; SDB_GET_INT32(pRaw, dataPos, &numOfReadDbs, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfWriteDbs, _OVER) if (sver >= 2) { SDB_GET_INT32(pRaw, dataPos, &numOfTopics, _OVER) } + if(sver >= 3){ + SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER) + SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER) + } pUser->readDbs = taosHashInit(numOfReadDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->writeDbs = taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->readStbs = taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->writeStbs = + taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER; for (int32_t i = 0; i < numOfReadDbs; ++i) { @@ -249,6 +277,22 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { } } + if(sver >= 3){ + for (int32_t i = 0; i < numOfReadStbs; ++i) { + char stb[TSDB_TABLE_FNAME_LEN] = {0}; + SDB_GET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER) + int32_t len = strlen(stb) + 1; + taosHashPut(pUser->readStbs, stb, len, stb, TSDB_DB_FNAME_LEN); + } + + for (int32_t i = 0; i < numOfWriteStbs; ++i) { + char stb[TSDB_TABLE_FNAME_LEN] = {0}; + SDB_GET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER) + int32_t len = strlen(stb) + 1; + taosHashPut(pUser->writeStbs, stb, len, stb, TSDB_TABLE_FNAME_LEN); + } + } + SDB_GET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) taosInitRWLatch(&pUser->lock); @@ -261,6 +305,8 @@ _OVER: taosHashCleanup(pUser->readDbs); taosHashCleanup(pUser->writeDbs); taosHashCleanup(pUser->topics); + taosHashCleanup(pUser->readStbs); + taosHashCleanup(pUser->writeStbs); } taosMemoryFreeClear(pRow); return NULL; @@ -293,6 +339,8 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { taosRLockLatch(&pUser->lock); pNew->readDbs = mndDupDbHash(pUser->readDbs); pNew->writeDbs = mndDupDbHash(pUser->writeDbs); + pNew->readStbs = mndDupTopicHash(pUser->readStbs); + pNew->writeStbs = mndDupTopicHash(pUser->writeStbs); pNew->topics = mndDupTopicHash(pUser->topics); taosRUnLockLatch(&pUser->lock); @@ -306,9 +354,13 @@ static void mndUserFreeObj(SUserObj *pUser) { taosHashCleanup(pUser->readDbs); taosHashCleanup(pUser->writeDbs); taosHashCleanup(pUser->topics); + taosHashCleanup(pUser->readStbs); + taosHashCleanup(pUser->writeStbs); pUser->readDbs = NULL; pUser->writeDbs = NULL; pUser->topics = NULL; + pUser->readStbs = NULL; + pUser->writeStbs = NULL; } static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) { @@ -328,6 +380,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { TSWAP(pOld->readDbs, pNew->readDbs); TSWAP(pOld->writeDbs, pNew->writeDbs); TSWAP(pOld->topics, pNew->topics); + TSWAP(pOld->readStbs, pNew->readStbs); + TSWAP(pOld->writeStbs, pNew->writeStbs); taosWUnLockLatch(&pOld->lock); return 0; @@ -637,6 +691,60 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } } + if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { + if (strcmp(alterReq.tabName, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if (taosHashPut(newUser.readStbs, tbFName, len, tbFName, TSDB_TABLE_NAME_LEN) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + taosHashPut(newUser.readStbs, pStb->name, len, pStb->name, TSDB_TABLE_NAME_LEN); + sdbRelease(pSdb, pStb); + } + } + } + + if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { + if (strcmp(alterReq.tabName, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if (taosHashPut(newUser.writeStbs, tbFName, len, tbFName, TSDB_TABLE_NAME_LEN) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); + sdbRelease(pSdb, pStb); + } + } + } + if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { int32_t len = strlen(alterReq.objname) + 1; SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname); @@ -917,6 +1025,52 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock db = taosHashIterate(pUser->writeDbs, db); } + char *stb = taosHashIterate(pUser->readStbs, NULL); + while (stb != NULL) { + cols = 0; + char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(userName, pUser->user, pShow->pMeta->pSchemas[cols].bytes); + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)userName, false); + + char privilege[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(privilege, "read", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); + + char objName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + mndExtractTbNameFromStbFullName(stb, &objName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); + varDataSetLen(objName, strlen(&objName[VARSTR_HEADER_SIZE])); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + + numOfRows++; + stb = taosHashIterate(pUser->readStbs, stb); + } + + stb = taosHashIterate(pUser->writeStbs, NULL); + while (stb != NULL) { + cols = 0; + char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(userName, pUser->user, pShow->pMeta->pSchemas[cols].bytes); + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)userName, false); + + char privilege[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(privilege, "write", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); + + char objName[TSDB_TABLE_NAME_LEN] = {0}; + mndExtractTbNameFromStbFullName(stb, &objName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); + varDataSetLen(objName, strlen(&objName[VARSTR_HEADER_SIZE])); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + + numOfRows++; + stb = taosHashIterate(pUser->writeStbs, stb); + } + char *topic = taosHashIterate(pUser->topics, NULL); while (topic != NULL) { cols = 0; @@ -1039,6 +1193,8 @@ int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db) { if (inRead || inWrite) { (void)taosHashRemove(newUser.readDbs, db, len); (void)taosHashRemove(newUser.writeDbs, db, len); + (void)taosHashRemove(newUser.readStbs, db, len); + (void)taosHashRemove(newUser.writeStbs, db, len); SSdbRaw *pCommitRaw = mndUserActionEncode(&newUser); if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) break; From 6265251a03f541bce2c663dbc8b8497ce5623c18 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 29 Mar 2023 19:08:40 +0800 Subject: [PATCH 05/71] feat: table level privilege syntax --- include/common/tmsg.h | 19 ++++++++++--------- source/common/src/tmsg.c | 13 ++++--------- source/libs/parser/src/parTranslater.c | 2 +- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 59676fc7cb..496af6d881 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -679,15 +679,16 @@ int32_t tSerializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq int32_t tDeserializeSCreateUserReq(void* buf, int32_t bufLen, SCreateUserReq* pReq); typedef struct { - int8_t alterType; - int8_t superUser; - int8_t sysInfo; - int8_t enable; - char user[TSDB_USER_LEN]; - char pass[TSDB_USET_PASSWORD_LEN]; - char objname[TSDB_DB_FNAME_LEN]; // db or topic - char tabName[TSDB_TABLE_NAME_LEN]; - char* tagCond; + int8_t alterType; + int8_t superUser; + int8_t sysInfo; + int8_t enable; + char user[TSDB_USER_LEN]; + char pass[TSDB_USET_PASSWORD_LEN]; + char objname[TSDB_DB_FNAME_LEN]; // db or topic + char tabName[TSDB_TABLE_NAME_LEN]; + char* tagCond; + int32_t tagCondLen; } SAlterUserReq; int32_t tSerializeSAlterUserReq(void* buf, int32_t bufLen, SAlterUserReq* pReq); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index f6c2aaa5a4..a2c3919b1c 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1373,11 +1373,7 @@ int32_t tSerializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq) if (len > 0) { if (tEncodeCStr(&encoder, pReq->tabName) < 0) return -1; } - len = (NULL == pReq->tagCond ? 0 : strlen(pReq->tagCond)); - if (tEncodeI32(&encoder, len) < 0) return -1; - if (len > 0) { - if (tEncodeCStr(&encoder, pReq->tagCond) < 0) return -1; - } + if (tEncodeBinary(&encoder, pReq->tagCond, pReq->tagCondLen) < 0) return -1; tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -1403,10 +1399,9 @@ int32_t tDeserializeSAlterUserReq(void *buf, int32_t bufLen, SAlterUserReq *pReq if (len > 0) { if (tDecodeCStrTo(&decoder, pReq->tabName) < 0) return -1; } - if (tDecodeI32(&decoder, &len) < 0) return -1; - if (len > 0) { - if (tDecodeCStrAlloc(&decoder, &pReq->tagCond) < 0) return -1; - } + uint64_t tagCondLen = 0; + if (tDecodeBinaryAlloc(&decoder, (void **)&pReq->tagCond, &tagCondLen) < 0) return -1; + pReq->tagCondLen = tagCondLen; } tEndDecode(&decoder); diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 1c88899dcf..06bd666609 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6467,7 +6467,7 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { sprintf(req.tabName, "%s", pStmt->tabName); int32_t code = TSDB_CODE_SUCCESS; if (NULL != pStmt->pTagCond) { - code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, NULL); + code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, &req.tagCondLen); } if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req); From 8309718af154f8b40fa4137c5454edec262c17b5 Mon Sep 17 00:00:00 2001 From: cademfly Date: Wed, 29 Mar 2023 19:51:49 +0800 Subject: [PATCH 06/71] condition --- source/dnode/mnode/impl/src/mndUser.c | 185 +++++++++++++++++++++++--- 1 file changed, 166 insertions(+), 19 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 2e50e3430a..0aaec72d59 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -130,9 +130,36 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { int32_t numOfTopics = taosHashGetSize(pUser->topics); int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs ) * TSDB_DB_FNAME_LEN + - (numOfReadStbs + numOfWriteStbs) * TSDB_TABLE_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN; + char *stb = taosHashIterate(pUser->readStbs, NULL); + while (stb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(stb, &keyLen); + size += sizeof(int32_t); + size += keyLen; + + size_t valueLen = 0; + valueLen = strlen(stb); + size += sizeof(int32_t); + size += valueLen; + stb = taosHashIterate(pUser->readStbs, stb); + } + + stb = taosHashIterate(pUser->writeStbs, NULL); + while (stb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(stb, &keyLen); + size += sizeof(int32_t); + size += keyLen; + + size_t valueLen = 0; + valueLen = strlen(stb); + size += sizeof(int32_t); + size += keyLen; + stb = taosHashIterate(pUser->writeStbs, stb); + } + SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size); if (pRaw == NULL) goto _OVER; @@ -171,15 +198,31 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { topic = taosHashIterate(pUser->topics, topic); } - char *stb = taosHashIterate(pUser->readStbs, NULL); + stb = taosHashIterate(pUser->readStbs, NULL); while (stb != NULL) { - SDB_SET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER); + size_t keyLen = 0; + void *key = taosHashGetKey(stb, &keyLen); + SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER) + SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + size_t valueLen = 0; + valueLen = strlen(stb); + SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) + SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); stb = taosHashIterate(pUser->readStbs, stb); } stb = taosHashIterate(pUser->writeStbs, NULL); while (stb != NULL) { - SDB_SET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER); + size_t keyLen = 0; + void *key = taosHashGetKey(stb, &keyLen); + SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER) + SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + size_t valueLen = 0; + valueLen = strlen(stb); + SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) + SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); stb = taosHashIterate(pUser->writeStbs, stb); } @@ -279,17 +322,39 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if(sver >= 3){ for (int32_t i = 0; i < numOfReadStbs; ++i) { - char stb[TSDB_TABLE_FNAME_LEN] = {0}; - SDB_GET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER) - int32_t len = strlen(stb) + 1; - taosHashPut(pUser->readStbs, stb, len, stb, TSDB_DB_FNAME_LEN); + int32_t keyLen = 0; + SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); + + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + int32_t valuelen = 0; + SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) + + taosHashPut(pUser->readStbs, key, keyLen, value, valuelen); + + taosMemoryFree(key); + taosMemoryFree(value); } for (int32_t i = 0; i < numOfWriteStbs; ++i) { - char stb[TSDB_TABLE_FNAME_LEN] = {0}; - SDB_GET_BINARY(pRaw, dataPos, stb, TSDB_TABLE_FNAME_LEN, _OVER) - int32_t len = strlen(stb) + 1; - taosHashPut(pUser->writeStbs, stb, len, stb, TSDB_TABLE_FNAME_LEN); + int32_t keyLen = 0; + SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); + + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + int32_t valuelen = 0; + SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) + + taosHashPut(pUser->writeStbs, key, keyLen, value, valuelen); + + taosMemoryFree(key); + taosMemoryFree(value); } } @@ -755,6 +820,48 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { taosHashPut(newUser.topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN); } + if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if(alterReq.tagCond == NULL){ + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + int32_t condLen = strlen(alterReq.tagCond); + if (taosHashPut(newUser.readStbs, tbFName, len, alterReq.tagCond, strlen(alterReq.tagCond)) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } + + if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if(alterReq.tagCond == NULL){ + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + int32_t condLen = strlen(alterReq.tagCond); + if (taosHashPut(newUser.writeStbs, tbFName, len, alterReq.tagCond, condLen) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) { int32_t len = strlen(alterReq.objname) + 1; SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname); @@ -1037,12 +1144,32 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock STR_WITH_MAXSIZE_TO_VARSTR(privilege, "read", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); + + size_t superTableLen = 0; + void *superTable = taosHashGetKey(stb, &superTableLen); + char objName[TSDB_TABLE_NAME_LEN] = {0}; + mndExtractTbNameFromStbFullName(superTable, objName, TSDB_TABLE_NAME_LEN); + + SNode *pAst = NULL; + int32_t code = nodesStringToNode(stb, &pAst); + + char *buf = taosMemoryCalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE, sizeof(char)); + int32_t sqlLen = 0; + nodesNodeToSQL(pAst, buf, TSDB_EXPLAIN_RESULT_ROW_SIZE * sizeof(char), &sqlLen); + + char *value = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + 1, sizeof(char)); + + sprintf(value, "%s(%s)", objName, buf); + + char *obj = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE + 1, sizeof(char)); + STR_WITH_MAXSIZE_TO_VARSTR(obj, value, pShow->pMeta->pSchemas[cols].bytes); - char objName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; - mndExtractTbNameFromStbFullName(stb, &objName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); - varDataSetLen(objName, strlen(&objName[VARSTR_HEADER_SIZE])); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + colDataSetVal(pColInfo, numOfRows, (const char *)obj, false); + + taosMemoryFree(value); + taosMemoryFree(buf); + taosMemoryFree(obj); numOfRows++; stb = taosHashIterate(pUser->readStbs, stb); @@ -1061,11 +1188,31 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); + size_t superTableLen = 0; + void *superTable = taosHashGetKey(stb, &superTableLen); char objName[TSDB_TABLE_NAME_LEN] = {0}; - mndExtractTbNameFromStbFullName(stb, &objName[VARSTR_HEADER_SIZE], TSDB_TABLE_NAME_LEN); - varDataSetLen(objName, strlen(&objName[VARSTR_HEADER_SIZE])); + mndExtractTbNameFromStbFullName(superTable, objName, TSDB_TABLE_NAME_LEN); + + SNode *pAst = NULL; + int32_t code = nodesStringToNode(stb, &pAst); + + char *buf = taosMemoryCalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE, sizeof(char)); + int32_t sqlLen = 0; + nodesNodeToSQL(pAst, buf, TSDB_EXPLAIN_RESULT_ROW_SIZE * sizeof(char), &sqlLen); + + char *value = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + 1, sizeof(char)); + + sprintf(value, "%s(%s)", objName, buf); + + char *obj = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE + 1, sizeof(char)); + STR_WITH_MAXSIZE_TO_VARSTR(obj, value, pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + colDataSetVal(pColInfo, numOfRows, (const char *)obj, false); + + taosMemoryFree(value); + taosMemoryFree(buf); + taosMemoryFree(obj); numOfRows++; stb = taosHashIterate(pUser->writeStbs, stb); From 22b87dc26cadeefa9f9a0779612e6988083bb1cd Mon Sep 17 00:00:00 2001 From: cademfly Date: Wed, 29 Mar 2023 20:29:17 +0800 Subject: [PATCH 07/71] UserAuthRsp --- source/common/src/tmsg.c | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a2c3919b1c..30bf900803 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1445,9 +1445,14 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs); int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs); + int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs); + int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs); + if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1; + if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1; + if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1; char *db = taosHashIterate(pRsp->createdDbs, NULL); while (db != NULL) { @@ -1467,6 +1472,36 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) db = taosHashIterate(pRsp->writeDbs, db); } + char *tb = taosHashIterate(pRsp->readTbs, NULL); + while (tb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(tb, &keyLen); + if (tEncodeI32(pEncoder, keyLen) < 0) return -1; + if (tEncodeCStr(pEncoder, key) < 0) return -1; + + size_t valueLen = 0; + valueLen = strlen(tb); + if (tEncodeI32(pEncoder, valueLen) < 0) return -1; + if (tEncodeCStr(pEncoder, tb) < 0) return -1; + + tb = taosHashIterate(pRsp->readTbs, tb); + } + + tb = taosHashIterate(pRsp->writeTbs, NULL); + while (tb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(tb, &keyLen); + if (tEncodeI32(pEncoder, keyLen) < 0) return -1; + if (tEncodeCStr(pEncoder, key) < 0) return -1; + + size_t valueLen = 0; + valueLen = strlen(tb); + if (tEncodeI32(pEncoder, valueLen) < 0) return -1; + if (tEncodeCStr(pEncoder, tb) < 0) return -1; + + tb = taosHashIterate(pRsp->writeTbs, tb); + } + return 0; } @@ -1503,9 +1538,13 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs int32_t numOfCreatedDbs = 0; int32_t numOfReadDbs = 0; int32_t numOfWriteDbs = 0; + int32_t numOfReadTbs = 0; + int32_t numOfWriteTbs = 0; if (tDecodeI32(pDecoder, &numOfCreatedDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfReadDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfWriteDbs) < 0) return -1; + if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1; + if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1; for (int32_t i = 0; i < numOfCreatedDbs; ++i) { char db[TSDB_DB_FNAME_LEN] = {0}; @@ -1528,6 +1567,42 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs taosHashPut(pRsp->writeDbs, db, len, db, len); } + for (int32_t i = 0; i < numOfReadTbs; ++i) { + int32_t keyLen = 0; + if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; + + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, key) < 0) return -1; + + int32_t valuelen = 0; + if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, value) < 0) return -1; + + taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen); + + taosMemoryFree(key); + taosMemoryFree(value); + } + + for (int32_t i = 0; i < numOfWriteTbs; ++i) { + int32_t keyLen = 0; + if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; + + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, key) < 0) return -1; + + int32_t valuelen = 0; + if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, value) < 0) return -1; + + taosHashPut(pRsp->writeTbs, key, keyLen, value, valuelen); + + taosMemoryFree(key); + taosMemoryFree(value); + } + return 0; } From 824c87a6c7bc61f42d1798083ac38d35e90a6e15 Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 13:59:48 +0800 Subject: [PATCH 08/71] binary format --- source/dnode/mnode/impl/inc/mndDef.h | 4 +- source/dnode/mnode/impl/src/mndUser.c | 315 +++++++++++++++----------- 2 files changed, 190 insertions(+), 129 deletions(-) diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index 2d06c42a43..1b60c0a95e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -280,8 +280,8 @@ typedef struct { SHashObj* readDbs; SHashObj* writeDbs; SHashObj* topics; - SHashObj* readStbs; - SHashObj* writeStbs; + SHashObj* readTbs; + SHashObj* writeTbs; SRWLatch lock; } SUserObj; diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 0aaec72d59..0ee3e5d1d0 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -125,14 +125,14 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs); - int32_t numOfReadStbs = taosHashGetSize(pUser->readStbs); - int32_t numOfWriteStbs = taosHashGetSize(pUser->writeStbs); + int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs); + int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs); int32_t numOfTopics = taosHashGetSize(pUser->topics); int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs ) * TSDB_DB_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN; - char *stb = taosHashIterate(pUser->readStbs, NULL); + char *stb = taosHashIterate(pUser->readTbs, NULL); while (stb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(stb, &keyLen); @@ -143,10 +143,10 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { valueLen = strlen(stb); size += sizeof(int32_t); size += valueLen; - stb = taosHashIterate(pUser->readStbs, stb); + stb = taosHashIterate(pUser->readTbs, stb); } - stb = taosHashIterate(pUser->writeStbs, NULL); + stb = taosHashIterate(pUser->writeTbs, NULL); while (stb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(stb, &keyLen); @@ -157,7 +157,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { valueLen = strlen(stb); size += sizeof(int32_t); size += keyLen; - stb = taosHashIterate(pUser->writeStbs, stb); + stb = taosHashIterate(pUser->writeTbs, stb); } SSdbRaw *pRaw = sdbAllocRaw(SDB_USER, USER_VER_NUMBER, size); @@ -198,7 +198,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { topic = taosHashIterate(pUser->topics, topic); } - stb = taosHashIterate(pUser->readStbs, NULL); + stb = taosHashIterate(pUser->readTbs, NULL); while (stb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(stb, &keyLen); @@ -206,13 +206,13 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); size_t valueLen = 0; - valueLen = strlen(stb); + valueLen = strlen(stb)+1; SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); - stb = taosHashIterate(pUser->readStbs, stb); + stb = taosHashIterate(pUser->readTbs, stb); } - stb = taosHashIterate(pUser->writeStbs, NULL); + stb = taosHashIterate(pUser->writeTbs, NULL); while (stb != NULL) { size_t keyLen = 0; void *key = taosHashGetKey(stb, &keyLen); @@ -220,10 +220,10 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); size_t valueLen = 0; - valueLen = strlen(stb); + valueLen = strlen(stb)+1; SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); - stb = taosHashIterate(pUser->writeStbs, stb); + stb = taosHashIterate(pUser->writeTbs, stb); } SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) @@ -292,8 +292,8 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { pUser->writeDbs = taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - pUser->readStbs = taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - pUser->writeStbs = + pUser->readTbs = taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->writeTbs = taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER; @@ -325,15 +325,17 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t keyLen = 0; SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); - char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + char *key = taosMemoryCalloc(keyLen, sizeof(char)); + memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); - char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + char *value = taosMemoryCalloc(valuelen, sizeof(char)); + memset(value, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) - taosHashPut(pUser->readStbs, key, keyLen, value, valuelen); + taosHashPut(pUser->readTbs, key, keyLen, value, valuelen); taosMemoryFree(key); taosMemoryFree(value); @@ -343,15 +345,17 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t keyLen = 0; SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); - char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + char *key = taosMemoryCalloc(keyLen, sizeof(char)); + memset(key, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); int32_t valuelen = 0; SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); - char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + char *value = taosMemoryCalloc(valuelen, sizeof(char)); + memset(value, 0, keyLen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) - taosHashPut(pUser->writeStbs, key, keyLen, value, valuelen); + taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen); taosMemoryFree(key); taosMemoryFree(value); @@ -370,8 +374,8 @@ _OVER: taosHashCleanup(pUser->readDbs); taosHashCleanup(pUser->writeDbs); taosHashCleanup(pUser->topics); - taosHashCleanup(pUser->readStbs); - taosHashCleanup(pUser->writeStbs); + taosHashCleanup(pUser->readTbs); + taosHashCleanup(pUser->writeTbs); } taosMemoryFreeClear(pRow); return NULL; @@ -404,8 +408,8 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { taosRLockLatch(&pUser->lock); pNew->readDbs = mndDupDbHash(pUser->readDbs); pNew->writeDbs = mndDupDbHash(pUser->writeDbs); - pNew->readStbs = mndDupTopicHash(pUser->readStbs); - pNew->writeStbs = mndDupTopicHash(pUser->writeStbs); + pNew->readTbs = mndDupTopicHash(pUser->readTbs); + pNew->writeTbs = mndDupTopicHash(pUser->writeTbs); pNew->topics = mndDupTopicHash(pUser->topics); taosRUnLockLatch(&pUser->lock); @@ -419,13 +423,13 @@ static void mndUserFreeObj(SUserObj *pUser) { taosHashCleanup(pUser->readDbs); taosHashCleanup(pUser->writeDbs); taosHashCleanup(pUser->topics); - taosHashCleanup(pUser->readStbs); - taosHashCleanup(pUser->writeStbs); + taosHashCleanup(pUser->readTbs); + taosHashCleanup(pUser->writeTbs); pUser->readDbs = NULL; pUser->writeDbs = NULL; pUser->topics = NULL; - pUser->readStbs = NULL; - pUser->writeStbs = NULL; + pUser->readTbs = NULL; + pUser->writeTbs = NULL; } static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) { @@ -445,8 +449,8 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { TSWAP(pOld->readDbs, pNew->readDbs); TSWAP(pOld->writeDbs, pNew->writeDbs); TSWAP(pOld->topics, pNew->topics); - TSWAP(pOld->readStbs, pNew->readStbs); - TSWAP(pOld->writeStbs, pNew->writeStbs); + TSWAP(pOld->readTbs, pNew->readTbs); + TSWAP(pOld->writeTbs, pNew->writeTbs); taosWUnLockLatch(&pOld->lock); return 0; @@ -767,7 +771,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { mndReleaseStb(pMnode, pStb); goto _OVER; } - if (taosHashPut(newUser.readStbs, tbFName, len, tbFName, TSDB_TABLE_NAME_LEN) != 0) { + if (taosHashPut(newUser.readTbs, tbFName, len, tbFName, len) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; } @@ -777,7 +781,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); if (pIter == NULL) break; int32_t len = strlen(pStb->name) + 1; - taosHashPut(newUser.readStbs, pStb->name, len, pStb->name, TSDB_TABLE_NAME_LEN); + taosHashPut(newUser.readTbs, pStb->name, len, pStb->name, len); sdbRelease(pSdb, pStb); } } @@ -794,7 +798,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { mndReleaseStb(pMnode, pStb); goto _OVER; } - if (taosHashPut(newUser.writeStbs, tbFName, len, tbFName, TSDB_TABLE_NAME_LEN) != 0) { + if (taosHashPut(newUser.writeTbs, tbFName, len, tbFName, len) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; } @@ -804,12 +808,85 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); if (pIter == NULL) break; int32_t len = strlen(pStb->name) + 1; - taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); + taosHashPut(newUser.writeTbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); sdbRelease(pSdb, pStb); } } } + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || + alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG || + alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { + if (strcmp(alterReq.objname, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if (taosHashRemove(newUser.readTbs, tbFName, len) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + + if(strcmp(pStb->db, alterReq.objname) == 0){ + if (taosHashRemove(newUser.readTbs, pStb->name, len) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } + + //taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); + //sdbRelease(pSdb, pStb); + } + + //taosHashClear(newUser.readStbs); + } + } + + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || + alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG || + alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { + if (strcmp(alterReq.objname, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); + + int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + if (taosHashRemove(newUser.writeTbs, tbFName, len) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + + if(strcmp(pStb->db, alterReq.objname) == 0){ + if (taosHashRemove(newUser.writeTbs, pStb->name, len) != 0) { + mndReleaseStb(pMnode, pStb); + goto _OVER; + } + } + } + } + } + if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { int32_t len = strlen(alterReq.objname) + 1; SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname); @@ -822,9 +899,9 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) { char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - + snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq.objname, alterReq.tabName); int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); if (pStb == NULL) { mndReleaseStb(pMnode, pStb); @@ -834,8 +911,9 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { mndReleaseStb(pMnode, pStb); goto _OVER; } - int32_t condLen = strlen(alterReq.tagCond); - if (taosHashPut(newUser.readStbs, tbFName, len, alterReq.tagCond, strlen(alterReq.tagCond)) != 0) { + + int32_t condLen = strlen(alterReq.tagCond) + 1; + if (taosHashPut(newUser.readTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; } @@ -844,8 +922,8 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) { char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - int32_t len = strlen(tbFName) + 1; + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); if (pStb == NULL) { mndReleaseStb(pMnode, pStb); @@ -855,8 +933,8 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { mndReleaseStb(pMnode, pStb); goto _OVER; } - int32_t condLen = strlen(alterReq.tagCond); - if (taosHashPut(newUser.writeStbs, tbFName, len, alterReq.tagCond, condLen) != 0) { + int32_t condLen = strlen(alterReq.tagCond) + 1; + if (taosHashPut(newUser.writeTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; } @@ -1045,6 +1123,71 @@ static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) { sdbCancelFetch(pSdb, pIter); } +static void mndLoopHash(SHashObj * hash, char *priType, SSDataBlock *pBlock, int32_t *numOfRows, char *user, SShowObj *pShow){ + char *value = taosHashIterate(hash, NULL); + int32_t cols = 0; + + while (value != NULL) { + cols = 0; + char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(userName, user, pShow->pMeta->pSchemas[cols].bytes); + SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)userName, false); + + char privilege[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(privilege, priType, pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)privilege, false); + + size_t keyLen = 0; + void *key = taosHashGetKey(value, &keyLen); + char tableName[TSDB_TABLE_NAME_LEN] = {0}; + mndExtractTbNameFromStbFullName(key, tableName, TSDB_TABLE_NAME_LEN); + + if(strcmp(key, value) == 0){ + char *obj = taosMemoryMalloc(TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(obj, tableName, pShow->pMeta->pSchemas[cols].bytes); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); + taosMemoryFree(obj); + } + else{ + SNode *pAst = NULL; + int32_t sqlLen = 0; + char *sql = NULL; + + if(nodesStringToNode(value, &pAst) == 0) { + sql = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); + nodesNodeToSQL(pAst, sql, TSDB_EXPLAIN_RESULT_ROW_SIZE, &sqlLen); + } + else{ + sqlLen = 5; + sql = taosMemoryMalloc(sqlLen + 1); + sprintf(sql, "error"); + } + + int32_t contentLen = sqlLen + TSDB_TABLE_NAME_LEN + 3; + char *content = taosMemoryMalloc(contentLen); + + if(sql != NULL){ + sprintf(content, "%s(%s)", tableName, sql); + taosMemoryFree(sql); + } + + char *obj = taosMemoryMalloc(contentLen + VARSTR_HEADER_SIZE); + STR_WITH_MAXSIZE_TO_VARSTR(obj, content, pShow->pMeta->pSchemas[cols].bytes); + taosMemoryFree(content); + + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); + taosMemoryFree(obj); + } + (*numOfRows)++; + value = taosHashIterate(hash, value); + } +} + static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -1132,91 +1275,9 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock db = taosHashIterate(pUser->writeDbs, db); } - char *stb = taosHashIterate(pUser->readStbs, NULL); - while (stb != NULL) { - cols = 0; - char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(userName, pUser->user, pShow->pMeta->pSchemas[cols].bytes); - SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)userName, false); + mndLoopHash(pUser->readTbs, "read", pBlock, &numOfRows, pUser->user, pShow); - char privilege[20] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(privilege, "read", pShow->pMeta->pSchemas[cols].bytes); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); - - size_t superTableLen = 0; - void *superTable = taosHashGetKey(stb, &superTableLen); - char objName[TSDB_TABLE_NAME_LEN] = {0}; - mndExtractTbNameFromStbFullName(superTable, objName, TSDB_TABLE_NAME_LEN); - - SNode *pAst = NULL; - int32_t code = nodesStringToNode(stb, &pAst); - - char *buf = taosMemoryCalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE, sizeof(char)); - int32_t sqlLen = 0; - nodesNodeToSQL(pAst, buf, TSDB_EXPLAIN_RESULT_ROW_SIZE * sizeof(char), &sqlLen); - - char *value = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + 1, sizeof(char)); - - sprintf(value, "%s(%s)", objName, buf); - - char *obj = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE + 1, sizeof(char)); - STR_WITH_MAXSIZE_TO_VARSTR(obj, value, pShow->pMeta->pSchemas[cols].bytes); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)obj, false); - - taosMemoryFree(value); - taosMemoryFree(buf); - taosMemoryFree(obj); - - numOfRows++; - stb = taosHashIterate(pUser->readStbs, stb); - } - - stb = taosHashIterate(pUser->writeStbs, NULL); - while (stb != NULL) { - cols = 0; - char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(userName, pUser->user, pShow->pMeta->pSchemas[cols].bytes); - SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)userName, false); - - char privilege[20] = {0}; - STR_WITH_MAXSIZE_TO_VARSTR(privilege, "write", pShow->pMeta->pSchemas[cols].bytes); - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)privilege, false); - - size_t superTableLen = 0; - void *superTable = taosHashGetKey(stb, &superTableLen); - char objName[TSDB_TABLE_NAME_LEN] = {0}; - mndExtractTbNameFromStbFullName(superTable, objName, TSDB_TABLE_NAME_LEN); - - SNode *pAst = NULL; - int32_t code = nodesStringToNode(stb, &pAst); - - char *buf = taosMemoryCalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE, sizeof(char)); - int32_t sqlLen = 0; - nodesNodeToSQL(pAst, buf, TSDB_EXPLAIN_RESULT_ROW_SIZE * sizeof(char), &sqlLen); - - char *value = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + 1, sizeof(char)); - - sprintf(value, "%s(%s)", objName, buf); - - char *obj = taosMemoryCalloc(sqlLen + TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE + 1, sizeof(char)); - STR_WITH_MAXSIZE_TO_VARSTR(obj, value, pShow->pMeta->pSchemas[cols].bytes); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, numOfRows, (const char *)obj, false); - - taosMemoryFree(value); - taosMemoryFree(buf); - taosMemoryFree(obj); - - numOfRows++; - stb = taosHashIterate(pUser->writeStbs, stb); - } + mndLoopHash(pUser->writeTbs, "write", pBlock, &numOfRows, pUser->user, pShow); char *topic = taosHashIterate(pUser->topics, NULL); while (topic != NULL) { @@ -1340,8 +1401,8 @@ int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db) { if (inRead || inWrite) { (void)taosHashRemove(newUser.readDbs, db, len); (void)taosHashRemove(newUser.writeDbs, db, len); - (void)taosHashRemove(newUser.readStbs, db, len); - (void)taosHashRemove(newUser.writeStbs, db, len); + (void)taosHashRemove(newUser.readTbs, db, len); + (void)taosHashRemove(newUser.writeTbs, db, len); SSdbRaw *pCommitRaw = mndUserActionEncode(&newUser); if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) break; From b528cb0561831983dbea99f8c227e7e6149e98b7 Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 15:13:09 +0800 Subject: [PATCH 09/71] fix dup hash --- source/dnode/mnode/impl/src/mndUser.c | 37 +++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 0ee3e5d1d0..9be18a7c70 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -400,6 +400,32 @@ static int32_t mndUserActionInsert(SSdb *pSdb, SUserObj *pUser) { return 0; } +SHashObj *mndDupTableHash(SHashObj *pOld) { + SHashObj *pNew = + taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (pNew == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + char *tb = taosHashIterate(pOld, NULL); + while (tb != NULL) { + size_t keyLen = 0; + char *key = taosHashGetKey(tb, &keyLen); + + int32_t valueLen = strlen(tb) + 1; + if (taosHashPut(pNew, key, keyLen, tb, valueLen) != 0) { + taosHashCancelIterate(pOld, tb); + taosHashCleanup(pNew); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + tb = taosHashIterate(pOld, tb); + } + + return pNew; +} + static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { memcpy(pNew, pUser, sizeof(SUserObj)); pNew->authVersion++; @@ -408,8 +434,8 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { taosRLockLatch(&pUser->lock); pNew->readDbs = mndDupDbHash(pUser->readDbs); pNew->writeDbs = mndDupDbHash(pUser->writeDbs); - pNew->readTbs = mndDupTopicHash(pUser->readTbs); - pNew->writeTbs = mndDupTopicHash(pUser->writeTbs); + pNew->readTbs = mndDupTableHash(pUser->readTbs); + pNew->writeTbs = mndDupTableHash(pUser->writeTbs); pNew->topics = mndDupTopicHash(pUser->topics); taosRUnLockLatch(&pUser->lock); @@ -826,7 +852,8 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (pStb == NULL) { mndReleaseStb(pMnode, pStb); goto _OVER; - } + } + if (taosHashRemove(newUser.readTbs, tbFName, len) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; @@ -912,7 +939,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { goto _OVER; } - int32_t condLen = strlen(alterReq.tagCond) + 1; + int32_t condLen = alterReq.tagCondLen + 1; if (taosHashPut(newUser.readTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; @@ -933,7 +960,7 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { mndReleaseStb(pMnode, pStb); goto _OVER; } - int32_t condLen = strlen(alterReq.tagCond) + 1; + int32_t condLen = alterReq.tagCondLen + 1; if (taosHashPut(newUser.writeTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { mndReleaseStb(pMnode, pStb); goto _OVER; From dbc75feac39af1cf199071c7d7481694734d66a6 Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 15:56:08 +0800 Subject: [PATCH 10/71] normal table --- include/util/taoserror.h | 1 + source/dnode/mnode/impl/src/mndUser.c | 144 +++++++++++--------------- source/util/src/terror.c | 1 + 3 files changed, 61 insertions(+), 85 deletions(-) diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 6489304bda..5629054720 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -241,6 +241,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_MND_INVALID_ALTER_OPER TAOS_DEF_ERROR_CODE(0, 0x0356) #define TSDB_CODE_MND_AUTH_FAILURE TAOS_DEF_ERROR_CODE(0, 0x0357) #define TSDB_CODE_MND_USER_NOT_AVAILABLE TAOS_DEF_ERROR_CODE(0, 0x0358) +#define TSDB_CODE_MND_PRIVILEDGE_EXIST TAOS_DEF_ERROR_CODE(0, 0x0359) // mnode-stable-part1 #define TSDB_CODE_MND_STB_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0360) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 9be18a7c70..c1ce147444 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -647,6 +647,61 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); } +static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq){ + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq->objname, alterReq->tabName); + int32_t len = strlen(tbFName) + 1; + + SStbObj *pStb = mndAcquireStb(pMnode, tbFName); + if (pStb == NULL) { + mndReleaseStb(pMnode, pStb); + return -1; + } + if(alterReq->tagCond == NULL){ + mndReleaseStb(pMnode, pStb); + return -1; + } + + char *value = taosHashGet(hash, tbFName, len); + if(value != NULL){ + mndReleaseStb(pMnode, pStb); + terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST; + return -1; + } + + int32_t condLen = alterReq->tagCondLen + 1; + if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { + mndReleaseStb(pMnode, pStb); + return -1; + } + mndReleaseStb(pMnode, pStb); + return 0; +} + +static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ + void *pIter = NULL; + + if (strcmp(alterReq->tabName, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + int32_t len = strlen(tbFName) + 1; + + if (taosHashPut(hash, tbFName, len, tbFName, len) != 0) { + return -1; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + taosHashPut(hash, pStb->name, len, pStb->name, len); + sdbRelease(pSdb, pStb); + } + } + return 0; +} + static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -787,57 +842,11 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { - if (strcmp(alterReq.tabName, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - - int32_t len = strlen(tbFName) + 1; - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - if (taosHashPut(newUser.readTbs, tbFName, len, tbFName, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; - taosHashPut(newUser.readTbs, pStb->name, len, pStb->name, len); - sdbRelease(pSdb, pStb); - } - } + if(mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { - if (strcmp(alterReq.tabName, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - - int32_t len = strlen(tbFName) + 1; - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - if (taosHashPut(newUser.writeTbs, tbFName, len, tbFName, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; - taosHashPut(newUser.writeTbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); - sdbRelease(pSdb, pStb); - } - } + if(mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || @@ -925,46 +934,11 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq.objname, alterReq.tabName); - int32_t len = strlen(tbFName) + 1; - - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - if(alterReq.tagCond == NULL){ - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - - int32_t condLen = alterReq.tagCondLen + 1; - if (taosHashPut(newUser.readTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } + if(mndTagPriviledge(pMnode, newUser.readTbs, &alterReq) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - int32_t len = strlen(tbFName) + 1; - - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - if(alterReq.tagCond == NULL){ - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - int32_t condLen = alterReq.tagCondLen + 1; - if (taosHashPut(newUser.writeTbs, tbFName, len, alterReq.tagCond, condLen) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } + if(mndTagPriviledge(pMnode, newUser.writeTbs, &alterReq) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) { diff --git a/source/util/src/terror.c b/source/util/src/terror.c index b84d58bfe8..c7ef5d8291 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -190,6 +190,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_NO_USER_FROM_CONN, "Can not get user from TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_USERS, "Too many users") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_ALTER_OPER, "Invalid alter operation") TAOS_DEFINE_ERROR(TSDB_CODE_MND_AUTH_FAILURE, "Authentication failure") +TAOS_DEFINE_ERROR(TSDB_CODE_MND_PRIVILEDGE_EXIST, "User already have this priviledge") //mnode-stable-part1 TAOS_DEFINE_ERROR(TSDB_CODE_MND_STB_ALREADY_EXIST, "STable already exists") From 38b6bfd8481f385a2eaf1a0bb9d6b7332e17381c Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 16:10:34 +0800 Subject: [PATCH 11/71] remove normal table priviledge --- source/dnode/mnode/impl/src/mndUser.c | 99 ++++++++++----------------- 1 file changed, 35 insertions(+), 64 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index c1ce147444..56f4a629ef 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -702,6 +702,39 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq return 0; } +static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ + void *pIter = NULL; + if (strcmp(alterReq->objname, "1.*") != 0) { + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + int32_t len = strlen(tbFName) + 1; + + if (taosHashRemove(hash, tbFName, len) != 0) { + return -1; + } + } else { + while (1) { + SStbObj *pStb = NULL; + pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); + if (pIter == NULL) break; + int32_t len = strlen(pStb->name) + 1; + + if(strcmp(pStb->db, alterReq->objname) == 0){ + if (taosHashRemove(hash, pStb->name, len) != 0) { + mndReleaseStb(pMnode, pStb); + return -1; + } + } + + //taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); + //sdbRelease(pSdb, pStb); + } + + //taosHashClear(newUser.readStbs); + } + return 0; +} + static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; SSdb *pSdb = pMnode->pSdb; @@ -852,75 +885,13 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG || alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { - if (strcmp(alterReq.objname, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - - int32_t len = strlen(tbFName) + 1; - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - - if (taosHashRemove(newUser.readTbs, tbFName, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; - - if(strcmp(pStb->db, alterReq.objname) == 0){ - if (taosHashRemove(newUser.readTbs, pStb->name, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } - - //taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); - //sdbRelease(pSdb, pStb); - } - - //taosHashClear(newUser.readStbs); - } + if(mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG || alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { - if (strcmp(alterReq.objname, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq.objname, alterReq.tabName); - - int32_t len = strlen(tbFName) + 1; - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - if (taosHashRemove(newUser.writeTbs, tbFName, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; - - if(strcmp(pStb->db, alterReq.objname) == 0){ - if (taosHashRemove(newUser.writeTbs, pStb->name, len) != 0) { - mndReleaseStb(pMnode, pStb); - goto _OVER; - } - } - } - } + if(mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { From 3ae4996458a3652bc7c2a6916f6397408ba580ef Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 16:17:51 +0800 Subject: [PATCH 12/71] remove all handle --- include/common/tmsg.h | 10 ++--- source/dnode/mnode/impl/src/mndUser.c | 64 +++++++-------------------- 2 files changed, 20 insertions(+), 54 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 496af6d881..a9923e4e48 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -181,12 +181,10 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE #define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF #define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10 -#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x11 -#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x12 -#define TSDB_ALTER_USER_ADD_READ_TAG 0x13 -#define TSDB_ALTER_USER_REMOVE_READ_TAG 0x14 -#define TSDB_ALTER_USER_ADD_WRITE_TAG 0x15 -#define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x16 +#define TSDB_ALTER_USER_ADD_READ_TAG 0x11 +#define TSDB_ALTER_USER_REMOVE_READ_TAG 0x12 +#define TSDB_ALTER_USER_ADD_WRITE_TAG 0x13 +#define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x14 #define TSDB_ALTER_USER_PRIVILEGES 0x2 diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 56f4a629ef..9f1732da2e 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -680,58 +680,28 @@ static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *a static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ void *pIter = NULL; + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - if (strcmp(alterReq->tabName, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); - int32_t len = strlen(tbFName) + 1; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + int32_t len = strlen(tbFName) + 1; - if (taosHashPut(hash, tbFName, len, tbFName, len) != 0) { - return -1; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; - taosHashPut(hash, pStb->name, len, pStb->name, len); - sdbRelease(pSdb, pStb); - } + if (taosHashPut(hash, tbFName, len, tbFName, len) != 0) { + return -1; } + return 0; } static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ void *pIter = NULL; - if (strcmp(alterReq->objname, "1.*") != 0) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); - int32_t len = strlen(tbFName) + 1; + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; + snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); + int32_t len = strlen(tbFName) + 1; - if (taosHashRemove(hash, tbFName, len) != 0) { - return -1; - } - } else { - while (1) { - SStbObj *pStb = NULL; - pIter = sdbFetch(pSdb, SDB_STB, pIter, (void **)&pStb); - if (pIter == NULL) break; - int32_t len = strlen(pStb->name) + 1; + if (taosHashRemove(hash, tbFName, len) != 0) { + return -1; + } - if(strcmp(pStb->db, alterReq->objname) == 0){ - if (taosHashRemove(hash, pStb->name, len) != 0) { - mndReleaseStb(pMnode, pStb); - return -1; - } - } - - //taosHashPut(newUser.writeStbs, pStb->name, len, pStb->name, TSDB_DB_FNAME_LEN); - //sdbRelease(pSdb, pStb); - } - - //taosHashClear(newUser.readStbs); - } return 0; } @@ -874,23 +844,21 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } } - if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { + if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) { if(mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } - if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE || alterReq.alterType == TSDB_ALTER_USER_ADD_ALL_TABLE) { + if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) { if(mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { + alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG) { if(mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_ALL_TABLE) { + alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG ) { if(mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } From db725c6f6d69d7685c04ea334d1ef603d3a4fd72 Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 18:53:50 +0800 Subject: [PATCH 13/71] show priviledge format --- include/util/tdef.h | 1 + source/common/src/systable.c | 4 +- source/dnode/mnode/impl/inc/mndStb.h | 1 + source/dnode/mnode/impl/src/mndStb.c | 7 ++ source/dnode/mnode/impl/src/mndUser.c | 94 ++++++++++++++++++++------- 5 files changed, 81 insertions(+), 26 deletions(-) diff --git a/include/util/tdef.h b/include/util/tdef.h index b5b2d7817e..f50f7c8787 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -198,6 +198,7 @@ typedef enum ELogicConditionType { #define TSDB_STREAM_NAME_LEN 193 // it is a null-terminated string #define TSDB_DB_NAME_LEN 65 #define TSDB_DB_FNAME_LEN (TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN + TSDB_NAME_DELIMITER_LEN) +#define TSDB_PRIVILEDGE_CONDITION_LEN 200 #define TSDB_FUNC_NAME_LEN 65 #define TSDB_FUNC_COMMENT_LEN 1024 * 1024 diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 919a09962b..69f2634929 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -296,7 +296,9 @@ static const SSysDbTableSchema vnodesSchema[] = { static const SSysDbTableSchema userUserPrivilegesSchema[] = { {.name = "user_name", .bytes = TSDB_USER_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, {.name = "privilege", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, - {.name = "object_name", .bytes = TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "db_name", .bytes = TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "table_name", .bytes = TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, + {.name = "condition", .bytes = TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false}, }; static const SSysTableMeta infosMeta[] = { diff --git a/source/dnode/mnode/impl/inc/mndStb.h b/source/dnode/mnode/impl/inc/mndStb.h index ac0924aab9..66d0ed1d12 100644 --- a/source/dnode/mnode/impl/inc/mndStb.h +++ b/source/dnode/mnode/impl/inc/mndStb.h @@ -38,6 +38,7 @@ void mndFreeStb(SStbObj *pStb); int32_t mndBuildSMCreateStbRsp(SMnode *pMnode, char *dbFName, char *stbFName, void **pCont, int32_t *pLen); void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst); +void mndExtractShortDbNameFromStbFullName(const char *stbFullName, char *dst); void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize); const char *mndGetStbStr(const char *src); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index c577097644..c800a852c9 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -2613,6 +2613,13 @@ void mndExtractDbNameFromStbFullName(const char *stbFullName, char *dst) { tNameGetFullDbName(&name, dst); } +void mndExtractShortDbNameFromStbFullName(const char *stbFullName, char *dst) { + SName name = {0}; + tNameFromString(&name, stbFullName, T_NAME_ACCT | T_NAME_DB | T_NAME_TABLE); + + tNameGetDbName(&name, dst); +} + void mndExtractTbNameFromStbFullName(const char *stbFullName, char *dst, int32_t dstSize) { int32_t pos = -1; int32_t num = 0; diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 9f1732da2e..29fd99614b 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -1081,48 +1081,50 @@ static void mndLoopHash(SHashObj * hash, char *priType, SSDataBlock *pBlock, int size_t keyLen = 0; void *key = taosHashGetKey(value, &keyLen); + + char dbName[TSDB_DB_NAME_LEN] = {0}; + mndExtractShortDbNameFromStbFullName(key, dbName); + char dbNameContent[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(dbNameContent, dbName, pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)dbNameContent, false); + char tableName[TSDB_TABLE_NAME_LEN] = {0}; mndExtractTbNameFromStbFullName(key, tableName, TSDB_TABLE_NAME_LEN); + char tableNameContent[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(tableNameContent, tableName, pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)tableNameContent, false); - if(strcmp(key, value) == 0){ - char *obj = taosMemoryMalloc(TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE); - STR_WITH_MAXSIZE_TO_VARSTR(obj, tableName, pShow->pMeta->pSchemas[cols].bytes); - - pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); - colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); - taosMemoryFree(obj); - } - else{ + if(strcmp(key, value)!= 0){ SNode *pAst = NULL; int32_t sqlLen = 0; - char *sql = NULL; + char sql[TSDB_EXPLAIN_RESULT_ROW_SIZE] = {0}; if(nodesStringToNode(value, &pAst) == 0) { - sql = taosMemoryMalloc(TSDB_EXPLAIN_RESULT_ROW_SIZE); nodesNodeToSQL(pAst, sql, TSDB_EXPLAIN_RESULT_ROW_SIZE, &sqlLen); + nodesDestroyNode(pAst); } else{ sqlLen = 5; - sql = taosMemoryMalloc(sqlLen + 1); sprintf(sql, "error"); } - int32_t contentLen = sqlLen + TSDB_TABLE_NAME_LEN + 3; - char *content = taosMemoryMalloc(contentLen); - - if(sql != NULL){ - sprintf(content, "%s(%s)", tableName, sql); - taosMemoryFree(sql); - } - - char *obj = taosMemoryMalloc(contentLen + VARSTR_HEADER_SIZE); - STR_WITH_MAXSIZE_TO_VARSTR(obj, content, pShow->pMeta->pSchemas[cols].bytes); - taosMemoryFree(content); + //char *obj = taosMemoryMalloc(sqlLen + VARSTR_HEADER_SIZE + 1); + char obj[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(obj, sql, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); - taosMemoryFree(obj); + //taosMemoryFree(obj); } + else{ + char condition[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, *numOfRows, (const char *)condition, false); + } + (*numOfRows)++; value = taosHashIterate(hash, value); } @@ -1143,7 +1145,9 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs); int32_t numOfTopics = taosHashGetSize(pUser->topics); - if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics >= rows) break; + int32_t numOfReadTbs = taosHashGetSize(pUser->readTbs); + int32_t numOfWriteTbs = taosHashGetSize(pUser->writeTbs); + if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs >= rows) break; if (pUser->superUser) { cols = 0; @@ -1162,6 +1166,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + char tableName[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); + + char condition[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); + numOfRows++; } @@ -1186,6 +1200,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + char tableName[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); + + char condition[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); + numOfRows++; db = taosHashIterate(pUser->readDbs, db); } @@ -1211,6 +1235,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); + char tableName[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); + + char condition[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); + numOfRows++; db = taosHashIterate(pUser->writeDbs, db); } @@ -1238,6 +1272,16 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)topicName, false); + char tableName[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); + + char condition[20] = {0}; + STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); + pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); + colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); + numOfRows++; topic = taosHashIterate(pUser->topics, topic); } From 7342bde45d747550ed992229ede35eb16fa92bbc Mon Sep 17 00:00:00 2001 From: cademfly Date: Thu, 30 Mar 2023 19:03:28 +0800 Subject: [PATCH 14/71] fake empty hash mark --- source/dnode/mnode/impl/src/mndUser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 29fd99614b..bebf57a55e 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -685,7 +685,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; - if (taosHashPut(hash, tbFName, len, tbFName, len) != 0) { + if (taosHashPut(hash, tbFName, len, "t", 2) != 0) { return -1; } @@ -1096,7 +1096,7 @@ static void mndLoopHash(SHashObj * hash, char *priType, SSDataBlock *pBlock, int pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)tableNameContent, false); - if(strcmp(key, value)!= 0){ + if(strcmp("t", value) != 0){ SNode *pAst = NULL; int32_t sqlLen = 0; char sql[TSDB_EXPLAIN_RESULT_ROW_SIZE] = {0}; From d85d1bf58e5f75f314328e68c4aae61fdc7eff48 Mon Sep 17 00:00:00 2001 From: cademfly Date: Fri, 31 Mar 2023 10:04:03 +0800 Subject: [PATCH 15/71] add new dup fun --- source/dnode/mnode/impl/inc/mndUser.h | 1 + 1 file changed, 1 insertion(+) diff --git a/source/dnode/mnode/impl/inc/mndUser.h b/source/dnode/mnode/impl/inc/mndUser.h index 8943ba703e..95d15f6e5a 100644 --- a/source/dnode/mnode/impl/inc/mndUser.h +++ b/source/dnode/mnode/impl/inc/mndUser.h @@ -31,6 +31,7 @@ void mndReleaseUser(SMnode *pMnode, SUserObj *pUser); // for trans test SSdbRaw *mndUserActionEncode(SUserObj *pUser); SHashObj *mndDupDbHash(SHashObj *pOld); +SHashObj *mndDupTableHash(SHashObj *pOld); SHashObj *mndDupTopicHash(SHashObj *pOld); int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp, int32_t *pRspLen); From 5babaf9e92d8bf755dd2db3c4079e6a06151622e Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 31 Mar 2023 10:45:21 +0800 Subject: [PATCH 16/71] feat: table level read privilege check --- source/libs/parser/src/parAstParser.c | 9 ++++ source/libs/parser/src/parAuthenticator.c | 58 ++++++++++++++++++++--- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index cd4b455e02..fb6711ecb1 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -610,6 +610,13 @@ static int32_t collectMetaKeyFromCompactDatabase(SCollectMetaKeyCxt* pCxt, SComp return reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); } +static int32_t collectMetaKeyFromGrant(SCollectMetaKeyCxt* pCxt, SGrantStmt* pStmt) { + if ('\0' == pStmt->tabName[0]) { + return TSDB_CODE_SUCCESS; + } + return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->objName, pStmt->tabName, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { pCxt->pStmt = pStmt; switch (nodeType(pStmt)) { @@ -645,6 +652,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromCompactDatabase(pCxt, (SCompactDatabaseStmt*)pStmt); case QUERY_NODE_CREATE_STREAM_STMT: return collectMetaKeyFromCreateStream(pCxt, (SCreateStreamStmt*)pStmt); + case QUERY_NODE_GRANT_STMT: + return collectMetaKeyFromGrant(pCxt, (SGrantStmt*)pStmt); case QUERY_NODE_SHOW_DNODES_STMT: return collectMetaKeyFromShowDnodes(pCxt, (SShowStmt*)pStmt); case QUERY_NODE_SHOW_MNODES_STMT: diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index e4de60fd05..9327dee5be 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -23,6 +23,11 @@ typedef struct SAuthCxt { int32_t errCode; } SAuthCxt; +typedef struct SSelectAuthCxt { + SAuthCxt* pAuthCxt; + SSelectStmt* pSelect; +} SSelectAuthCxt; + static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt); static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, AUTH_TYPE type) { @@ -53,19 +58,60 @@ static EDealRes authSubquery(SAuthCxt* pCxt, SNode* pStmt) { return TSDB_CODE_SUCCESS == authQuery(pCxt, pStmt) ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } +static int32_t mergeStableTagCond(SNode** pWhere, SNode** pTagCond) { + SLogicConditionNode* pLogicCond = (SLogicConditionNode*)nodesMakeNode(QUERY_NODE_LOGIC_CONDITION); + if (NULL == pLogicCond) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL; + pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; + pLogicCond->condType = LOGIC_COND_TYPE_AND; + int32_t code = nodesListMakeStrictAppend(&pLogicCond->pParameterList, *pTagCond); + if (TSDB_CODE_SUCCESS == code) { + code = nodesListMakeAppend(&pLogicCond->pParameterList, *pWhere); + } + if (TSDB_CODE_SUCCESS == code) { + *pWhere = (SNode*)pLogicCond; + } else { + nodesDestroyNode((SNode*)pLogicCond); + } + return code; +} + +static int32_t appendStableTagCond(SSelectStmt* pSelect, SNode* pTagCond) { + SNode* pTagCondCopy = nodesCloneNode(pTagCond); + if (NULL == pTagCondCopy) { + return TSDB_CODE_OUT_OF_MEMORY; + } + + if (NULL == pSelect->pWhere) { + pSelect->pWhere = pTagCondCopy; + return TSDB_CODE_SUCCESS; + } + + if (QUERY_NODE_LOGIC_CONDITION == nodeType(pSelect->pWhere) && + LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)pSelect->pWhere)->condType) { + return nodesListStrictAppend(((SLogicConditionNode*)pSelect->pWhere)->pParameterList, pTagCondCopy); + } + + return mergeStableTagCond(&pSelect->pWhere, &pTagCondCopy); +} + static EDealRes authSelectImpl(SNode* pNode, void* pContext) { - SAuthCxt* pCxt = pContext; + SSelectAuthCxt* pCxt = pContext; + SAuthCxt* pAuthCxt = pCxt->pAuthCxt; if (QUERY_NODE_REAL_TABLE == nodeType(pNode)) { - pCxt->errCode = checkAuth(pCxt, ((SRealTableNode*)pNode)->table.dbName, AUTH_TYPE_READ); - return TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; + pAuthCxt->errCode = checkAuth(pAuthCxt, ((SRealTableNode*)pNode)->table.dbName, AUTH_TYPE_READ); + return TSDB_CODE_SUCCESS == pAuthCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } else if (QUERY_NODE_TEMP_TABLE == nodeType(pNode)) { - return authSubquery(pCxt, ((STempTableNode*)pNode)->pSubquery); + return authSubquery(pAuthCxt, ((STempTableNode*)pNode)->pSubquery); } return DEAL_RES_CONTINUE; } static int32_t authSelect(SAuthCxt* pCxt, SSelectStmt* pSelect) { - nodesWalkSelectStmt(pSelect, SQL_CLAUSE_FROM, authSelectImpl, pCxt); + SSelectAuthCxt cxt = {.pAuthCxt = pCxt, .pSelect = pSelect}; + nodesWalkSelectStmt(pSelect, SQL_CLAUSE_FROM, authSelectImpl, &cxt); return pCxt->errCode; } @@ -146,7 +192,7 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { case QUERY_NODE_SHOW_LICENCES_STMT: case QUERY_NODE_SHOW_VGROUPS_STMT: case QUERY_NODE_SHOW_DB_ALIVE_STMT: - case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: + case QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT: case QUERY_NODE_SHOW_CREATE_DATABASE_STMT: case QUERY_NODE_SHOW_TABLE_DISTRIBUTED_STMT: case QUERY_NODE_SHOW_VNODES_STMT: From b24cf98ef3dd0823a645aedb5738cefe825fc70d Mon Sep 17 00:00:00 2001 From: cademfly Date: Fri, 31 Mar 2023 11:03:33 +0800 Subject: [PATCH 17/71] use only one altertype for both table and cond --- source/dnode/mnode/impl/src/mndUser.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index bebf57a55e..243053751e 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -685,8 +685,22 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; - if (taosHashPut(hash, tbFName, len, "t", 2) != 0) { - return -1; + if(alterReq->tagCond != NULL && alterReq->tagCondLen != 0){ + char *value = taosHashGet(hash, tbFName, len); + if(value != NULL){ + terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST; + return -1; + } + + int32_t condLen = alterReq->tagCondLen + 1; + if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { + return -1; + } + } + else{ + if (taosHashPut(hash, tbFName, len, "t", 2) != 0) { + return -1; + } } return 0; From 6825b196ef731bfdff3336b42e6bfa1b6586ceb6 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 4 Apr 2023 17:19:18 +0800 Subject: [PATCH 18/71] feat: table level write privilege check --- include/common/tmsg.h | 2 + source/libs/parser/src/parInsertSql.c | 115 +++++++++++++++++++++++++ source/libs/parser/src/parTranslater.c | 12 +-- 3 files changed, 123 insertions(+), 6 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index a9923e4e48..3f8df42e1d 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -185,6 +185,8 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_REMOVE_READ_TAG 0x12 #define TSDB_ALTER_USER_ADD_WRITE_TAG 0x13 #define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x14 +#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x15 +#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x16 #define TSDB_ALTER_USER_PRIVILEGES 0x2 diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 3fbe23592a..4110da94c5 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -15,6 +15,7 @@ #include "parInsertUtil.h" #include "parToken.h" +#include "scalar.h" #include "tglobal.h" #include "ttime.h" @@ -565,6 +566,120 @@ static int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, SMsgBuf* pMs return TSDB_CODE_SUCCESS; } +typedef struct SRewriteTagCondCxt { + SArray* pTagVals; + SArray* pTagName; + int32_t code; +} SRewriteTagCondCxt; + +static int32_t rewriteTagCondColumnImpl(STagVal* pVal, SNode** pNode) { + SValueNode* pValue = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); + if (NULL == pValue) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pValue->node.resType.type = pVal->type; + switch (pVal->type) { + case TSDB_DATA_TYPE_BOOL: + pValue->datum.b = *(int8_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_TINYINT: + pValue->datum.i = *(int8_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_SMALLINT: + pValue->datum.i = *(int16_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_INT: + pValue->datum.i = *(int32_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_BIGINT: + pValue->datum.i = pVal->i64; + break; + case TSDB_DATA_TYPE_FLOAT: + pValue->datum.d = *(float*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_DOUBLE: + pValue->datum.d = *(double*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_VARCHAR: + case TSDB_DATA_TYPE_NCHAR: + pValue->datum.p = taosMemoryCalloc(1, pVal->nData + VARSTR_HEADER_SIZE); + if (NULL == pValue->datum.p) { + return TSDB_CODE_OUT_OF_MEMORY; + } + varDataSetLen(pValue->datum.p, pVal->nData); + memcpy(varDataVal(pValue->datum.p), pVal->pData, pVal->nData); + break; + case TSDB_DATA_TYPE_TIMESTAMP: + pValue->datum.i = pVal->i64; + break; + case TSDB_DATA_TYPE_UTINYINT: + pValue->datum.i = *(uint8_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_USMALLINT: + pValue->datum.i = *(uint16_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_UINT: + pValue->datum.i = *(uint32_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_UBIGINT: + pValue->datum.i = *(uint64_t*)(&pVal->i64); + break; + case TSDB_DATA_TYPE_JSON: + case TSDB_DATA_TYPE_VARBINARY: + case TSDB_DATA_TYPE_DECIMAL: + case TSDB_DATA_TYPE_BLOB: + case TSDB_DATA_TYPE_MEDIUMBLOB: + default: + return TSDB_CODE_FAILED; + } + return TSDB_CODE_SUCCESS; +} + +static int32_t rewriteTagCondColumn(SArray* pTagVals, SArray* pTagName, SNode** pNode) { + SColumnNode* pCol = (SColumnNode*)*pNode; + int32_t ntags = taosArrayGetSize(pTagName); + for (int32_t i = 0; i < ntags; ++i) { + char* pTagColName = taosArrayGet(pTagName, i); + if (0 == strcmp(pTagColName, pCol->colName)) { + return rewriteTagCondColumnImpl(taosArrayGet(pTagVals, i), pNode); + } + } + return TSDB_CODE_PAR_PERMISSION_DENIED; +} + +static EDealRes rewriteTagCond(SNode** pNode, void* pContext) { + if (QUERY_NODE_COLUMN == nodeType(*pNode)) { + SRewriteTagCondCxt* pCxt = pContext; + pCxt->code = rewriteTagCondColumn(pCxt->pTagVals, pCxt->pTagName, pNode); + return (TSDB_CODE_SUCCESS == pCxt->code ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR); + } + return DEAL_RES_CONTINUE; +} + +static int32_t setTagVal(SArray* pTagVals, SArray* pTagName, SNode* pCond) { + SRewriteTagCondCxt cxt = {.code = TSDB_CODE_SUCCESS, .pTagVals = pTagVals, .pTagName = pTagName}; + nodesRewriteExpr(&pCond, rewriteTagCond, &cxt); + return cxt.code; +} + +static int32_t checkTagCondResult(SNode* pResult) { + return (QUERY_NODE_VALUE == nodeType(pResult) && ((SValueNode*)pResult)->datum.b) ? TSDB_CODE_SUCCESS + : TSDB_CODE_PAR_PERMISSION_DENIED; +} + +int32_t checkSubtablePrivilege(SArray* pTagVals, SArray* pTagName, SNode* pCond) { + int32_t code = setTagVal(pTagVals, pTagName, pCond); + SNode* pNew = NULL; + if (TSDB_CODE_SUCCESS == code) { + code = scalarCalculateConstants(pCond, &pNew); + } + if (TSDB_CODE_SUCCESS == code) { + code = checkTagCondResult(pNew); + } + nodesDestroyNode(pNew); + return code; +} + // pSql -> tag1_value, ...) static int32_t parseTagsClauseImpl(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 06bd666609..cf621ef166 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -6454,11 +6454,11 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { - req.alterType = TSDB_ALTER_USER_ADD_ALL_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_ALL_DB : TSDB_ALTER_USER_ADD_ALL_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { - req.alterType = TSDB_ALTER_USER_ADD_READ_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_READ_DB : TSDB_ALTER_USER_ADD_READ_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { - req.alterType = TSDB_ALTER_USER_ADD_WRITE_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_ADD_WRITE_DB : TSDB_ALTER_USER_ADD_WRITE_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC; } @@ -6480,11 +6480,11 @@ static int32_t translateRevoke(STranslateContext* pCxt, SRevokeStmt* pStmt) { if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ) && BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE))) { - req.alterType = TSDB_ALTER_USER_REMOVE_ALL_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_ALL_DB : TSDB_ALTER_USER_REMOVE_ALL_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_READ)) { - req.alterType = TSDB_ALTER_USER_REMOVE_READ_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_READ_DB : TSDB_ALTER_USER_REMOVE_READ_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_WRITE)) { - req.alterType = TSDB_ALTER_USER_REMOVE_WRITE_DB; + req.alterType = ('\0' == pStmt->tabName[0] ? TSDB_ALTER_USER_REMOVE_WRITE_DB : TSDB_ALTER_USER_REMOVE_WRITE_TABLE); } else if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_SUBSCRIBE)) { req.alterType = TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC; } From d768f49dd794e1441d9f8b3b29ccf17e05e019f4 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 6 Apr 2023 10:01:27 +0800 Subject: [PATCH 19/71] feat: table level user auth --- include/libs/catalog/catalog.h | 16 ++- source/libs/catalog/CMakeLists.txt | 4 +- source/libs/catalog/inc/catalogInt.h | 25 ++-- source/libs/catalog/src/catalog.c | 53 ++++----- source/libs/catalog/src/ctgAsync.c | 71 ++++++------ source/libs/catalog/src/ctgCache.c | 71 ++++-------- source/libs/catalog/src/ctgUtil.c | 133 +++++++++++++++++++++- source/libs/catalog/test/catalogTests.cpp | 18 +-- source/libs/parser/src/parAuthenticator.c | 5 +- source/libs/parser/src/parInsertSql.c | 13 ++- source/libs/parser/src/parUtil.c | 5 +- source/libs/parser/test/mockCatalog.cpp | 10 +- 12 files changed, 272 insertions(+), 152 deletions(-) diff --git a/include/libs/catalog/catalog.h b/include/libs/catalog/catalog.h index fbb24d2862..2c684f8f76 100644 --- a/include/libs/catalog/catalog.h +++ b/include/libs/catalog/catalog.h @@ -29,6 +29,7 @@ extern "C" { #include "tmsg.h" #include "tname.h" #include "transport.h" +#include "nodes.h" typedef struct SCatalog SCatalog; @@ -49,10 +50,15 @@ typedef enum { typedef struct SUserAuthInfo { char user[TSDB_USER_LEN]; - char dbFName[TSDB_DB_FNAME_LEN]; + SName tbName; AUTH_TYPE type; } SUserAuthInfo; +typedef struct SUserAuthRes { + bool pass; + SNode* pCond; +} SUserAuthRes; + typedef struct SDbInfo { int32_t vgVer; int32_t tbNum; @@ -96,7 +102,7 @@ typedef struct SMetaData { SArray* pTableIndex; // pRes = SArray* SArray* pUdfList; // pRes = SFuncInfo* SArray* pIndex; // pRes = SIndexInfo* - SArray* pUser; // pRes = bool* + SArray* pUser; // pRes = SUserAuthRes* SArray* pQnodeList; // pRes = SArray* SArray* pTableCfg; // pRes = STableCfg* SArray* pDnodeList; // pRes = SArray* @@ -312,11 +318,9 @@ int32_t catalogUpdateTableIndex(SCatalog* pCtg, STableIndexRsp* pRsp); int32_t catalogGetUdfInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char* funcName, SFuncInfo* pInfo); -int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, - bool* pass); +int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes); -int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool* pass, - bool* exists); +int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists); int32_t catalogUpdateUserAuthInfo(SCatalog* pCtg, SGetUserAuthRsp* pAuth); diff --git a/source/libs/catalog/CMakeLists.txt b/source/libs/catalog/CMakeLists.txt index 632034d6b6..bc56ff4c7f 100644 --- a/source/libs/catalog/CMakeLists.txt +++ b/source/libs/catalog/CMakeLists.txt @@ -8,9 +8,9 @@ target_include_directories( target_link_libraries( catalog - PRIVATE os util transport qcom + PRIVATE os util transport qcom nodes ) if(${BUILD_TEST}) ADD_SUBDIRECTORY(test) -endif(${BUILD_TEST}) \ No newline at end of file +endif(${BUILD_TEST}) diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index 8fc7df63be..711274ce1d 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -99,6 +99,20 @@ typedef struct SCtgDebug { uint32_t showCachePeriodSec; } SCtgDebug; +typedef struct SCtgAuthReq { + SRequestConnInfo* pConn; + SUserAuthInfo* pRawReq; + SGetUserAuthRsp authInfo; + AUTH_TYPE singleType; + bool onlyCache; +} SCtgAuthReq; + +typedef struct SCtgAuthRsp { + SUserAuthRes* pRawRes; + bool metaNotExists; +} SCtgAuthRsp; + + typedef struct SCtgTbCacheInfo { bool inCache; uint64_t dbId; @@ -214,12 +228,8 @@ typedef struct SCtgRentMgmt { } SCtgRentMgmt; typedef struct SCtgUserAuth { - int32_t version; - SRWLatch lock; - bool superUser; - SHashObj* createdDbs; - SHashObj* readDbs; - SHashObj* writeDbs; + SRWLatch lock; + SGetUserAuthRsp userAuth; } SCtgUserAuth; typedef struct SCatalog { @@ -703,7 +713,7 @@ int32_t ctgTbMetaExistInCache(SCatalog* pCtg, char* dbFName, char* tbName, int32 int32_t ctgReadTbMetaFromCache(SCatalog* pCtg, SCtgTbMetaCtx* ctx, STableMeta** pTableMeta); int32_t ctgReadTbVerFromCache(SCatalog* pCtg, SName* pTableName, int32_t* sver, int32_t* tver, int32_t* tbType, uint64_t* suid, char* stbName); -int32_t ctgChkAuthFromCache(SCatalog* pCtg, char* user, char* dbFName, AUTH_TYPE type, bool* inCache, bool* pass); +int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp* pRes); int32_t ctgDropDbCacheEnqueue(SCatalog* pCtg, const char* dbFName, int64_t dbId); int32_t ctgDropDbVgroupEnqueue(SCatalog* pCtg, const char* dbFName, bool syncReq); int32_t ctgDropStbMetaEnqueue(SCatalog* pCtg, const char* dbFName, int64_t dbId, const char* stbName, uint64_t suid, @@ -806,6 +816,7 @@ int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const cha int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName); void ctgReleaseVgMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache); void ctgReleaseTbMetaToCache(SCatalog *pCtg, SCtgDBCache *dbCache, SCtgTbCache *pCache); +int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res); extern SCatalogMgmt gCtgMgmt; extern SCtgDebug gCTGDebug; diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index f9a218835e..f4549417f0 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -319,14 +319,13 @@ _return: CTG_RET(code); } -int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, - bool* pass, bool* exists) { +int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pReq, SUserAuthRes* pRes, bool* exists) { bool inCache = false; int32_t code = 0; + SCtgAuthRsp rsp = {0}; + rsp.pRawRes = pRes; - *pass = false; - - CTG_ERR_RET(ctgChkAuthFromCache(pCtg, (char*)user, (char*)dbFName, type, &inCache, pass)); + CTG_ERR_RET(ctgChkAuthFromCache(pCtg, pReq, &inCache, &rsp)); if (inCache) { if (exists) { @@ -339,30 +338,22 @@ int32_t ctgChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, co return TSDB_CODE_SUCCESS; } - SGetUserAuthRsp authRsp = {0}; - CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, user, &authRsp, NULL)); + SCtgAuthReq req = {0}; + req.pRawReq = pReq; + req.pConn = pConn; + req.onlyCache = exists ? true : false; + CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pReq->user, &req.authInfo, NULL)); - if (authRsp.superAuth) { - *pass = true; - goto _return; - } - - if (authRsp.createdDbs && taosHashGet(authRsp.createdDbs, dbFName, strlen(dbFName))) { - *pass = true; - goto _return; - } - - if (CTG_AUTH_READ(type) && authRsp.readDbs && taosHashGet(authRsp.readDbs, dbFName, strlen(dbFName))) { - *pass = true; - } else if (CTG_AUTH_WRITE(type) && authRsp.writeDbs && taosHashGet(authRsp.writeDbs, dbFName, strlen(dbFName))) { - *pass = true; + CTG_ERR_JRET(ctgChkSetAuthRes(pCtg, &req, &rsp)); + if (rsp.metaNotExists && exists) { + *exists = false; } _return: - ctgUpdateUserEnqueue(pCtg, &authRsp, false); + ctgUpdateUserEnqueue(pCtg, &req.authInfo, false); - return TSDB_CODE_SUCCESS; + CTG_RET(code); } int32_t ctgGetTbType(SCatalog* pCtg, SRequestConnInfo* pConn, SName* pTableName, int32_t* tbType) { @@ -1368,7 +1359,7 @@ int32_t catalogGetExpiredUsers(SCatalog* pCtg, SUserAuthVersion** users, uint32_ void* key = taosHashGetKey(pAuth, &len); strncpy((*users)[i].user, key, len); (*users)[i].user[len] = 0; - (*users)[i].version = pAuth->version; + (*users)[i].version = pAuth->userAuth.version; ++i; if (i >= *num) { taosHashCancelIterate(pCtg->userCache, pAuth); @@ -1448,32 +1439,30 @@ _return: CTG_API_LEAVE(code); } -int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, - bool* pass) { +int32_t catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes) { CTG_API_ENTER(); - if (NULL == pCtg || NULL == pConn || NULL == user || NULL == dbFName || NULL == pass) { + if (NULL == pCtg || NULL == pConn || NULL == pAuth || NULL == pRes) { CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } int32_t code = 0; - CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, user, dbFName, type, pass, NULL)); + CTG_ERR_JRET(ctgChkAuth(pCtg, pConn, pAuth, pRes, NULL)); _return: CTG_API_LEAVE(code); } -int32_t catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, - bool* pass, bool* exists) { +int32_t catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists) { CTG_API_ENTER(); - if (NULL == pCtg || NULL == user || NULL == dbFName || NULL == pass || NULL == exists) { + if (NULL == pCtg || NULL == pAuth || NULL == pRes || NULL == exists) { CTG_API_LEAVE(TSDB_CODE_CTG_INVALID_INPUT); } int32_t code = 0; - CTG_ERR_JRET(ctgChkAuth(pCtg, NULL, user, dbFName, type, pass, exists)); + CTG_ERR_JRET(ctgChkAuth(pCtg, NULL, pAuth, pRes, exists)); _return: diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index f62e93b82a..92ac33a566 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -1550,45 +1550,20 @@ _return: int32_t ctgHandleGetUserRsp(SCtgTaskReq* tReq, int32_t reqType, const SDataBuf* pMsg, int32_t rspCode) { int32_t code = 0; SCtgTask* pTask = tReq->pTask; - SCtgUserCtx* ctx = (SCtgUserCtx*)pTask->taskCtx; SCatalog* pCtg = pTask->pJob->pCtg; - bool pass = false; SGetUserAuthRsp* pOut = (SGetUserAuthRsp*)pTask->msgCtx.out; CTG_ERR_JRET(ctgProcessRspMsg(pTask->msgCtx.out, reqType, pMsg->pData, pMsg->len, rspCode, pTask->msgCtx.target)); - if (pOut->superAuth) { - pass = true; - goto _return; - } + ctgUpdateUserEnqueue(pCtg, pOut, true); + taosMemoryFreeClear(pTask->msgCtx.out); - if (pOut->createdDbs && taosHashGet(pOut->createdDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) { - pass = true; - goto _return; - } + CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].launchFp)(pTask)); - if (CTG_AUTH_READ(ctx->user.type) && pOut->readDbs && - taosHashGet(pOut->readDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) { - pass = true; - } else if (CTG_AUTH_WRITE(ctx->user.type) && pOut->writeDbs && - taosHashGet(pOut->writeDbs, ctx->user.dbFName, strlen(ctx->user.dbFName))) { - pass = true; - } + return TSDB_CODE_SUCCESS; _return: - if (TSDB_CODE_SUCCESS == code) { - pTask->res = taosMemoryCalloc(1, sizeof(bool)); - if (NULL == pTask->res) { - code = TSDB_CODE_OUT_OF_MEMORY; - } else { - *(bool*)pTask->res = pass; - } - } - - ctgUpdateUserEnqueue(pCtg, pOut, false); - taosMemoryFreeClear(pTask->msgCtx.out); - ctgHandleTaskEnd(pTask, code); CTG_RET(code); @@ -2067,31 +2042,39 @@ int32_t ctgLaunchGetUdfTask(SCtgTask* pTask) { } int32_t ctgLaunchGetUserTask(SCtgTask* pTask) { + int32_t code = 0; SCatalog* pCtg = pTask->pJob->pCtg; SRequestConnInfo* pConn = &pTask->pJob->conn; SCtgUserCtx* pCtx = (SCtgUserCtx*)pTask->taskCtx; bool inCache = false; - bool pass = false; + SCtgAuthRsp rsp = {0}; SCtgJob* pJob = pTask->pJob; SCtgMsgCtx* pMsgCtx = CTG_GET_TASK_MSGCTX(pTask, -1); if (NULL == pMsgCtx->pBatchs) { pMsgCtx->pBatchs = pJob->pBatchs; } - CTG_ERR_RET(ctgChkAuthFromCache(pCtg, pCtx->user.user, pCtx->user.dbFName, pCtx->user.type, &inCache, &pass)); + rsp.pRawRes = taosMemoryCalloc(1, sizeof(SUserAuthRes)); + if (NULL == rsp.pRawRes) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + CTG_ERR_RET(ctgChkAuthFromCache(pCtg, &pCtx->user, &inCache, &rsp)); if (inCache) { - pTask->res = taosMemoryCalloc(1, sizeof(bool)); - if (NULL == pTask->res) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); - } - *(bool*)pTask->res = pass; + pTask->res = rsp.pRawRes; CTG_ERR_RET(ctgHandleTaskEnd(pTask, 0)); return TSDB_CODE_SUCCESS; } - CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pCtx->user.user, NULL, pTask)); + taosMemoryFreeClear(rsp.pRawRes); + if (rsp.metaNotExists) { + CTG_ERR_RET(ctgLaunchSubTask(pTask, CTG_TASK_GET_TB_META, ctgGetTbCfgCb, &pCtx->user.tbName)); + } else { + CTG_ERR_RET(ctgGetUserDbAuthFromMnode(pCtg, pConn, pCtx->user.user, NULL, pTask)); + } + return TSDB_CODE_SUCCESS; } @@ -2139,6 +2122,20 @@ _return: CTG_RET(ctgHandleTaskEnd(pTask, pTask->subRes.code)); } + +int32_t ctgGetUserCb(SCtgTask* pTask) { + int32_t code = 0; + + CTG_ERR_JRET(pTask->subRes.code); + + CTG_RET(ctgLaunchGetUserTask(pTask)); + +_return: + + CTG_RET(ctgHandleTaskEnd(pTask, pTask->subRes.code)); +} + + int32_t ctgCompDbVgTasks(SCtgTask* pTask, void* param, bool* equal) { SCtgDbVgCtx* ctx = pTask->taskCtx; diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 7ff8afd6a5..d847735f4f 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -678,55 +678,40 @@ _return: CTG_RET(code); } -int32_t ctgChkAuthFromCache(SCatalog *pCtg, char *user, char *dbFName, AUTH_TYPE type, bool *inCache, bool *pass) { - char *p = strchr(dbFName, '.'); - if (p) { - ++p; - } else { - p = dbFName; - } - - if (IS_SYS_DBNAME(p)) { +int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp* pRes) { + if (IS_SYS_DBNAME(pReq->tbName.dbname)) { *inCache = true; - *pass = true; - ctgDebug("sysdb %s, pass", dbFName); + pRes->pRawRes->pass = true; + ctgDebug("sysdb %s, pass", pReq->tbName.dbname); return TSDB_CODE_SUCCESS; } - SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, user, strlen(user)); + SCtgUserAuth *pUser = (SCtgUserAuth *)taosHashGet(pCtg->userCache, pReq->user, strlen(pReq->user)); if (NULL == pUser) { - ctgDebug("user not in cache, user:%s", user); + ctgDebug("user not in cache, user:%s", pReq->user); goto _return; } *inCache = true; - ctgDebug("Got user from cache, user:%s", user); + ctgDebug("Got user from cache, user:%s", pReq->user); CTG_CACHE_STAT_INC(numOfUserHit, 1); - if (pUser->superUser) { - *pass = true; - return TSDB_CODE_SUCCESS; - } + SCtgAuthReq req = {0}; + req.pRawReq = pReq; + req.onlyCache = true; CTG_LOCK(CTG_READ, &pUser->lock); - if (pUser->createdDbs && taosHashGet(pUser->createdDbs, dbFName, strlen(dbFName))) { - *pass = true; - CTG_UNLOCK(CTG_READ, &pUser->lock); - return TSDB_CODE_SUCCESS; - } - - if (pUser->readDbs && taosHashGet(pUser->readDbs, dbFName, strlen(dbFName)) && CTG_AUTH_READ(type)) { - *pass = true; - } - - if (pUser->writeDbs && taosHashGet(pUser->writeDbs, dbFName, strlen(dbFName)) && CTG_AUTH_WRITE(type)) { - *pass = true; - } - + memcpy(&req.authInfo, &pUser->userAuth, sizeof(pUser->userAuth)); + int32_t code = ctgChkSetAuthRes(pCtg, &req, pRes); CTG_UNLOCK(CTG_READ, &pUser->lock); + CTG_ERR_JRET(code); + + if (pRes->metaNotExists) { + goto _return; + } - return TSDB_CODE_SUCCESS; + CTG_RET(code); _return: @@ -2024,11 +2009,7 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { if (NULL == pUser) { SCtgUserAuth userAuth = {0}; - userAuth.version = msg->userAuth.version; - userAuth.superUser = msg->userAuth.superAuth; - userAuth.createdDbs = msg->userAuth.createdDbs; - userAuth.readDbs = msg->userAuth.readDbs; - userAuth.writeDbs = msg->userAuth.writeDbs; + memcpy(&userAuth.userAuth, &msg->userAuth, sizeof(msg->userAuth)); if (taosHashPut(pCtg->userCache, msg->userAuth.user, strlen(msg->userAuth.user), &userAuth, sizeof(userAuth))) { ctgError("taosHashPut user %s to cache failed", msg->userAuth.user); @@ -2040,20 +2021,18 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { return TSDB_CODE_SUCCESS; } - pUser->version = msg->userAuth.version; - CTG_LOCK(CTG_WRITE, &pUser->lock); - taosHashCleanup(pUser->createdDbs); - pUser->createdDbs = msg->userAuth.createdDbs; + taosHashCleanup(pUser->userAuth.createdDbs); + pUser->userAuth.createdDbs = msg->userAuth.createdDbs; msg->userAuth.createdDbs = NULL; - taosHashCleanup(pUser->readDbs); - pUser->readDbs = msg->userAuth.readDbs; + taosHashCleanup(pUser->userAuth.readDbs); + pUser->userAuth.readDbs = msg->userAuth.readDbs; msg->userAuth.readDbs = NULL; - taosHashCleanup(pUser->writeDbs); - pUser->writeDbs = msg->userAuth.writeDbs; + taosHashCleanup(pUser->userAuth.writeDbs); + pUser->userAuth.writeDbs = msg->userAuth.writeDbs; msg->userAuth.writeDbs = NULL; CTG_UNLOCK(CTG_WRITE, &pUser->lock); diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 9b013c2892..501ad63dce 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -174,9 +174,11 @@ void ctgFreeSMetaData(SMetaData* pData) { } void ctgFreeSCtgUserAuth(SCtgUserAuth* userCache) { - taosHashCleanup(userCache->createdDbs); - taosHashCleanup(userCache->readDbs); - taosHashCleanup(userCache->writeDbs); + taosHashCleanup(userCache->userAuth.createdDbs); + taosHashCleanup(userCache->userAuth.readDbs); + taosHashCleanup(userCache->userAuth.writeDbs); + taosHashCleanup(userCache->userAuth.readTbs); + taosHashCleanup(userCache->userAuth.writeTbs); } void ctgFreeMetaRent(SCtgRentMgmt* mgmt) { @@ -1330,6 +1332,131 @@ static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*) static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } +int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { + int32_t code = 0; + STableMeta *pMeta = NULL; + SGetUserAuthRsp *pInfo = &req->authInfo; + SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs; + + char *pCond = taosHashGet(pTbs, req->pRawReq->tbName.tname, strlen(req->pRawReq->tbName.tname)); + if (pCond) { + if (strlen(pCond) > 1) { + CTG_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); + } + + res->pRawRes->pass = true; + return TSDB_CODE_SUCCESS; + } + + CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta)); + if (NULL == pMeta) { + if (req->onlyCache) { + res->metaNotExists = true; + ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname); + return TSDB_CODE_SUCCESS; + } + + CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta)); + } + + if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) { + res->pRawRes->pass = false; + goto _return; + } + + if (TSDB_CHILD_TABLE == pMeta->tableType) { + res->pRawRes->pass = true; + +/* + char stbName[TSDB_TABLE_NAME_LEN] = {0}; + CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName)); + if (0 == stbName[0]) { + if (req->onlyCache) { + res->notExists = true; + return TSDB_CODE_SUCCESS; + } + + CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0)); + } +*/ + } + +_return: + + taosMemoryFree(pMeta); + + CTG_RET(code); +} + +int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { + int32_t code = 0; + SUserAuthInfo* pReq = req->pRawReq; + SUserAuthRes* pRes = res->pRawRes; + SGetUserAuthRsp *pInfo = &req->authInfo; + + pRes->pass = false; + pRes->pCond = NULL; + + if (!pInfo->enable) { + pRes->pass = false; + return TSDB_CODE_SUCCESS; + } + + if (pInfo->superAuth) { + pRes->pass = true; + return TSDB_CODE_SUCCESS; + } + + char dbFName[TSDB_DB_FNAME_LEN]; + tNameGetFullDbName(&pReq->tbName, dbFName); + + if (pInfo->createdDbs && taosHashGet(pInfo->createdDbs, dbFName, strlen(dbFName))) { + pRes->pass = true; + return TSDB_CODE_SUCCESS; + } + + switch (pReq->type) { + case AUTH_TYPE_READ: { + if (pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) { + pRes->pass = true; + return TSDB_CODE_SUCCESS; + } + if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) { + req->singleType = AUTH_TYPE_READ; + CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res)); + } + + break; + } + case AUTH_TYPE_WRITE: { + if (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) { + pRes->pass = true; + return TSDB_CODE_SUCCESS; + } + if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) { + req->singleType = AUTH_TYPE_WRITE; + CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res)); + } + + break; + } + case AUTH_TYPE_READ_OR_WRITE: { + if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) || + (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName)))){ + pRes->pass = true; + return TSDB_CODE_SUCCESS; + } + + break; + } + default: + break; + } + + return TSDB_CODE_SUCCESS; +} + + #if 0 static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) { if (NULL == pSrc) { diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index 5e543384ac..bdced0074e 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -2800,15 +2800,19 @@ TEST(apiTest, catalogChkAuth_test) { code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); - bool pass = false; + SUserAuthInfo authInfo = {0}; + SUserAuthRes authRes = {0}; + strcpy(authInfo.user, ctgTestUsername); + toName(1, ctgTestDbname, ctgTestSTablename, &authInfo.tbName); + authInfo.type = AUTH_TYPE_READ; bool exists = false; - code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists); + code = catalogChkAuthFromCache(pCtg, &authInfo, &authRes, &exists); ASSERT_EQ(code, 0); ASSERT_EQ(exists, false); - - code = catalogChkAuth(pCtg, mockPointer, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass); + + code = catalogChkAuth(pCtg, mockPointer, &authInfo, &authRes); ASSERT_EQ(code, 0); - ASSERT_EQ(pass, true); + ASSERT_EQ(authRes.pass, true); while (true) { uint64_t n = 0; @@ -2820,9 +2824,9 @@ TEST(apiTest, catalogChkAuth_test) { } } - code = catalogChkAuthFromCache(pCtg, ctgTestUsername, ctgTestDbname, AUTH_TYPE_READ, &pass, &exists); + code = catalogChkAuthFromCache(pCtg, &authInfo, &authRes, &exists); ASSERT_EQ(code, 0); - ASSERT_EQ(pass, true); + ASSERT_EQ(authRes.pass, true); ASSERT_EQ(exists, true); catalogDestroy(); diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index e4de60fd05..a0ded97c5f 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -44,7 +44,10 @@ static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, AUTH_TYPE type) { .requestObjRefId = pParseCxt->requestRid, .mgmtEps = pParseCxt->mgmtEpSet}; - code = catalogChkAuth(pParseCxt->pCatalog, &conn, pParseCxt->pUser, dbFname, type, &pass); + SUserAuthInfo authInfo = {0}; + SUserAuthRes authRes = {0}; + //code = catalogChkAuth(pParseCxt->pCatalog, &conn, pParseCxt->pUser, dbFname, type, &pass); + code = catalogChkAuth(pParseCxt->pCatalog, &conn, &authInfo, &authRes); } return TSDB_CODE_SUCCESS == code ? (pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code; } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index 3fbe23592a..dcc769624f 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -729,13 +729,20 @@ static int32_t checkAuth(SParseContext* pCxt, SName* pTbName, bool* pMissCache) bool pass = true; bool exists = true; if (pCxt->async) { - code = catalogChkAuthFromCache(pCxt->pCatalog, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass, &exists); + SUserAuthInfo authInfo = {0}; + SUserAuthRes authRes = {0}; +// code = catalogChkAuthFromCache(pCxt->pCatalog, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass, &exists); + code = catalogChkAuthFromCache(pCxt->pCatalog, &authInfo, &authRes, &exists); } else { SRequestConnInfo conn = {.pTrans = pCxt->pTransporter, .requestId = pCxt->requestId, .requestObjRefId = pCxt->requestRid, .mgmtEps = pCxt->mgmtEpSet}; - code = catalogChkAuth(pCxt->pCatalog, &conn, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass); + SUserAuthInfo authInfo = {0}; + SUserAuthRes authRes = {0}; + //code = catalogChkAuth(pCxt->pCatalog, &conn, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass); + code = catalogChkAuth(pCxt->pCatalog, &conn, &authInfo, &authRes); + } if (TSDB_CODE_SUCCESS == code) { if (!exists) { @@ -1901,7 +1908,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE}; snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser); - tNameGetFullDbName(pName, userAuth.dbFName); + //tNameGetFullDbName(pName, userAuth.dbFName); taosArrayPush(*pUserAuth, &userAuth); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 563bc5e780..5c56d11b52 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -509,7 +509,7 @@ static void stringToUserAuth(const char* pStr, int32_t len, SUserAuthInfo* pUser strncpy(pUserAuth->user, pStr, p1 - pStr); ++p1; char* p2 = strchr(p1, '*'); - strncpy(pUserAuth->dbFName, p1, p2 - p1); + //strncpy(pUserAuth->dbFName, p1, p2 - p1); ++p2; char buf[10] = {0}; strncpy(buf, p2, len - (p2 - pStr)); @@ -712,7 +712,8 @@ static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUse for (int32_t i = 0; i < nvgs; ++i) { SUserAuthInfo* pUser = taosArrayGet(pUserAuthReq, i); char key[USER_AUTH_KEY_MAX_LEN] = {0}; - int32_t len = userAuthToStringExt(pUser->user, pUser->dbFName, pUser->type, key); + //int32_t len = userAuthToStringExt(pUser->user, pUser->dbFName, pUser->type, key); + int32_t len = 0; if (TSDB_CODE_SUCCESS != putMetaDataToHash(key, len, pUserAuthData, i, pUserAuth)) { return TSDB_CODE_OUT_OF_MEMORY; } diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 1af214bfb4..be4f3cd80b 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -279,15 +279,13 @@ int32_t __catalogGetDBCfg(SCatalog* pCtg, SRequestConnInfo* pConn, const char* d return g_mockCatalogService->catalogGetDBCfg(dbFName, pDbCfg); } -int32_t __catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, const char* user, const char* dbFName, AUTH_TYPE type, - bool* pass) { - *pass = true; +int32_t __catalogChkAuth(SCatalog* pCtg, SRequestConnInfo* pConn, SUserAuthInfo *pAuth, SUserAuthRes* pRes) { + pRes->pass = true; return 0; } -int32_t __catalogChkAuthFromCache(SCatalog* pCtg, const char* user, const char* dbFName, AUTH_TYPE type, bool* pass, - bool* exists) { - *pass = true; +int32_t __catalogChkAuthFromCache(SCatalog* pCtg, SUserAuthInfo *pAuth, SUserAuthRes* pRes, bool* exists) { + pRes->pass = true; *exists = true; return 0; } From df2ad9174db60e2c57216d6a9b714c382b5a9bb7 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Fri, 7 Apr 2023 11:05:09 +0800 Subject: [PATCH 20/71] test: change autogen.py random to fixed --- tests/pytest/util/autogen.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/pytest/util/autogen.py b/tests/pytest/util/autogen.py index 5c6445da7d..90cd347b9a 100644 --- a/tests/pytest/util/autogen.py +++ b/tests/pytest/util/autogen.py @@ -51,10 +51,7 @@ class AutoGen: metas = [] for i in range(cnt): colname = f"{pre}{i}" - if i < len(types): - sel = i - else: - sel = random.randint(0, len(types)-1) + sel = i % len(types) coltype = types[sel] sql = f"{colname} {coltype}" if sqls != "": From f44c2193600d2f3d8c85e5c57f3d3cca3f8b8ab5 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 7 Apr 2023 11:15:05 +0800 Subject: [PATCH 21/71] feat: table level privilege --- source/libs/catalog/test/CMakeLists.txt | 2 +- source/libs/nodes/src/nodesUtilFuncs.c | 12 ++- source/libs/parser/inc/parUtil.h | 6 +- source/libs/parser/src/parAstParser.c | 22 +++-- source/libs/parser/src/parAuthenticator.c | 82 +++++++++++------ source/libs/parser/src/parUtil.c | 89 +++++++++++-------- .../libs/parser/test/mockCatalogService.cpp | 4 +- 7 files changed, 133 insertions(+), 84 deletions(-) diff --git a/source/libs/catalog/test/CMakeLists.txt b/source/libs/catalog/test/CMakeLists.txt index dbbb24ce0b..de4d08835c 100644 --- a/source/libs/catalog/test/CMakeLists.txt +++ b/source/libs/catalog/test/CMakeLists.txt @@ -9,7 +9,7 @@ IF(NOT TD_DARWIN) ADD_EXECUTABLE(catalogTest ${SOURCE_LIST}) TARGET_LINK_LIBRARIES( catalogTest - PUBLIC os util common catalog transport gtest qcom taos_static + PUBLIC os util common nodes catalog transport gtest qcom taos_static ) TARGET_INCLUDE_DIRECTORIES( diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 8d6c3288b9..eff69e9764 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -923,9 +923,15 @@ void nodesDestroyNode(SNode* pNode) { taosMemoryFree(((SDescribeStmt*)pNode)->pMeta); break; case QUERY_NODE_RESET_QUERY_CACHE_STMT: // no pointer field - case QUERY_NODE_COMPACT_DATABASE_STMT: // no pointer field - case QUERY_NODE_CREATE_FUNCTION_STMT: // no pointer field - case QUERY_NODE_DROP_FUNCTION_STMT: // no pointer field + break; + case QUERY_NODE_COMPACT_DATABASE_STMT: { + SCompactDatabaseStmt* pStmt = (SCompactDatabaseStmt*)pNode; + nodesDestroyNode(pStmt->pStart); + nodesDestroyNode(pStmt->pEnd); + break; + } + case QUERY_NODE_CREATE_FUNCTION_STMT: // no pointer field + case QUERY_NODE_DROP_FUNCTION_STMT: // no pointer field break; case QUERY_NODE_CREATE_STREAM_STMT: { SCreateStreamStmt* pStmt = (SCreateStreamStmt*)pNode; diff --git a/source/libs/parser/inc/parUtil.h b/source/libs/parser/inc/parUtil.h index ce5a63f5d0..850571eea1 100644 --- a/source/libs/parser/inc/parUtil.h +++ b/source/libs/parser/inc/parUtil.h @@ -97,9 +97,8 @@ int32_t reserveTableVgroupInCache(int32_t acctId, const char* pDb, const char* p int32_t reserveTableVgroupInCacheExt(const SName* pName, SParseMetaCache* pMetaCache); int32_t reserveDbVgVersionInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache); int32_t reserveDbCfgInCache(int32_t acctId, const char* pDb, SParseMetaCache* pMetaCache); -int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type, +int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type, SParseMetaCache* pMetaCache); -int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache); int32_t reserveUdfInCache(const char* pFunc, SParseMetaCache* pMetaCache); int32_t reserveTableIndexInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache); int32_t reserveTableCfgInCache(int32_t acctId, const char* pDb, const char* pTable, SParseMetaCache* pMetaCache); @@ -110,8 +109,7 @@ int32_t getTableVgroupFromCache(SParseMetaCache* pMetaCache, const SName* pName, int32_t getDbVgVersionFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, int32_t* pVersion, int64_t* pDbId, int32_t* pTableNum, int64_t* pStateTs); int32_t getDbCfgFromCache(SParseMetaCache* pMetaCache, const char* pDbFName, SDbCfgInfo* pInfo); -int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type, - bool* pPass); +int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, SUserAuthInfo* pAuthReq, SUserAuthRes* pAuthRes); int32_t getUdfInfoFromCache(SParseMetaCache* pMetaCache, const char* pFunc, SFuncInfo* pInfo); int32_t getTableIndexFromCache(SParseMetaCache* pMetaCache, const SName* pName, SArray** pIndexes); int32_t getTableCfgFromCache(SParseMetaCache* pMetaCache, const SName* pName, STableCfg** pOutput); diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index fb6711ecb1..b416fc0d9a 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -154,7 +154,8 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pDb, pTable, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pDb, authType, pCxt->pMetaCache); + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pDb, pTable, authType, + pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, pDb, pCxt->pMetaCache); @@ -247,7 +248,7 @@ static int32_t collectMetaKeyFromCreateTable(SCollectMetaKeyCxt* pCxt, SCreateTa code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, AUTH_TYPE_WRITE, + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, NULL, AUTH_TYPE_WRITE, pCxt->pMetaCache); } return code; @@ -267,8 +268,8 @@ static int32_t collectMetaKeyFromCreateMultiTable(SCollectMetaKeyCxt* pCxt, SCre code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, AUTH_TYPE_WRITE, - pCxt->pMetaCache); + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, NULL, + AUTH_TYPE_WRITE, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS != code) { break; @@ -439,8 +440,9 @@ static int32_t collectMetaKeyFromShowStables(SCollectMetaKeyCxt* pCxt, SShowStmt int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_STABLES, pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, - ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); + code = + reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, ((SValueNode*)pStmt->pDbName)->literal, + NULL, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); } return code; } @@ -457,8 +459,9 @@ static int32_t collectMetaKeyFromShowTables(SCollectMetaKeyCxt* pCxt, SShowStmt* code = reserveDbVgInfoInCache(pCxt->pParseCxt->acctId, ((SValueNode*)pStmt->pDbName)->literal, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, - ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); + code = + reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, ((SValueNode*)pStmt->pDbName)->literal, + NULL, AUTH_TYPE_READ_OR_WRITE, pCxt->pMetaCache); } return code; } @@ -561,7 +564,8 @@ static int32_t collectMetaKeyFromShowCreateTable(SCollectMetaKeyCxt* pCxt, SShow code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); } if (TSDB_CODE_SUCCESS == code) { - code = reserveUserAuthInCacheExt(pCxt->pParseCxt->pUser, &name, AUTH_TYPE_READ, pCxt->pMetaCache); + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, NULL, AUTH_TYPE_READ, + pCxt->pMetaCache); } return code; } diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 039b46d8b8..66ba47af48 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -30,31 +30,40 @@ typedef struct SSelectAuthCxt { static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt); -static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, AUTH_TYPE type) { +static void setUserAuthInfo(SParseContext* pCxt, const char* pDbName, const char* pTabName, AUTH_TYPE type, + SUserAuthInfo* pAuth) { + snprintf(pAuth->user, sizeof(pAuth->user), "%s", pCxt->pUser); + if (NULL == pTabName) { + tNameSetDbName(&pAuth->tbName, pCxt->acctId, pDbName, strlen(pDbName)); + } else { + toName(pCxt->acctId, pDbName, pTabName, &pAuth->tbName); + } + pAuth->type = type; +} + +static int32_t checkAuth(SAuthCxt* pCxt, const char* pDbName, const char* pTabName, AUTH_TYPE type, SNode** pCond) { SParseContext* pParseCxt = pCxt->pParseCxt; if (pParseCxt->isSuperUser) { return TSDB_CODE_SUCCESS; } - SName name; - tNameSetDbName(&name, pParseCxt->acctId, pDbName, strlen(pDbName)); - char dbFname[TSDB_DB_FNAME_LEN] = {0}; - tNameGetFullDbName(&name, dbFname); - int32_t code = TSDB_CODE_SUCCESS; - bool pass = false; + + SUserAuthInfo authInfo = {0}; + setUserAuthInfo(pCxt->pParseCxt, pDbName, pTabName, type, &authInfo); + int32_t code = TSDB_CODE_SUCCESS; + SUserAuthRes authRes = {0}; if (NULL != pCxt->pMetaCache) { - code = getUserAuthFromCache(pCxt->pMetaCache, pParseCxt->pUser, dbFname, type, &pass); + code = getUserAuthFromCache(pCxt->pMetaCache, &authInfo, &authRes); } else { SRequestConnInfo conn = {.pTrans = pParseCxt->pTransporter, .requestId = pParseCxt->requestId, .requestObjRefId = pParseCxt->requestRid, .mgmtEps = pParseCxt->mgmtEpSet}; - - SUserAuthInfo authInfo = {0}; - SUserAuthRes authRes = {0}; - //code = catalogChkAuth(pParseCxt->pCatalog, &conn, pParseCxt->pUser, dbFname, type, &pass); code = catalogChkAuth(pParseCxt->pCatalog, &conn, &authInfo, &authRes); } - return TSDB_CODE_SUCCESS == code ? (pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code; + if (TSDB_CODE_SUCCESS == code && NULL != pCond) { + *pCond = authRes.pCond; + } + return TSDB_CODE_SUCCESS == code ? (authRes.pass ? TSDB_CODE_SUCCESS : TSDB_CODE_PAR_PERMISSION_DENIED) : code; } static EDealRes authSubquery(SAuthCxt* pCxt, SNode* pStmt) { @@ -81,30 +90,35 @@ static int32_t mergeStableTagCond(SNode** pWhere, SNode** pTagCond) { return code; } -static int32_t appendStableTagCond(SSelectStmt* pSelect, SNode* pTagCond) { +static int32_t appendStableTagCond(SNode** pWhere, SNode* pTagCond) { SNode* pTagCondCopy = nodesCloneNode(pTagCond); if (NULL == pTagCondCopy) { return TSDB_CODE_OUT_OF_MEMORY; } - if (NULL == pSelect->pWhere) { - pSelect->pWhere = pTagCondCopy; + if (NULL == *pWhere) { + *pWhere = pTagCondCopy; return TSDB_CODE_SUCCESS; } - if (QUERY_NODE_LOGIC_CONDITION == nodeType(pSelect->pWhere) && - LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)pSelect->pWhere)->condType) { - return nodesListStrictAppend(((SLogicConditionNode*)pSelect->pWhere)->pParameterList, pTagCondCopy); + if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pWhere) && + LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*pWhere)->condType) { + return nodesListStrictAppend(((SLogicConditionNode*)*pWhere)->pParameterList, pTagCondCopy); } - return mergeStableTagCond(&pSelect->pWhere, &pTagCondCopy); + return mergeStableTagCond(pWhere, &pTagCondCopy); } static EDealRes authSelectImpl(SNode* pNode, void* pContext) { SSelectAuthCxt* pCxt = pContext; SAuthCxt* pAuthCxt = pCxt->pAuthCxt; if (QUERY_NODE_REAL_TABLE == nodeType(pNode)) { - pAuthCxt->errCode = checkAuth(pAuthCxt, ((SRealTableNode*)pNode)->table.dbName, AUTH_TYPE_READ); + SNode* pTagCond = NULL; + STableNode* pTable = (STableNode*)pNode; + pAuthCxt->errCode = checkAuth(pAuthCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_READ, &pTagCond); + if (TSDB_CODE_SUCCESS == pAuthCxt->errCode && NULL != pTagCond) { + pAuthCxt->errCode = appendStableTagCond(&pCxt->pSelect->pWhere, pTagCond); + } return TSDB_CODE_SUCCESS == pAuthCxt->errCode ? DEAL_RES_CONTINUE : DEAL_RES_ERROR; } else if (QUERY_NODE_TEMP_TABLE == nodeType(pNode)) { return authSubquery(pAuthCxt, ((STempTableNode*)pNode)->pSubquery); @@ -134,11 +148,20 @@ static int32_t authDropUser(SAuthCxt* pCxt, SDropUserStmt* pStmt) { } static int32_t authDelete(SAuthCxt* pCxt, SDeleteStmt* pDelete) { - return checkAuth(pCxt, ((SRealTableNode*)pDelete->pFromTable)->table.dbName, AUTH_TYPE_WRITE); + SNode* pTagCond = NULL; + STableNode* pTable = (STableNode*)pDelete->pFromTable; + int32_t code = checkAuth(pCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_WRITE, &pTagCond); + if (TSDB_CODE_SUCCESS == code && NULL != pTagCond) { + code = appendStableTagCond(&pDelete->pWhere, pTagCond); + } + return code; } static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) { - int32_t code = checkAuth(pCxt, ((SRealTableNode*)pInsert->pTable)->table.dbName, AUTH_TYPE_WRITE); + SNode* pTagCond = NULL; + STableNode* pTable = (STableNode*)pInsert->pTable; + // todo check tag condition for subtable + int32_t code = checkAuth(pCxt, pTable->dbName, pTable->tableName, AUTH_TYPE_WRITE, &pTagCond); if (TSDB_CODE_SUCCESS == code) { code = authQuery(pCxt, pInsert->pQuery); } @@ -146,22 +169,27 @@ static int32_t authInsert(SAuthCxt* pCxt, SInsertStmt* pInsert) { } static int32_t authShowTables(SAuthCxt* pCxt, SShowStmt* pStmt) { - return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, AUTH_TYPE_READ_OR_WRITE); + return checkAuth(pCxt, ((SValueNode*)pStmt->pDbName)->literal, NULL, AUTH_TYPE_READ_OR_WRITE, NULL); } static int32_t authShowCreateTable(SAuthCxt* pCxt, SShowCreateTableStmt* pStmt) { - return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_READ); + SNode* pTagCond = NULL; + // todo check tag condition for subtable + return checkAuth(pCxt, pStmt->dbName, NULL, AUTH_TYPE_READ, &pTagCond); } static int32_t authCreateTable(SAuthCxt* pCxt, SCreateTableStmt* pStmt) { - return checkAuth(pCxt, pStmt->dbName, AUTH_TYPE_WRITE); + SNode* pTagCond = NULL; + // todo check tag condition for subtable + return checkAuth(pCxt, pStmt->dbName, NULL, AUTH_TYPE_WRITE, &pTagCond); } static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStmt) { int32_t code = TSDB_CODE_SUCCESS; SNode* pNode = NULL; FOREACH(pNode, pStmt->pSubTables) { - code = checkAuth(pCxt, ((SCreateSubTableClause*)pNode)->dbName, AUTH_TYPE_WRITE); + SCreateSubTableClause* pClause = (SCreateSubTableClause*)pNode; + code = checkAuth(pCxt, pClause->dbName, NULL, AUTH_TYPE_WRITE, NULL); if (TSDB_CODE_SUCCESS != code) { break; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 5c56d11b52..14da6f8aab 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -17,7 +17,7 @@ #include "cJSON.h" #include "querynodes.h" -#define USER_AUTH_KEY_MAX_LEN TSDB_USER_LEN + TSDB_DB_FNAME_LEN + 2 +#define USER_AUTH_KEY_MAX_LEN TSDB_USER_LEN + TSDB_TABLE_FNAME_LEN + 2 const void* nullPointer = NULL; @@ -496,24 +496,44 @@ int32_t getVnodeSysTableTargetName(int32_t acctId, SNode* pWhere, SName* pName) return TSDB_CODE_SUCCESS; } -static int32_t userAuthToString(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type, char* pStr) { - return sprintf(pStr, "%s*%d.%s*%d", pUser, acctId, pDb, type); +static int32_t userAuthToString(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type, + char* pStr) { + return sprintf(pStr, "%s*%d*%s*%s*%d", pUser, acctId, pDb, (NULL != pTable && '\0' == pTable[0]) ? NULL : pTable, + type); } -static int32_t userAuthToStringExt(const char* pUser, const char* pDbFName, AUTH_TYPE type, char* pStr) { - return sprintf(pStr, "%s*%s*%d", pUser, pDbFName, type); +static int32_t getIntegerFromAuthStr(const char* pStart, char** pNext) { + char* p = strchr(pStart, '*'); + char buf[10] = {0}; + if (NULL == p) { + strcpy(buf, pStart); + *pNext = NULL; + } else { + strncpy(buf, pStart, p - pStart); + *pNext = ++p; + } + return taosStr2Int32(buf, NULL, 10); +} + +static void getStringFromAuthStr(const char* pStart, char* pStr, char** pNext) { + char* p = strchr(pStart, '*'); + if (NULL == p) { + strcpy(pStr, pStart); + *pNext = NULL; + } else { + strncpy(pStr, pStart, p - pStart); + *pNext = ++p; + } } static void stringToUserAuth(const char* pStr, int32_t len, SUserAuthInfo* pUserAuth) { - char* p1 = strchr(pStr, '*'); - strncpy(pUserAuth->user, pStr, p1 - pStr); - ++p1; - char* p2 = strchr(p1, '*'); - //strncpy(pUserAuth->dbFName, p1, p2 - p1); - ++p2; - char buf[10] = {0}; - strncpy(buf, p2, len - (p2 - pStr)); - pUserAuth->type = taosStr2Int32(buf, NULL, 10); + char* p = NULL; + getStringFromAuthStr(pStr, pUserAuth->user, &p); + pUserAuth->tbName.acctId = getIntegerFromAuthStr(p, &p); + getStringFromAuthStr(p, pUserAuth->tbName.dbname, &p); + getStringFromAuthStr(p, pUserAuth->tbName.tname, &p); + pUserAuth->tbName.type = TSDB_TABLE_NAME_T; + pUserAuth->type = getIntegerFromAuthStr(p, &p); } static int32_t buildTableReq(SHashObj* pTablesHash, SArray** pTables) { @@ -584,10 +604,12 @@ static int32_t buildUserAuthReq(SHashObj* pUserAuthHash, SArray** pUserAuth) { } void* p = taosHashIterate(pUserAuthHash, NULL); while (NULL != p) { - size_t len = 0; - char* pKey = taosHashGetKey(p, &len); + size_t len = 0; + char* pKey = taosHashGetKey(p, &len); + char key[USER_AUTH_KEY_MAX_LEN] = {0}; + strncpy(key, pKey, len); SUserAuthInfo userAuth = {0}; - stringToUserAuth(pKey, len, &userAuth); + stringToUserAuth(key, len, &userAuth); taosArrayPush(*pUserAuth, &userAuth); p = taosHashIterate(pUserAuthHash, p); } @@ -712,8 +734,8 @@ static int32_t putUserAuthToCache(const SArray* pUserAuthReq, const SArray* pUse for (int32_t i = 0; i < nvgs; ++i) { SUserAuthInfo* pUser = taosArrayGet(pUserAuthReq, i); char key[USER_AUTH_KEY_MAX_LEN] = {0}; - //int32_t len = userAuthToStringExt(pUser->user, pUser->dbFName, pUser->type, key); - int32_t len = 0; + int32_t len = userAuthToString(pUser->tbName.acctId, pUser->user, pUser->tbName.dbname, pUser->tbName.tname, + pUser->type, key); if (TSDB_CODE_SUCCESS != putMetaDataToHash(key, len, pUserAuthData, i, pUserAuth)) { return TSDB_CODE_OUT_OF_MEMORY; } @@ -911,33 +933,24 @@ static int32_t reserveUserAuthInCacheImpl(const char* pKey, int32_t len, SParseM return TSDB_CODE_OUT_OF_MEMORY; } } - bool pass = false; - return taosHashPut(pMetaCache->pUserAuth, pKey, len, &pass, sizeof(pass)); + return taosHashPut(pMetaCache->pUserAuth, pKey, len, &nullPointer, POINTER_BYTES); } -int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, AUTH_TYPE type, +int32_t reserveUserAuthInCache(int32_t acctId, const char* pUser, const char* pDb, const char* pTable, AUTH_TYPE type, SParseMetaCache* pMetaCache) { char key[USER_AUTH_KEY_MAX_LEN] = {0}; - int32_t len = userAuthToString(acctId, pUser, pDb, type, key); + int32_t len = userAuthToString(acctId, pUser, pDb, pTable, type, key); return reserveUserAuthInCacheImpl(key, len, pMetaCache); } -int32_t reserveUserAuthInCacheExt(const char* pUser, const SName* pName, AUTH_TYPE type, SParseMetaCache* pMetaCache) { - char dbFName[TSDB_DB_FNAME_LEN] = {0}; - tNameGetFullDbName(pName, dbFName); - char key[USER_AUTH_KEY_MAX_LEN] = {0}; - int32_t len = userAuthToStringExt(pUser, dbFName, type, key); - return reserveUserAuthInCacheImpl(key, len, pMetaCache); -} - -int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, const char* pUser, const char* pDbFName, AUTH_TYPE type, - bool* pPass) { - char key[USER_AUTH_KEY_MAX_LEN] = {0}; - int32_t len = userAuthToStringExt(pUser, pDbFName, type, key); - bool* pRes = NULL; - int32_t code = getMetaDataFromHash(key, len, pMetaCache->pUserAuth, (void**)&pRes); +int32_t getUserAuthFromCache(SParseMetaCache* pMetaCache, SUserAuthInfo* pAuthReq, SUserAuthRes* pAuthRes) { + char key[USER_AUTH_KEY_MAX_LEN] = {0}; + int32_t len = userAuthToString(pAuthReq->tbName.acctId, pAuthReq->user, pAuthReq->tbName.dbname, + pAuthReq->tbName.tname, pAuthReq->type, key); + SUserAuthRes* pAuth = NULL; + int32_t code = getMetaDataFromHash(key, len, pMetaCache->pUserAuth, (void**)&pAuth); if (TSDB_CODE_SUCCESS == code) { - *pPass = *pRes; + memcpy(pAuthRes, pAuth, sizeof(SUserAuthRes)); } return code; } diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 4d1ef597d0..f6a8b407d7 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -589,8 +589,8 @@ class MockCatalogServiceImpl { *pUserAuthData = taosArrayInit(num, sizeof(SMetaRes)); for (int32_t i = 0; i < num; ++i) { SMetaRes res = {0}; - res.pRes = taosMemoryCalloc(1, sizeof(bool)); - *(bool*)(res.pRes) = true; + res.pRes = taosMemoryCalloc(1, sizeof(SUserAuthRes)); + ((SUserAuthRes*)res.pRes)->pass = true; taosArrayPush(*pUserAuthData, &res); } } From 8ae43fe6cb11140d3ca48a9bc5d865b21407056c Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 7 Apr 2023 15:28:23 +0800 Subject: [PATCH 22/71] fix(tsdb/read): use the correct schema for mem/imem rows --- source/dnode/vnode/src/tsdb/tsdbRead.c | 28 ++++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 0cf28c1ed1..b80c952ee0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -2215,8 +2215,16 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* int64_t key = hasDataInFileBlock(pBlockData, pDumpInfo) ? pBlockData->aTSKEY[pDumpInfo->rowIndex] : INT64_MIN; - TSDBKEY k = TSDBROW_KEY(pRow); - TSDBKEY ik = TSDBROW_KEY(piRow); + TSDBKEY k = TSDBROW_KEY(pRow); + TSDBKEY ik = TSDBROW_KEY(piRow); + STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid); + if (pSchema == NULL) { + return code; + } + STSchema* piSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid); + if (piSchema == NULL) { + return code; + } int64_t minKey = 0; if (ASCENDING_TRAVERSE(pReader->order)) { @@ -2288,15 +2296,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == ik.ts) { if (init) { - tsdbRowMergerAdd(&merge, piRow, NULL); + tsdbRowMergerAdd(&merge, piRow, piSchema); } else { init = true; - STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid); - if (pSchema == NULL) { - return code; - } - - code = tsdbRowMergerInit(&merge, NULL, piRow, pSchema); + code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -2315,7 +2318,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* return code; } - tsdbRowMergerAdd(&merge, pRow, NULL); + tsdbRowMergerAdd(&merge, pRow, pSchema); } else { STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid); code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema); @@ -2332,7 +2335,6 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* } else { if (minKey == k.ts) { init = true; - STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(pRow), pReader, pBlockScanInfo->uid); code = tsdbRowMergerInit(&merge, NULL, pRow, pSchema); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2347,11 +2349,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo* if (minKey == ik.ts) { if (init) { - tsdbRowMergerAdd(&merge, piRow, NULL); + tsdbRowMergerAdd(&merge, piRow, piSchema); } else { init = true; STSchema* pSchema = doGetSchemaForTSRow(TSDBROW_SVERSION(piRow), pReader, pBlockScanInfo->uid); - code = tsdbRowMergerInit(&merge, NULL, piRow, pSchema); + code = tsdbRowMergerInit(&merge, pSchema, piRow, piSchema); if (code != TSDB_CODE_SUCCESS) { return code; } From 0f2c7531036beb30a75b62fde96591f32391be3d Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 7 Apr 2023 16:39:40 +0800 Subject: [PATCH 23/71] feat: table level privilege --- source/dnode/mnode/impl/src/mndPrivilege.c | 1 + source/dnode/mnode/impl/src/mndUser.c | 104 ++++++++++----------- source/libs/parser/src/parInsertSql.c | 27 +++--- source/libs/parser/src/parTranslater.c | 50 +++++++++- 4 files changed, 110 insertions(+), 72 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index ccb4140b83..de0374c6e8 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -35,6 +35,7 @@ int32_t mndCheckTopicPrivilegeByName(SMnode *pMnode, const char *user, EOperType int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp) { memcpy(pRsp->user, pUser->user, TSDB_USER_LEN); pRsp->superAuth = 1; + pRsp->enable = pUser->enable; pRsp->version = pUser->authVersion; return 0; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 243053751e..5e562806a2 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -18,10 +18,10 @@ #include "mndDb.h" #include "mndPrivilege.h" #include "mndShow.h" +#include "mndStb.h" #include "mndTopic.h" #include "mndTrans.h" #include "tbase64.h" -#include "mndStb.h" #define USER_VER_NUMBER 3 #define USER_RESERVE_SIZE 64 @@ -128,8 +128,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs); int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs); int32_t numOfTopics = taosHashGetSize(pUser->topics); - int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + - (numOfReadDbs + numOfWriteDbs ) * TSDB_DB_FNAME_LEN + + int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs) * TSDB_DB_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN; char *stb = taosHashIterate(pUser->readTbs, NULL); @@ -152,7 +151,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { void *key = taosHashGetKey(stb, &keyLen); size += sizeof(int32_t); size += keyLen; - + size_t valueLen = 0; valueLen = strlen(stb); size += sizeof(int32_t); @@ -206,7 +205,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); size_t valueLen = 0; - valueLen = strlen(stb)+1; + valueLen = strlen(stb) + 1; SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); stb = taosHashIterate(pUser->readTbs, stb); @@ -218,9 +217,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { void *key = taosHashGetKey(stb, &keyLen); SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER) SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); - + size_t valueLen = 0; - valueLen = strlen(stb)+1; + valueLen = strlen(stb) + 1; SDB_SET_INT32(pRaw, dataPos, valueLen, _OVER) SDB_SET_BINARY(pRaw, dataPos, stb, valueLen, _OVER); stb = taosHashIterate(pUser->writeTbs, stb); @@ -283,7 +282,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { if (sver >= 2) { SDB_GET_INT32(pRaw, dataPos, &numOfTopics, _OVER) } - if(sver >= 3){ + if (sver >= 3) { SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER) } @@ -292,7 +291,8 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { pUser->writeDbs = taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - pUser->readTbs = taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->readTbs = + taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->writeTbs = taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER; @@ -320,7 +320,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { } } - if(sver >= 3){ + if (sver >= 3) { for (int32_t i = 0; i < numOfReadStbs; ++i) { int32_t keyLen = 0; SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); @@ -411,7 +411,7 @@ SHashObj *mndDupTableHash(SHashObj *pOld) { char *tb = taosHashIterate(pOld, NULL); while (tb != NULL) { size_t keyLen = 0; - char *key = taosHashGetKey(tb, &keyLen); + char *key = taosHashGetKey(tb, &keyLen); int32_t valueLen = strlen(tb) + 1; if (taosHashPut(pNew, key, keyLen, tb, valueLen) != 0) { @@ -647,7 +647,7 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); } -static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq){ +static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq) { char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; @@ -657,13 +657,13 @@ static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *a mndReleaseStb(pMnode, pStb); return -1; } - if(alterReq->tagCond == NULL){ + if (alterReq->tagCond == NULL) { mndReleaseStb(pMnode, pStb); return -1; } char *value = taosHashGet(hash, tbFName, len); - if(value != NULL){ + if (value != NULL) { mndReleaseStb(pMnode, pStb); terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST; return -1; @@ -678,16 +678,16 @@ static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *a return 0; } -static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ - void *pIter = NULL; - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; +static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) { + void *pIter = NULL; + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; - if(alterReq->tagCond != NULL && alterReq->tagCondLen != 0){ + if (alterReq->tagCond != NULL && alterReq->tagCondLen != 0) { char *value = taosHashGet(hash, tbFName, len); - if(value != NULL){ + if (value != NULL) { terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST; return -1; } @@ -696,8 +696,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { return -1; } - } - else{ + } else { if (taosHashPut(hash, tbFName, len, "t", 2) != 0) { return -1; } @@ -706,9 +705,9 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq return 0; } -static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb){ - void *pIter = NULL; - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; +static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) { + void *pIter = NULL; + char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); int32_t len = strlen(tbFName) + 1; @@ -859,21 +858,21 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) { - if(mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; + if (mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) { - if(mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; + if (mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } - if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG) { - if(mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; + if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG ) { - if(mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; + alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG) { + if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { @@ -887,11 +886,11 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) { - if(mndTagPriviledge(pMnode, newUser.readTbs, &alterReq) != 0) goto _OVER; + if (mndTagPriviledge(pMnode, newUser.readTbs, &alterReq) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) { - if(mndTagPriviledge(pMnode, newUser.writeTbs, &alterReq) != 0) goto _OVER; + if (mndTagPriviledge(pMnode, newUser.writeTbs, &alterReq) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) { @@ -1077,10 +1076,11 @@ static void mndCancelGetNextUser(SMnode *pMnode, void *pIter) { sdbCancelFetch(pSdb, pIter); } -static void mndLoopHash(SHashObj * hash, char *priType, SSDataBlock *pBlock, int32_t *numOfRows, char *user, SShowObj *pShow){ - char *value = taosHashIterate(hash, NULL); +static void mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, int32_t *numOfRows, char *user, + SShowObj *pShow) { + char *value = taosHashIterate(hash, NULL); int32_t cols = 0; - + while (value != NULL) { cols = 0; char userName[TSDB_USER_LEN + VARSTR_HEADER_SIZE] = {0}; @@ -1092,53 +1092,51 @@ static void mndLoopHash(SHashObj * hash, char *priType, SSDataBlock *pBlock, int STR_WITH_MAXSIZE_TO_VARSTR(privilege, priType, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)privilege, false); - + size_t keyLen = 0; void *key = taosHashGetKey(value, &keyLen); - char dbName[TSDB_DB_NAME_LEN] = {0}; + char dbName[TSDB_DB_NAME_LEN] = {0}; mndExtractShortDbNameFromStbFullName(key, dbName); - char dbNameContent[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + char dbNameContent[TSDB_DB_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(dbNameContent, dbName, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)dbNameContent, false); - char tableName[TSDB_TABLE_NAME_LEN] = {0}; + char tableName[TSDB_TABLE_NAME_LEN] = {0}; mndExtractTbNameFromStbFullName(key, tableName, TSDB_TABLE_NAME_LEN); - char tableNameContent[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; + char tableNameContent[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(tableNameContent, tableName, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)tableNameContent, false); - if(strcmp("t", value) != 0){ + if (strcmp("t", value) != 0) { SNode *pAst = NULL; int32_t sqlLen = 0; - char sql[TSDB_EXPLAIN_RESULT_ROW_SIZE] = {0}; + char sql[TSDB_EXPLAIN_RESULT_ROW_SIZE] = {0}; - if(nodesStringToNode(value, &pAst) == 0) { + if (nodesStringToNode(value, &pAst) == 0) { nodesNodeToSQL(pAst, sql, TSDB_EXPLAIN_RESULT_ROW_SIZE, &sqlLen); nodesDestroyNode(pAst); - } - else{ + } else { sqlLen = 5; sprintf(sql, "error"); } - //char *obj = taosMemoryMalloc(sqlLen + VARSTR_HEADER_SIZE + 1); - char obj[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; + // char *obj = taosMemoryMalloc(sqlLen + VARSTR_HEADER_SIZE + 1); + char obj[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(obj, sql, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); - //taosMemoryFree(obj); - } - else{ + // taosMemoryFree(obj); + } else { char condition[20] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)condition, false); } - + (*numOfRows)++; value = taosHashIterate(hash, value); } @@ -1180,12 +1178,12 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); - char tableName[20] = {0}; + char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); - char condition[20] = {0}; + char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index c97090dd48..d734479b98 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -837,32 +837,31 @@ static int32_t parseUsingClauseBottom(SInsertParseContext* pCxt, SVnodeModifyOpS return code; } +static void setUserAuthInfo(SParseContext* pCxt, SName* pTbName, SUserAuthInfo* pInfo) { + snprintf(pInfo->user, sizeof(pInfo->user), "%s", pCxt->pUser); + memcpy(&pInfo->tbName, pTbName, sizeof(SName)); + pInfo->type = AUTH_TYPE_WRITE; +} + static int32_t checkAuth(SParseContext* pCxt, SName* pTbName, bool* pMissCache) { - char dbFName[TSDB_DB_FNAME_LEN]; - tNameGetFullDbName(pTbName, dbFName); - int32_t code = TSDB_CODE_SUCCESS; - bool pass = true; - bool exists = true; + int32_t code = TSDB_CODE_SUCCESS; + SUserAuthInfo authInfo = {0}; + setUserAuthInfo(pCxt, pTbName, &authInfo); + SUserAuthRes authRes = {0}; + bool exists = true; if (pCxt->async) { - SUserAuthInfo authInfo = {0}; - SUserAuthRes authRes = {0}; -// code = catalogChkAuthFromCache(pCxt->pCatalog, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass, &exists); code = catalogChkAuthFromCache(pCxt->pCatalog, &authInfo, &authRes, &exists); } else { SRequestConnInfo conn = {.pTrans = pCxt->pTransporter, .requestId = pCxt->requestId, .requestObjRefId = pCxt->requestRid, .mgmtEps = pCxt->mgmtEpSet}; - SUserAuthInfo authInfo = {0}; - SUserAuthRes authRes = {0}; - //code = catalogChkAuth(pCxt->pCatalog, &conn, pCxt->pUser, dbFName, AUTH_TYPE_WRITE, &pass); code = catalogChkAuth(pCxt->pCatalog, &conn, &authInfo, &authRes); - } if (TSDB_CODE_SUCCESS == code) { if (!exists) { *pMissCache = true; - } else if (!pass) { + } else if (!authRes.pass) { code = TSDB_CODE_PAR_PERMISSION_DENIED; } } @@ -2023,7 +2022,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE}; snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser); - //tNameGetFullDbName(pName, userAuth.dbFName); + // tNameGetFullDbName(pName, userAuth.dbFName); taosArrayPush(*pUserAuth, &userAuth); return TSDB_CODE_SUCCESS; diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index cf621ef166..b8b445a335 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -976,7 +976,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p } static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) { - if (NULL == pCxt->pCurrStmt || isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) { + if (NULL == pCxt->pCurrStmt || + (isSelectStmt(pCxt->pCurrStmt) && NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, (*pCol)->colName); } @@ -6449,6 +6450,48 @@ static int32_t translateDropFunction(STranslateContext* pCxt, SDropFunctionStmt* return buildCmdMsg(pCxt, TDMT_MND_DROP_FUNC, (FSerializeFunc)tSerializeSDropFuncReq, &req); } +static int32_t createRealTableForGrantTable(SGrantStmt* pStmt, SRealTableNode** pTable) { + SRealTableNode* pRealTable = (SRealTableNode*)nodesMakeNode(QUERY_NODE_REAL_TABLE); + if (NULL == pRealTable) { + return TSDB_CODE_OUT_OF_MEMORY; + } + strcpy(pRealTable->table.dbName, pStmt->objName); + strcpy(pRealTable->table.tableName, pStmt->tabName); + strcpy(pRealTable->table.tableAlias, pStmt->tabName); + *pTable = pRealTable; + return TSDB_CODE_SUCCESS; +} + +static int32_t translateGrantTagCond(STranslateContext* pCxt, SGrantStmt* pStmt, SAlterUserReq* pReq) { + if (NULL == pStmt->pTagCond) { + return TSDB_CODE_SUCCESS; + } + if ('\0' == pStmt->tabName[0] || '*' == pStmt->tabName[0]) { + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, + "The With clause can only be used for table level privilege"); + } + + pCxt->pCurrStmt = (SNode*)pStmt; + SRealTableNode* pTable = NULL; + int32_t code = createRealTableForGrantTable(pStmt, &pTable); + if (TSDB_CODE_SUCCESS == code) { + SName name; + code = getTableMetaImpl(pCxt, toName(pCxt->pParseCxt->acctId, pTable->table.dbName, pTable->table.tableName, &name), + &(pTable->pMeta)); + } + if (TSDB_CODE_SUCCESS == code) { + code = addNamespace(pCxt, pTable); + } + if (TSDB_CODE_SUCCESS == code) { + code = translateExpr(pCxt, &pStmt->pTagCond); + } + if (TSDB_CODE_SUCCESS == code) { + code = nodesNodeToString(pStmt->pTagCond, false, &pReq->tagCond, &pReq->tagCondLen); + } + nodesDestroyNode((SNode*)pTable); + return code; +} + static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { SAlterUserReq req = {0}; if (BIT_FLAG_TEST_MASK(pStmt->privileges, PRIVILEGE_TYPE_ALL) || @@ -6465,10 +6508,7 @@ static int32_t translateGrant(STranslateContext* pCxt, SGrantStmt* pStmt) { strcpy(req.user, pStmt->userName); sprintf(req.objname, "%d.%s", pCxt->pParseCxt->acctId, pStmt->objName); sprintf(req.tabName, "%s", pStmt->tabName); - int32_t code = TSDB_CODE_SUCCESS; - if (NULL != pStmt->pTagCond) { - code = nodesNodeToString(pStmt->pTagCond, false, &req.tagCond, &req.tagCondLen); - } + int32_t code = translateGrantTagCond(pCxt, pStmt, &req); if (TSDB_CODE_SUCCESS == code) { code = buildCmdMsg(pCxt, TDMT_MND_ALTER_USER, (FSerializeFunc)tSerializeSAlterUserReq, &req); } From dd22347992be00bcef2466decb07eda290e73914 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 7 Apr 2023 17:05:23 +0800 Subject: [PATCH 24/71] fix:add tools to get tmq offset --- utils/test/c/CMakeLists.txt | 8 +++++ utils/test/c/tmqOffset.c | 64 +++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 utils/test/c/tmqOffset.c diff --git a/utils/test/c/CMakeLists.txt b/utils/test/c/CMakeLists.txt index 6ca266c555..85378221c6 100644 --- a/utils/test/c/CMakeLists.txt +++ b/utils/test/c/CMakeLists.txt @@ -5,6 +5,14 @@ add_executable(create_table createTable.c) add_executable(tmq_taosx_ci tmq_taosx_ci.c) add_executable(sml_test sml_test.c) add_executable(get_db_name_test get_db_name_test.c) +add_executable(tmq_offset tmqOffset.c) +target_link_libraries( + tmq_offset + PUBLIC taos_static + PUBLIC util + PUBLIC common + PUBLIC os +) target_link_libraries( create_table PUBLIC taos_static diff --git a/utils/test/c/tmqOffset.c b/utils/test/c/tmqOffset.c new file mode 100644 index 0000000000..50a9991a26 --- /dev/null +++ b/utils/test/c/tmqOffset.c @@ -0,0 +1,64 @@ +// +// Created by mingming wanng on 2023/4/7. +// +#include +#include +#include "taoserror.h" +#include "tlog.h" +#include "tmsg.h" + +typedef struct { + int32_t size; +} STqOffsetHead; + +int32_t tqOffsetRestoreFromFile(const char* fname) { + TdFilePtr pFile = taosOpenFile(fname, TD_FILE_READ); + if (pFile != NULL) { + STqOffsetHead head = {0}; + int32_t code; + + while (1) { + if ((code = taosReadFile(pFile, &head, sizeof(STqOffsetHead))) != sizeof(STqOffsetHead)) { + if (code == 0) { + break; + } else { + printf("code:%d != 0\n", code); + return -1; + } + } + int32_t size = htonl(head.size); + void* memBuf = taosMemoryCalloc(1, size); + if (memBuf == NULL) { + printf("memBuf == NULL\n"); + return -1; + } + if ((code = taosReadFile(pFile, memBuf, size)) != size) { + taosMemoryFree(memBuf); + printf("code:%d != size:%d\n", code, size); + return -1; + } + STqOffset offset; + SDecoder decoder; + tDecoderInit(&decoder, memBuf, size); + if (tDecodeSTqOffset(&decoder, &offset) < 0) { + taosMemoryFree(memBuf); + tDecoderClear(&decoder); + printf("tDecodeSTqOffset error\n"); + return -1; + } + + tDecoderClear(&decoder); + printf("subkey:%s, type:%d, uid/version:%lld, ts:%lld\n", + offset.subKey, offset.val.type, offset.val.uid, offset.val.ts); + taosMemoryFree(memBuf); + } + + taosCloseFile(&pFile); + } + return 0; +} + +int main(int argc, char *argv[]) { + tqOffsetRestoreFromFile("offset-ver0"); + return 0; +} From 5f700d59bd63ca8f1323a01a4068c09154cc486f Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 7 Apr 2023 17:10:00 +0800 Subject: [PATCH 25/71] fix:add tools to get tmq offset --- utils/test/c/tmqOffset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/test/c/tmqOffset.c b/utils/test/c/tmqOffset.c index 50a9991a26..5af56a6018 100644 --- a/utils/test/c/tmqOffset.c +++ b/utils/test/c/tmqOffset.c @@ -48,7 +48,7 @@ int32_t tqOffsetRestoreFromFile(const char* fname) { } tDecoderClear(&decoder); - printf("subkey:%s, type:%d, uid/version:%lld, ts:%lld\n", + printf("subkey:%s, type:%d, uid/version:%lld, ts:%"PRId64"\n", offset.subKey, offset.val.type, offset.val.uid, offset.val.ts); taosMemoryFree(memBuf); } From 9bb921d5a89e31ea40ec00a1e05d2b2e1cd1c6ce Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 7 Apr 2023 17:10:57 +0800 Subject: [PATCH 26/71] fix:add tools to get tmq offset --- utils/test/c/tmqOffset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/test/c/tmqOffset.c b/utils/test/c/tmqOffset.c index 5af56a6018..7225cb87bd 100644 --- a/utils/test/c/tmqOffset.c +++ b/utils/test/c/tmqOffset.c @@ -48,7 +48,7 @@ int32_t tqOffsetRestoreFromFile(const char* fname) { } tDecoderClear(&decoder); - printf("subkey:%s, type:%d, uid/version:%lld, ts:%"PRId64"\n", + printf("subkey:%s, type:%d, uid/version:%"PRId64", ts:%"PRId64"\n", offset.subKey, offset.val.type, offset.val.uid, offset.val.ts); taosMemoryFree(memBuf); } From 1c6bf2d1d36fb912a6604e732246bdc6644edfaf Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 7 Apr 2023 18:08:49 +0800 Subject: [PATCH 27/71] fix: fix nullbitmap shift error when trimming data blocks. --- source/common/src/tdatablock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index a65f30f023..af42ca6040 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1590,12 +1590,13 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) { i += 1; } } else if (n > 8) { - int32_t gap = len - newLen; + int32_t remain = (total % 8 <= tail) ? 1 : 0; + int32_t gap = len - newLen - remain; while (i < newLen) { uint8_t v = p[i + gap]; p[i] = (v << tail); - if (i < newLen - 1) { + if (i < newLen - 1 + remain) { uint8_t next = p[i + gap + 1]; p[i] |= (next >> (8 - tail)); } From d1decca07ee57709bdd4d4be2d07e376ace580cc Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Fri, 7 Apr 2023 18:22:07 +0800 Subject: [PATCH 28/71] fix: table level privilege --- source/common/src/tmsg.c | 6 ++++-- source/libs/catalog/src/ctgUtil.c | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 30bf900803..7d517e3e1e 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1524,6 +1524,8 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs pRsp->createdDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->readDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) { return -1; } @@ -1579,7 +1581,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); if (tDecodeCStrTo(pDecoder, value) < 0) return -1; - taosHashPut(pRsp->readTbs, key, keyLen, value, valuelen); + taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen); taosMemoryFree(key); taosMemoryFree(value); @@ -1597,7 +1599,7 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); if (tDecodeCStrTo(pDecoder, value) < 0) return -1; - taosHashPut(pRsp->writeTbs, key, keyLen, value, valuelen); + taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen); taosMemoryFree(key); taosMemoryFree(value); diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 501ad63dce..4fd5f126f3 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -1337,11 +1337,13 @@ int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { STableMeta *pMeta = NULL; SGetUserAuthRsp *pInfo = &req->authInfo; SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs; - - char *pCond = taosHashGet(pTbs, req->pRawReq->tbName.tname, strlen(req->pRawReq->tbName.tname)); + + char tbFullName[TSDB_TABLE_FNAME_LEN]; + tNameExtractFullName(&req->pRawReq->tbName, tbFullName); + char *pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName)); if (pCond) { if (strlen(pCond) > 1) { - CTG_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); + CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); } res->pRawRes->pass = true; From f6f4e8133340ef33a53135dcca0934a6077464dc Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Fri, 7 Apr 2023 18:24:06 +0800 Subject: [PATCH 29/71] test:add testcase of childtale_from_to --- .../5-taos-tools/taosbenchmark/default_json.py | 4 ++-- .../5-taos-tools/taosbenchmark/json/default.json | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py index 7599c82483..f5aa181aed 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py +++ b/tests/develop-test/5-taos-tools/taosbenchmark/default_json.py @@ -61,9 +61,9 @@ class TDTestCase: os.system("%s" % cmd) tdSql.execute("reset query cache") tdSql.query("show db.tables") - tdSql.checkRows(10) + tdSql.checkRows(8) tdSql.query("select count(*) from db.stb") - tdSql.checkData(0, 0, 100) + tdSql.checkData(0, 0, 80) def stop(self): tdSql.close() diff --git a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json index da22ef75e2..c841e90b51 100644 --- a/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json +++ b/tests/develop-test/5-taos-tools/taosbenchmark/json/default.json @@ -15,13 +15,18 @@ "num_of_records_per_req": 10, "databases": [{ "dbinfo": { - "name": "db" + "name": "db", + "drop": "yes" + }, "super_tables": [{ + "child_table_exists":"no", "name": "stb", "childtable_prefix": "stb_", "childtable_count": 10, "insert_rows": 10, + "childtable_from": 1, + "childtable_to": 9, "columns": [{"type": "INT"}], "tags": [{"type": "INT"}] }] From af5a16b129040dd953a79ec73bcebdf80f76c317 Mon Sep 17 00:00:00 2001 From: slzhou Date: Fri, 7 Apr 2023 18:54:37 +0800 Subject: [PATCH 30/71] fix: set block allocated to false for each call to downstream operator --- source/libs/executor/src/aggregateoperator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/aggregateoperator.c b/source/libs/executor/src/aggregateoperator.c index d5fc507b94..ec8060348d 100644 --- a/source/libs/executor/src/aggregateoperator.c +++ b/source/libs/executor/src/aggregateoperator.c @@ -172,9 +172,9 @@ int32_t doOpenAggregateOptr(SOperatorInfo* pOperator) { int32_t scanFlag = MAIN_SCAN; bool hasValidBlock = false; - bool blockAllocated = false; while (1) { + bool blockAllocated = false; SSDataBlock* pBlock = downstream->fpSet.getNextFn(downstream); if (pBlock == NULL) { if (!hasValidBlock) { @@ -570,4 +570,4 @@ void functionCtxRestore(SqlFunctionCtx* pCtx, SFunctionCtxStatus* pStatus) { pCtx->input.colDataSMAIsSet = pStatus->hasAgg; pCtx->input.numOfRows = pStatus->numOfRows; pCtx->input.startRowIndex = pStatus->startOffset; -} \ No newline at end of file +} From 8b063357e1b39ab44d137d94fda78ff2412219ec Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 7 Apr 2023 18:08:49 +0800 Subject: [PATCH 31/71] fix: fix nullbitmap shift error when trimming data blocks. --- tests/system-test/2-query/limit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/limit.py b/tests/system-test/2-query/limit.py index c00e3b7d56..f51ed06008 100644 --- a/tests/system-test/2-query/limit.py +++ b/tests/system-test/2-query/limit.py @@ -288,7 +288,7 @@ class TDTestCase: tdSql.checkData(0, 3, 5.000000000) tdSql.checkData(0, 4, 5.000000000) tdSql.checkData(0, 5, 0.000000000) - tdSql.checkData(0, 7, 1) + tdSql.checkData(0, 7, None) tdSql.checkData(0, 8, "binary5") tdSql.checkData(0, 9, "nchar5") tdSql.checkData(1, 8, None) From 2d0dad7a37d32278fa21883fc1daa32880bb5b1d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 7 Apr 2023 18:08:49 +0800 Subject: [PATCH 32/71] fix: fix nullbitmap shift error when trimming data blocks. --- source/common/src/tdatablock.c | 2 +- tests/system-test/2-query/limit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index af42ca6040..0dd8cb9b0c 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1590,7 +1590,7 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) { i += 1; } } else if (n > 8) { - int32_t remain = (total % 8 <= tail) ? 1 : 0; + int32_t remain = (total % 8 != 0 && total % 8 <= tail) ? 1 : 0; int32_t gap = len - newLen - remain; while (i < newLen) { uint8_t v = p[i + gap]; diff --git a/tests/system-test/2-query/limit.py b/tests/system-test/2-query/limit.py index f51ed06008..c00e3b7d56 100644 --- a/tests/system-test/2-query/limit.py +++ b/tests/system-test/2-query/limit.py @@ -288,7 +288,7 @@ class TDTestCase: tdSql.checkData(0, 3, 5.000000000) tdSql.checkData(0, 4, 5.000000000) tdSql.checkData(0, 5, 0.000000000) - tdSql.checkData(0, 7, None) + tdSql.checkData(0, 7, 1) tdSql.checkData(0, 8, "binary5") tdSql.checkData(0, 9, "nchar5") tdSql.checkData(1, 8, None) From 4f23578a79c2f64362b4bf7508a5975aeacaf99b Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 7 Apr 2023 19:53:11 +0800 Subject: [PATCH 33/71] fix:add err log --- source/client/src/clientTmq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/client/src/clientTmq.c b/source/client/src/clientTmq.c index befcb00ac7..0ee9a7bd7d 100644 --- a/source/client/src/clientTmq.c +++ b/source/client/src/clientTmq.c @@ -1151,6 +1151,7 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { }; if (tsem_init(¶m.rspSem, 0, 0) != 0) { + code = TSDB_CODE_TSC_INTERNAL_ERROR; goto FAIL; } @@ -1186,6 +1187,8 @@ int32_t tmq_subscribe(tmq_t* tmq, const tmq_list_t* topic_list) { int32_t retryCnt = 0; while (TSDB_CODE_MND_CONSUMER_NOT_READY == doAskEp(tmq)) { if (retryCnt++ > MAX_RETRY_COUNT) { + tscError("consumer:0x%" PRIx64 ", mnd not ready for subscribe, retry:%d in 500ms", tmq->consumerId, retryCnt); + code = TSDB_CODE_TSC_INTERNAL_ERROR; goto FAIL; } From 7dbe4f6ca1c15b64c2da742d8eb83fe1d0251934 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sat, 8 Apr 2023 00:50:43 +0800 Subject: [PATCH 34/71] fix: cfg name release script community main (#20818) * chore: cus name support in script * chore: merge with 3.0 * fix: source/common/src/tglobal.c * fix: source/common/src/tglobal.c --- source/common/src/tglobal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 1c2d533977..56e34da4ce 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -20,6 +20,10 @@ #include "tlog.h" #include "tmisce.h" +#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) +#include "cus_name.h" +#endif + GRANT_CFG_DECLARE; SConfig *tsCfg = NULL; @@ -229,7 +233,7 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input taosExpandDir(inputCfgDir, cfgDir, PATH_MAX); if (taosIsDir(cfgDir)) { #ifdef CUS_PROMPT - snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "%s.cfg", CUS_PROMPT, cfgDir); + snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "%s.cfg", cfgDir, CUS_PROMPT); #else snprintf(cfgFile, sizeof(cfgFile), "%s" TD_DIRSEP "taos.cfg", cfgDir); #endif From 55c265f85f20fa02abc08f2d5a426a3ec069acab Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 8 Apr 2023 18:07:29 +0800 Subject: [PATCH 35/71] test: add new feature with previous cluster running case --- tests/system-test/test.py | 78 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 0c62c182f7..7bccbf12c8 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -13,6 +13,7 @@ # pip install src/connector/python/ # -*- coding: utf-8 -*- +import os import sys import getopt import subprocess @@ -22,6 +23,7 @@ import json import platform import socket import threading +import importlib import toml sys.path.append("../pytest") @@ -53,8 +55,39 @@ def checkRunTimeError(): if hwnd: os.system("TASKKILL /F /IM taosd.exe") +# +# run case on previous cluster +# +def runOnPreviousCluster(host, config, fileName): + print("enter run on previeous") + + # load case module + sep = "/" + if platform.system().lower() == 'windows': + sep = os.sep + moduleName = fileName.replace(".py", "").replace(sep, ".") + uModule = importlib.import_module(moduleName) + case = uModule.TDTestCase() + + # create conn + conn = taos.connect(host, config) + + # run case + case.init(conn, True) + try: + case.run() + except Exception as e: + tdLog.notice(repr(e)) + tdLog.exit("%s failed" % (fileName)) + # stop + case.stop() + + if __name__ == "__main__": + # + # analysis paramaters + # fileName = "all" deployPath = "" masterIp = "" @@ -75,8 +108,9 @@ if __name__ == "__main__": replicaVar = 1 asan = False independentMnode = True - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:a', [ - 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode']) + previousCluster = False + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:a:P', [ + 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode','previous']) for key, value in opts: if key in ['-h', '--help']: tdLog.printNoPrefix( @@ -101,6 +135,7 @@ if __name__ == "__main__": tdLog.printNoPrefix('-n the number of replicas') tdLog.printNoPrefix('-i independentMnode Mnode') tdLog.printNoPrefix('-a address sanitizer mode') + tdLog.printNoPrefix('-P run case with [P]revious cluster, do not create new cluster to run case.') sys.exit(0) @@ -182,6 +217,12 @@ if __name__ == "__main__": if key in ['-n', '--replicaVar']: replicaVar = value + if key in ['-P', '--previous']: + previousCluster = True + + # + # do exeCmd command + # if not execCmd == "": if restful: tAdapter.init(deployPath) @@ -191,6 +232,9 @@ if __name__ == "__main__": exec(execCmd) quit() + # + # do stop option + # if (stop != 0): if (valgrind == 0): toBeKilled = "taosd" @@ -248,6 +292,9 @@ if __name__ == "__main__": tdLog.info('stop All dnodes') + # + # get hostname + # if masterIp == "": host = socket.gethostname() else: @@ -256,8 +303,20 @@ if __name__ == "__main__": host = config["host"] except Exception as r: host = masterIp - tdLog.info("Procedures for tdengine deployed in %s" % (host)) + + # + # do previousCluster option + # + if previousCluster: + tdDnodes.init(deployPath, masterIp) + runOnPreviousCluster(host, tdDnodes.getSimCfgPath(), fileName) + tdLog.info("run on previous cluster end.") + quit() + + # + # windows run + # if platform.system().lower() == 'windows': fileName = fileName.replace("/", os.sep) if (masterIp == "" and not fileName == "0-others\\udf_create.py"): @@ -387,6 +446,10 @@ if __name__ == "__main__": tdCases.runOneWindows(conn, fileName) else: tdCases.runAllWindows(conn) + + # + # linux run + # else: tdDnodes.setKillValgrind(killValgrind) tdDnodes.init(deployPath, masterIp) @@ -418,6 +481,7 @@ if __name__ == "__main__": tAdapter.stop(force_kill=True) if dnodeNums == 1 : + # dnode is one tdDnodes.deploy(1,updateCfgDict) tdDnodes.start(1) tdCases.logSql(logSql) @@ -429,7 +493,7 @@ if __name__ == "__main__": if queryPolicy != 1: queryPolicy=int(queryPolicy) if not restful: - conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) + conn = taos.connect(host,config = tdDnodes.getSimCfgPath()) else: conn = taosrest.connect(url=f"http://{host}:6041") # tdSql.init(conn.cursor()) @@ -458,6 +522,7 @@ if __name__ == "__main__": tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") else : + # dnode > 1 cluster tdLog.debug("create an cluster with %s nodes and make %s dnode as independent mnode"%(dnodeNums,mnodeNums)) dnodeslist = cluster.configure_cluster(dnodeNums=dnodeNums, mnodeNums=mnodeNums, independentMnode=independentMnode) tdDnodes = ClusterDnodes(dnodeslist) @@ -476,6 +541,7 @@ if __name__ == "__main__": tAdapter.deploy(adapter_cfg_dict) tAdapter.start() + # create taos connect if not restful: conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: @@ -494,6 +560,7 @@ if __name__ == "__main__": except Exception as r: print(r) + # do queryPolicy option if queryPolicy != 1: queryPolicy=int(queryPolicy) if restful: @@ -515,6 +582,7 @@ if __name__ == "__main__": tdLog.exit(f"alter queryPolicy to {queryPolicy} failed") + # run case if testCluster: tdLog.info("Procedures for testing cluster") if fileName == "all": @@ -533,6 +601,7 @@ if __name__ == "__main__": else: tdCases.runOneLinux(conn, fileName, replicaVar) + # do restart option if restart: if fileName == "all": tdLog.info("not need to query ") @@ -552,6 +621,7 @@ if __name__ == "__main__": else: tdLog.info("not need to query") + # close for end if conn is not None: conn.close() if asan: From e5e144e4208e986859e722372d5a1e34867d18a9 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Sat, 8 Apr 2023 19:22:21 +0800 Subject: [PATCH 36/71] test: reset modify --- tests/system-test/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/system-test/test.py b/tests/system-test/test.py index 7bccbf12c8..e8d307fdd9 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -73,7 +73,7 @@ def runOnPreviousCluster(host, config, fileName): conn = taos.connect(host, config) # run case - case.init(conn, True) + case.init(conn, False) try: case.run() except Exception as e: @@ -493,7 +493,7 @@ if __name__ == "__main__": if queryPolicy != 1: queryPolicy=int(queryPolicy) if not restful: - conn = taos.connect(host,config = tdDnodes.getSimCfgPath()) + conn = taos.connect(host,config=tdDnodes.getSimCfgPath()) else: conn = taosrest.connect(url=f"http://{host}:6041") # tdSql.init(conn.cursor()) From f89301b5cd24a4c651b57a5f9828c44d00f9f997 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Sun, 9 Apr 2023 10:51:38 +0800 Subject: [PATCH 37/71] fix: taosdump in diff type for main (#20825) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index b427177e5b..0110b27b32 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 63635fc + GIT_TAG 149ac34 SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE From 015c81cdb02f0185b766c2839e01a6389fd8efcc Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Sun, 9 Apr 2023 20:43:18 +0800 Subject: [PATCH 38/71] feat(release): install taosx and taos-explorer service for enterprise --- packaging/tools/install.sh | 36 ++++++++++++++++++++++++++++++++++++ packaging/tools/makepkg.sh | 1 + packaging/tools/remove.sh | 22 +++++++++++++++++++++- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 858a6ac668..63ea55cf82 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -572,6 +572,20 @@ function install_config() { done } +function install_share_etc() { + for c in `ls ${script_dir}/share/etc/`; do + if [ -e /etc/$c ]; then + out=/etc/$c.new.`date +%F` + echo -e -n "${RED} /etc/$c exists, save a new cfg file as $out" + ${csudo}cp -f ${script_dir}/share/etc/$c $out + else + ${csudo}cp -f ${script_dir}/share/etc/$c /etc/$c + fi + done + + ${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} +} + function install_log() { ${csudo}rm -rf ${log_dir} || : ${csudo}mkdir -p ${log_dir} && ${csudo}chmod 777 ${log_dir} @@ -685,11 +699,33 @@ function clean_service_on_systemd() { # if [ "$verMode" == "cluster" ] && [ "$clientName" != "$clientName2" ]; then # ${csudo}rm -f ${service_config_dir}/${serverName2}.service # fi + x_service_config="${service_config_dir}/${xName2}.service" + if [ -e "$x_service_config" ]; then + if systemctl is-active --quiet ${xName2}; then + echo "${productName2} ${xName2} is running, stopping it..." + ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${x_service_config} + fi + + explorer_service_config="${service_config_dir}/${explorerName2}.service" + if [ -e "$explorer_service_config" ]; then + if systemctl is-active --quiet ${explorerName2}; then + echo "${productName2} ${explorerName2} is running, stopping it..." + ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${explorer_service_config} + ${csudo}rm -f /etc/${clientName2}/explorer.toml + fi } function install_service_on_systemd() { clean_service_on_systemd + install_share_etc + [ -f ${script_dir}/cfg/${serverName2}.service ] && ${csudo}cp ${script_dir}/cfg/${serverName2}.service \ ${service_config_dir}/ || : diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 8a41b13ccb..12e215c62b 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -150,6 +150,7 @@ fi mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm +mkdir -p ${install_dir}/share && cp -rf ${build_dir}/share/{etc,srv} ${install_dir}/share if [ $adapterName != "taosadapter" ]; then mv ${install_dir}/cfg/${clientName2}adapter.toml ${install_dir}/cfg/$adapterName.toml diff --git a/packaging/tools/remove.sh b/packaging/tools/remove.sh index 8ed3bd74b9..6c671473bf 100755 --- a/packaging/tools/remove.sh +++ b/packaging/tools/remove.sh @@ -192,7 +192,27 @@ function clean_service_on_systemd() { ${csudo}systemctl stop ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null fi ${csudo}systemctl disable ${tarbitrator_service_name} &>/dev/null || echo &>/dev/null - ${csudo}rm -f ${tarbitratord_service_config} + + x_service_config="${service_config_dir}/${xName2}.service" + if [ -e "$x_service_config" ]; then + if systemctl is-active --quiet ${xName2}; then + echo "${productName2} ${xName2} is running, stopping it..." + ${csudo}systemctl stop ${xName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${xName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${x_service_config} + fi + + explorer_service_config="${service_config_dir}/${explorerName2}.service" + if [ -e "$explorer_service_config" ]; then + if systemctl is-active --quiet ${explorerName2}; then + echo "${productName2} ${explorerName2} is running, stopping it..." + ${csudo}systemctl stop ${explorerName2} &>/dev/null || echo &>/dev/null + fi + ${csudo}systemctl disable ${explorerName2} &>/dev/null || echo &>/dev/null + ${csudo}rm -f ${explorer_service_config} + ${csudo}rm -f /etc/${clientName2}/explorer.toml + fi } function clean_service_on_sysvinit() { From 637bf33c5154999c6c29e48f2152a0b62faf2de0 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 10 Apr 2023 10:53:29 +0800 Subject: [PATCH 39/71] fix: catalog unit test --- source/libs/catalog/test/catalogTests.cpp | 149 ++++++++++------------ 1 file changed, 69 insertions(+), 80 deletions(-) diff --git a/source/libs/catalog/test/catalogTests.cpp b/source/libs/catalog/test/catalogTests.cpp index bdced0074e..3d3a8161ad 100644 --- a/source/libs/catalog/test/catalogTests.cpp +++ b/source/libs/catalog/test/catalogTests.cpp @@ -27,8 +27,8 @@ #ifdef WINDOWS #define TD_USE_WINSOCK #endif -#include "catalogInt.h" #include "catalog.h" +#include "catalogInt.h" #include "os.h" #include "stub.h" #include "taos.h" @@ -48,7 +48,7 @@ void ctgTestSetRspCTableMeta(); void ctgTestSetRspSTableMeta(); void ctgTestSetRspMultiSTableMeta(); -extern int32_t clientConnRefPool; +extern int32_t clientConnRefPool; enum { CTGT_RSP_VGINFO = 1, @@ -298,7 +298,7 @@ void ctgTestBuildSTableMetaRsp(STableMetaRsp *rspMsg) { void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + SUseDbRsp usedbRsp = {0}; strcpy(usedbRsp.db, ctgTestDbname); usedbRsp.vgVersion = ctgTestVgVersion; @@ -343,7 +343,7 @@ void ctgTestRspDbVgroups(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + STableMetaRsp metaRsp = {0}; strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.tbName, ctgTestTablename); @@ -384,13 +384,13 @@ void ctgTestRspTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * void ctgTestRspTableMetaNotExist(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + pRsp->code = CTG_ERR_CODE_TABLE_NOT_EXIST; } void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + STableMetaRsp metaRsp = {0}; strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.tbName, ctgTestCurrentCTableName ? ctgTestCurrentCTableName : ctgTestCTablename); @@ -438,7 +438,7 @@ void ctgTestRspCTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + STableMetaRsp metaRsp = {0}; strcpy(metaRsp.dbFName, ctgTestDbname); strcpy(metaRsp.tbName, ctgTestCurrentSTableName ? ctgTestCurrentSTableName : ctgTestSTablename); @@ -450,7 +450,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg metaRsp.sversion = ctgTestSVersion; metaRsp.tversion = ctgTestTVersion; metaRsp.suid = ctgTestSuid; - metaRsp.tuid = ctgTestSuid+1; + metaRsp.tuid = ctgTestSuid + 1; metaRsp.vgId = 0; metaRsp.pSchemas = (SSchema *)taosMemoryMalloc((metaRsp.numOfTags + metaRsp.numOfColumns) * sizeof(SSchema)); @@ -486,7 +486,7 @@ void ctgTestRspSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + static int32_t idx = 1; STableMetaRsp metaRsp = {0}; @@ -536,16 +536,14 @@ void ctgTestRspMultiSTableMeta(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRp tFreeSTableMetaRsp(&metaRsp); } - void ctgTestRspErrIndexInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + pRsp->code = TSDB_CODE_MND_DB_INDEX_NOT_EXIST; pRsp->contLen = 0; pRsp->pCont = NULL; } - void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); @@ -553,6 +551,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p strcpy(userRsp.user, ctgTestUsername); userRsp.version = 1; userRsp.superAuth = 1; + userRsp.enable = 1; int32_t contLen = tSerializeSGetUserAuthRsp(NULL, 0, &userRsp); void *pReq = rpcMallocCont(contLen); @@ -565,7 +564,7 @@ void ctgTestRspUserAuth(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + static int32_t idx = 1; STableCfgRsp tblRsp = {0}; @@ -600,7 +599,7 @@ void ctgTestRspTableCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + static int32_t idx = 1; STableIndexRsp tblRsp = {0}; @@ -611,10 +610,10 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg STableIndexInfo info = {0}; for (int32_t i = 0; i < ctgTestIndexNum; ++i) { info.interval = 1 + i; - info.expr = (char*)taosMemoryCalloc(1, 10); + info.expr = (char *)taosMemoryCalloc(1, 10); taosArrayPush(tblRsp.pIndex, &info); } - + int32_t contLen = tSerializeSTableIndexRsp(NULL, 0, &tblRsp); void *pReq = rpcMallocCont(contLen); tSerializeSTableIndexRsp(pReq, contLen, &tblRsp); @@ -628,12 +627,12 @@ void ctgTestRspTableIndex(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg void ctgTestRspDBCfg(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { rpcFreeCont(pMsg->pCont); - + static int32_t idx = 1; SDbCfgRsp dbRsp = {0}; dbRsp.numOfVgroups = ctgTestVgNum; - + int32_t contLen = tSerializeSDbCfgRsp(NULL, 0, &dbRsp); void *pReq = rpcMallocCont(contLen); tSerializeSDbCfgRsp(pReq, contLen, &dbRsp); @@ -651,7 +650,7 @@ void ctgTestRspQnodeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg * for (int32_t i = 0; i < ctgTestQnodeNum; ++i) { SQueryNodeLoad nodeLoad = {0}; nodeLoad.addr.nodeId = i; - + (void)taosArrayPush(qlistRsp.qnodeList, &nodeLoad); } @@ -675,7 +674,7 @@ void ctgTestRspUdfInfo(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pR SFuncInfo funcInfo = {0}; strcpy(funcInfo.name, "func1"); funcInfo.funcType = ctgTestFuncType; - + (void)taosArrayPush(funcRsp.pFuncInfos, &funcInfo); int32_t rspLen = tSerializeSRetrieveFuncRsp(NULL, 0, &funcRsp); @@ -694,7 +693,7 @@ void ctgTestRspSvrVer(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRs SServerVerRsp verRsp = {0}; strcpy(verRsp.ver, "1.0"); - + int32_t rspLen = tSerializeSServerVerRsp(NULL, 0, &verRsp); void *pReq = rpcMallocCont(rspLen); tSerializeSServerVerRsp(pReq, rspLen, &verRsp); @@ -713,9 +712,9 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p epSet.numOfEps = 1; tstrncpy(epSet.eps[0].fqdn, "localhost", TSDB_FQDN_LEN); epSet.eps[0].port = 6030; - + (void)taosArrayPush(dRsp.dnodeList, &epSet); - + int32_t rspLen = tSerializeSDnodeListRsp(NULL, 0, &dRsp); void *pReq = rpcMallocCont(rspLen); tSerializeSDnodeListRsp(pReq, rspLen, &dRsp); @@ -727,8 +726,6 @@ void ctgTestRspDndeList(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *p tFreeSDnodeListRsp(&dRsp); } - - void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { switch (pMsg->msgType) { case TDMT_MND_USE_DB: @@ -745,7 +742,7 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) ctgTestRspDBCfg(shandle, pEpSet, pMsg, pRsp); break; case TDMT_MND_QNODE_LIST: - ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp); + ctgTestRspQnodeList(shandle, pEpSet, pMsg, pRsp); break; case TDMT_MND_RETRIEVE_FUNC: ctgTestRspUdfInfo(shandle, pEpSet, pMsg, pRsp); @@ -763,7 +760,6 @@ void ctgTestRspAuto(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) return; } - void ctgTestRspByIdx(void *shandle, SEpSet *pEpSet, SRpcMsg *pMsg, SRpcMsg *pRsp) { switch (ctgTestRspFunc[ctgTestRspIdx]) { case CTGT_RSP_VGINFO: @@ -1058,7 +1054,7 @@ void ctgTestSetRspDbVgroupsAndMultiSuperMeta() { void *ctgTestGetDbVgroupThread(void *param) { struct SCatalog *pCtg = (struct SCatalog *)param; int32_t code = 0; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SArray *vgList = NULL; int32_t n = 0; @@ -1204,7 +1200,6 @@ void *ctgTestSetCtableMetaThread(void *param) { return NULL; } - void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) { TAOS_ROW row; int num_fields = taos_num_fields(result); @@ -1220,23 +1215,22 @@ void ctgTestFetchRows(TAOS_RES *result, int32_t *rows) { } } -void ctgTestExecQuery(TAOS * taos, char* sql, bool fetch, int32_t *rows) { +void ctgTestExecQuery(TAOS *taos, char *sql, bool fetch, int32_t *rows) { TAOS_RES *result = taos_query(taos, sql); - int code = taos_errno(result); + int code = taos_errno(result); ASSERT_EQ(code, 0); if (fetch) { ctgTestFetchRows(result, rows); } - + taos_free_result(result); } - TEST(tableMeta, normalTable) { struct SCatalog *pCtg = NULL; SVgroupInfo vgInfo = {0}; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -1372,7 +1366,7 @@ TEST(tableMeta, normalTable) { TEST(tableMeta, childTableCase) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; @@ -1484,7 +1478,7 @@ TEST(tableMeta, childTableCase) { TEST(tableMeta, superTableCase) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; @@ -1626,7 +1620,7 @@ TEST(tableMeta, superTableCase) { TEST(tableMeta, rmStbMeta) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; @@ -1696,7 +1690,7 @@ TEST(tableMeta, rmStbMeta) { TEST(tableMeta, updateStbMeta) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; @@ -1785,7 +1779,7 @@ TEST(tableMeta, updateStbMeta) { TEST(getIndexInfo, notExists) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -1809,13 +1803,13 @@ TEST(getIndexInfo, notExists) { SIndexInfo info; code = catalogGetIndexMeta(pCtg, mockPointer, "index1", &info); ASSERT_TRUE(code != 0); - + catalogDestroy(); } TEST(refreshGetMeta, normal2normal) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -1894,7 +1888,7 @@ TEST(refreshGetMeta, normal2normal) { TEST(refreshGetMeta, normal2notexist) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -1964,7 +1958,7 @@ TEST(refreshGetMeta, normal2notexist) { TEST(refreshGetMeta, normal2child) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -2045,10 +2039,9 @@ TEST(refreshGetMeta, normal2child) { ctgTestCurrentSTableName = NULL; } - TEST(refreshGetMeta, stable2child) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -2134,7 +2127,7 @@ TEST(refreshGetMeta, stable2child) { TEST(refreshGetMeta, stable2stable) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -2220,7 +2213,7 @@ TEST(refreshGetMeta, stable2stable) { TEST(refreshGetMeta, child2stable) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SArray *vgList = NULL; @@ -2306,7 +2299,7 @@ TEST(refreshGetMeta, child2stable) { TEST(tableDistVgroup, normalTable) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo *vgInfo = NULL; SArray *vgList = NULL; @@ -2343,7 +2336,7 @@ TEST(tableDistVgroup, normalTable) { TEST(tableDistVgroup, childTableCase) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo *vgInfo = NULL; SArray *vgList = NULL; @@ -2381,7 +2374,7 @@ TEST(tableDistVgroup, childTableCase) { TEST(tableDistVgroup, superTableCase) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo *vgInfo = NULL; SArray *vgList = NULL; @@ -2430,7 +2423,7 @@ TEST(tableDistVgroup, superTableCase) { TEST(dbVgroup, getSetDbVgroupCase) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SVgroupInfo *pvgInfo = NULL; @@ -2520,7 +2513,7 @@ TEST(dbVgroup, getSetDbVgroupCase) { TEST(multiThread, getSetRmSameDbVgroup) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SVgroupInfo *pvgInfo = NULL; @@ -2572,7 +2565,7 @@ TEST(multiThread, getSetRmSameDbVgroup) { TEST(multiThread, getSetRmDiffDbVgroup) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SVgroupInfo *pvgInfo = NULL; @@ -2624,7 +2617,7 @@ TEST(multiThread, getSetRmDiffDbVgroup) { TEST(multiThread, ctableMeta) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SVgroupInfo *pvgInfo = NULL; @@ -2675,7 +2668,7 @@ TEST(multiThread, ctableMeta) { TEST(rentTest, allRent) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; SVgroupInfo vgInfo = {0}; SVgroupInfo *pvgInfo = NULL; @@ -2754,7 +2747,7 @@ TEST(rentTest, allRent) { TEST(apiTest, catalogRefreshDBVgInfo_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2781,7 +2774,7 @@ TEST(apiTest, catalogRefreshDBVgInfo_test) { TEST(apiTest, catalogChkAuth_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2801,7 +2794,7 @@ TEST(apiTest, catalogChkAuth_test) { ASSERT_EQ(code, 0); SUserAuthInfo authInfo = {0}; - SUserAuthRes authRes = {0}; + SUserAuthRes authRes = {0}; strcpy(authInfo.user, ctgTestUsername); toName(1, ctgTestDbname, ctgTestSTablename, &authInfo.tbName); authInfo.type = AUTH_TYPE_READ; @@ -2834,7 +2827,7 @@ TEST(apiTest, catalogChkAuth_test) { TEST(apiTest, catalogRefreshGetTableCfg_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2872,7 +2865,7 @@ TEST(apiTest, catalogRefreshGetTableCfg_test) { TEST(apiTest, catalogGetTableIndex_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2908,7 +2901,7 @@ TEST(apiTest, catalogGetTableIndex_test) { TEST(apiTest, catalogGetDBCfg_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2941,7 +2934,7 @@ TEST(apiTest, catalogGetDBCfg_test) { TEST(apiTest, catalogGetQnodeList_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -2966,17 +2959,16 @@ TEST(apiTest, catalogGetQnodeList_test) { ASSERT_EQ(taosArrayGetSize(qnodeList), ctgTestQnodeNum); for (int32_t i = 0; i < ctgTestQnodeNum; ++i) { - SQueryNodeLoad * pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i); + SQueryNodeLoad *pLoad = (SQueryNodeLoad *)taosArrayGet(qnodeList, i); ASSERT_EQ(pLoad->addr.nodeId, i); } catalogDestroy(); } - TEST(apiTest, catalogGetUdfInfo_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -3003,10 +2995,9 @@ TEST(apiTest, catalogGetUdfInfo_test) { catalogDestroy(); } - TEST(apiTest, catalogGetServerVersion_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -3025,7 +3016,7 @@ TEST(apiTest, catalogGetServerVersion_test) { code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); - char* ver = NULL; + char *ver = NULL; code = catalogGetServerVersion(pCtg, mockPointer, &ver); ASSERT_EQ(code, 0); ASSERT_TRUE(0 == strcmp(ver, "1.0")); @@ -3035,7 +3026,7 @@ TEST(apiTest, catalogGetServerVersion_test) { TEST(apiTest, catalogUpdateTableIndex_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -3065,10 +3056,9 @@ TEST(apiTest, catalogUpdateTableIndex_test) { catalogDestroy(); } - TEST(apiTest, catalogGetDnodeList_test) { struct SCatalog *pCtg = NULL; - SRequestConnInfo connInfo = {0}; + SRequestConnInfo connInfo = {0}; SRequestConnInfo *mockPointer = (SRequestConnInfo *)&connInfo; ctgTestInitLogFile(); @@ -3087,7 +3077,7 @@ TEST(apiTest, catalogGetDnodeList_test) { code = catalogGetHandle(ctgTestClusterId, &pCtg); ASSERT_EQ(code, 0); - SArray* pList = NULL; + SArray *pList = NULL; code = catalogGetDnodeList(pCtg, mockPointer, &pList); ASSERT_EQ(code, 0); ASSERT_EQ(taosArrayGetSize(pList), 1); @@ -3099,23 +3089,23 @@ TEST(apiTest, catalogGetDnodeList_test) { #ifdef INTEGRATION_TEST TEST(intTest, autoCreateTableTest) { - struct SCatalog *pCtg = NULL; + struct SCatalog *pCtg = NULL; - TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); - ASSERT_TRUE(NULL != taos); + TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 0); + ASSERT_TRUE(NULL != taos); ctgdEnableDebug("api", true); ctgdEnableDebug("meta", true); ctgdEnableDebug("cache", true); ctgdEnableDebug("lock", true); - + ctgTestExecQuery(taos, "drop database if exists db1", false, NULL); ctgTestExecQuery(taos, "create database db1", false, NULL); ctgTestExecQuery(taos, "create stable db1.st1 (ts timestamp, f1 int) tags(tg1 int)", false, NULL); ctgTestExecQuery(taos, "insert into db1.tb1 using db1.st1 tags(1) values(now, 1)", false, NULL); ctgdGetOneHandle(&pCtg); - + while (true) { uint32_t n = ctgdGetClusterCacheNum(pCtg, CTG_DBG_META_NUM); if (2 != n) { @@ -3141,15 +3131,14 @@ TEST(intTest, autoCreateTableTest) { ctgTestExecQuery(taos, "alter table db1.st1 add column f2 double", false, NULL); ctgdEnableDebug("stopUpdate", false); - + ctgTestExecQuery(taos, "insert into db1.tb1 (ts, f1) values(now, 4)", false, NULL); - + taos_close(taos); } #endif - int main(int argc, char **argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); From 95d5de0275db888cfca24a263de13a2df5429220 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 10 Apr 2023 11:28:19 +0800 Subject: [PATCH 40/71] test: fixed gnu_opt memory leak --- tests/system-test/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/test.py b/tests/system-test/test.py index e8d307fdd9..a34dc28586 100644 --- a/tests/system-test/test.py +++ b/tests/system-test/test.py @@ -109,7 +109,7 @@ if __name__ == "__main__": asan = False independentMnode = True previousCluster = False - opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:a:P', [ + opts, args = getopt.gnu_getopt(sys.argv[1:], 'f:p:m:l:scghrd:k:e:N:M:Q:C:RD:n:i:aP', [ 'file=', 'path=', 'master', 'logSql', 'stop', 'cluster', 'valgrind', 'help', 'restart', 'updateCfgDict', 'killv', 'execCmd','dnodeNums','mnodeNums','queryPolicy','createDnodeNums','restful','adaptercfgupdate','replicaVar','independentMnode','previous']) for key, value in opts: if key in ['-h', '--help']: From 28e7fed972b07c7e883b1d5f94fa06830f1c7dbb Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 10 Apr 2023 13:55:00 +0800 Subject: [PATCH 41/71] test: add runSllOne.sh --- tests/system-test/runAllOne.sh | 689 +++++++++++++++++++++++++++++++++ 1 file changed, 689 insertions(+) create mode 100644 tests/system-test/runAllOne.sh diff --git a/tests/system-test/runAllOne.sh b/tests/system-test/runAllOne.sh new file mode 100644 index 0000000000..0877555f36 --- /dev/null +++ b/tests/system-test/runAllOne.sh @@ -0,0 +1,689 @@ +# start -N3 +echo " ********** -N 3 *************" +python3 ./test.py -f 7-tmq/tmqDelete-multiCtb.py -N 3 -n 3 +python3 ./test.py -f 1-insert/alter_database.py -P +python3 ./test.py -f 1-insert/influxdb_line_taosc_insert.py -P +python3 ./test.py -f 1-insert/opentsdb_telnet_line_taosc_insert.py -P +python3 ./test.py -f 1-insert/opentsdb_json_taosc_insert.py -P +python3 ./test.py -f 1-insert/test_stmt_muti_insert_query.py -P +python3 ./test.py -f 1-insert/test_stmt_set_tbname_tag.py -P +python3 ./test.py -f 1-insert/alter_stable.py -P +python3 ./test.py -f 1-insert/alter_table.py -P +python3 ./test.py -f 1-insert/boundary.py -P +python3 ./test.py -f 1-insert/insertWithMoreVgroup.py -P +python3 ./test.py -f 1-insert/table_comment.py -P +python3 ./test.py -f 1-insert/time_range_wise.py -P +python3 ./test.py -f 1-insert/block_wise.py -P +python3 ./test.py -f 1-insert/create_retentions.py -P +python3 ./test.py -f 1-insert/mutil_stage.py -P +python3 ./test.py -f 1-insert/table_param_ttl.py -P +python3 ./test.py -f 1-insert/table_param_ttl.py -P -R +python3 ./test.py -f 1-insert/update_data_muti_rows.py -P +python3 ./test.py -f 1-insert/db_tb_name_check.py -P +python3 ./test.py -f 1-insert/InsertFuturets.py -P +python3 ./test.py -f 1-insert/insert_wide_column.py -P +python3 ./test.py -f 2-query/nestedQuery.py -P +python3 ./test.py -f 2-query/nestedQuery_str.py -P +python3 ./test.py -f 2-query/nestedQuery_math.py -P +python3 ./test.py -f 2-query/nestedQuery_time.py -P +python3 ./test.py -f 2-query/nestedQuery_26.py -P +python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 2 +python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 2 +python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 2 +python3 ./test.py -f 2-query/nestedQuery.py -P -Q 2 +python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 2 +python3 ./test.py -f 2-query/columnLenUpdated.py -P +python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 2 +python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 3 +python3 ./test.py -f 2-query/columnLenUpdated.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 4 +python3 ./test.py -f 7-tmq/tmqShow.py -P +python3 ./test.py -f 7-tmq/tmqDropStb.py -P +python3 ./test.py -f 7-tmq/subscribeStb0.py -P +python3 ./test.py -f 7-tmq/subscribeStb1.py -P +python3 ./test.py -f 7-tmq/subscribeStb2.py -P +python3 ./test.py -f 7-tmq/subscribeStb3.py -P +python3 ./test.py -f 7-tmq/subscribeDb0.py -P -N 3 -n 3 +python3 ./test.py -f 1-insert/delete_stable.py -P +python3 ./test.py -f 2-query/out_of_order.py -P -Q 3 +python3 ./test.py -f 2-query/out_of_order.py -P +python3 ./test.py -f 2-query/insert_null_none.py -P +python3 ./test.py -f 2-query/insert_null_none.py -P -R +python3 ./test.py -f 2-query/insert_null_none.py -P -Q 2 +python3 ./test.py -f 2-query/insert_null_none.py -P -Q 3 +python3 ./test.py -f 2-query/insert_null_none.py -P -Q 4 +python3 ./test.py -f 1-insert/database_pre_suf.py -P +python3 ./test.py -f 2-query/concat.py -P -Q 3 +python3 ./test.py -f 2-query/out_of_order.py -P -Q 2 +python3 ./test.py -f 2-query/out_of_order.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQuery.py -P -Q 3 +python3 ./test.py -f 2-query/nestedQuery_str.py -P -Q 3 +python3 ./test.py -f 2-query/nestedQuery_math.py -P -Q 3 +python3 ./test.py -f 2-query/nestedQuery_time.py -P -Q 3 +python3 ./test.py -f 2-query/nestedQuery_26.py -P -Q 3 +python3 ./test.py -f 7-tmq/create_wrong_topic.py -P +python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -P -N 3 +python3 ./test.py -f 7-tmq/basic5.py -P +python3 ./test.py -f 7-tmq/subscribeDb.py -P -N 3 -n 3 +python3 ./test.py -f 7-tmq/subscribeDb1.py -P +python3 ./test.py -f 7-tmq/subscribeDb2.py -P +python3 ./test.py -f 7-tmq/subscribeDb3.py -P +python3 ./test.py -f 7-tmq/subscribeDb4.py -P +python3 ./test.py -f 7-tmq/subscribeStb.py -P +python3 ./test.py -f 7-tmq/subscribeStb4.py -P +python3 ./test.py -f 7-tmq/db.py -P +python3 ./test.py -f 7-tmq/tmqError.py -P +python3 ./test.py -f 7-tmq/schema.py -P +python3 ./test.py -f 7-tmq/stbFilter.py -P +python3 ./test.py -f 7-tmq/tmqCheckData.py -P +python3 ./test.py -f 7-tmq/tmqCheckData1.py -P +python3 ./test.py -f 7-tmq/tmqConsumerGroup.py -P +python3 ./test.py -f 7-tmq/tmqAlterSchema.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb.py -P -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1.py -P -N 3 -n 3 +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-1ctb-funcNFilter.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb-funcNFilter.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py -P +python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py -P +python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py -P +python3 ./test.py -f 7-tmq/tmqDnodeRestart.py -P +python3 ./test.py -f 7-tmq/tmqDnodeRestart1.py -P +python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py -P +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py -P +python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot1.py -P +python3 ./test.py -f 7-tmq/tmqDropStbCtb.py -P +python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot0.py -P +python3 ./test.py -f 7-tmq/tmqDropNtb-snapshot1.py -P +python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot0.py -P +python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py -P +python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py -P +python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py -P +python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py -P +python3 ./test.py -f 7-tmq/tmq_taosx.py -P +python3 ./test.py -f 7-tmq/raw_block_interface_test.py -P +python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py -P +python3 ./test.py -f 99-TDcase/TD-19201.py -P +python3 ./test.py -f 99-TDcase/TD-21561.py -P +python3 ./test.py -f 0-others/taosShell.py -P +python3 ./test.py -f 0-others/taosShellError.py -P +python3 ./test.py -f 0-others/taosShellNetChk.py -P +python3 ./test.py -f 0-others/telemetry.py -P +python3 ./test.py -f 0-others/backquote_check.py -P +python3 ./test.py -f 0-others/taosdMonitor.py -P +python3 ./test.py -f 0-others/udfTest.py -P +python3 ./test.py -f 0-others/udf_create.py -P +python3 ./test.py -f 0-others/udf_restart_taosd.py -P +python3 ./test.py -f 0-others/udf_cfg1.py -P +python3 ./test.py -f 0-others/udf_cfg2.py -P +python3 ./test.py -f 0-others/cachemodel.py -P +python3 ./test.py -f 0-others/sysinfo.py -P +python3 ./test.py -f 0-others/user_control.py -P +python3 ./test.py -f 0-others/user_manage.py -P +python3 ./test.py -f 0-others/fsync.py -P +python3 ./test.py -f 0-others/compatibility.py -P +python3 ./test.py -f 0-others/tag_index_basic.py -P +python3 ./test.py -f 0-others/show.py -P +python3 ./test.py -f 0-others/information_schema.py -P +python3 ./test.py -f 2-query/abs.py -P +python3 ./test.py -f 2-query/abs.py -P -R +python3 ./test.py -f 2-query/and_or_for_byte.py -P +python3 ./test.py -f 2-query/and_or_for_byte.py -P -R +python3 ./test.py -f 2-query/apercentile.py -P +python3 ./test.py -f 2-query/apercentile.py -P -R +python3 ./test.py -f 2-query/arccos.py -P +python3 ./test.py -f 2-query/arccos.py -P -R +python3 ./test.py -f 2-query/arcsin.py -P +python3 ./test.py -f 2-query/arcsin.py -P -R +python3 ./test.py -f 2-query/arctan.py -P +python3 ./test.py -f 2-query/arctan.py -P -R +python3 ./test.py -f 2-query/avg.py -P +python3 ./test.py -f 2-query/avg.py -P -R +python3 ./test.py -f 2-query/between.py -P +python3 ./test.py -f 2-query/between.py -P -R +python3 ./test.py -f 2-query/bottom.py -P +python3 ./test.py -f 2-query/bottom.py -P -R +python3 ./test.py -f 2-query/cast.py -P +python3 ./test.py -f 2-query/cast.py -P -R +python3 ./test.py -f 2-query/ceil.py -P +python3 ./test.py -f 2-query/ceil.py -P -R +python3 ./test.py -f 2-query/char_length.py -P +python3 ./test.py -f 2-query/char_length.py -P -R +python3 ./test.py -f 2-query/check_tsdb.py -P +python3 ./test.py -f 2-query/check_tsdb.py -P -R +python3 ./test.py -f 2-query/concat.py -P +python3 ./test.py -f 2-query/concat.py -P -R +python3 ./test.py -f 2-query/concat_ws.py -P +python3 ./test.py -f 2-query/concat_ws.py -P -R +python3 ./test.py -f 2-query/concat_ws2.py -P +python3 ./test.py -f 2-query/concat_ws2.py -P -R +python3 ./test.py -f 2-query/cos.py -P +python3 ./test.py -f 2-query/cos.py -P -R +python3 ./test.py -f 2-query/count_partition.py -P +python3 ./test.py -f 2-query/count_partition.py -P -R +python3 ./test.py -f 2-query/count.py -P +python3 ./test.py -f 2-query/count.py -P -R +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -R +python3 ./test.py -f 2-query/db.py -P +python3 ./test.py -f 2-query/diff.py -P +python3 ./test.py -f 2-query/diff.py -P -R +python3 ./test.py -f 2-query/distinct.py -P +python3 ./test.py -f 2-query/distinct.py -P -R +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -R +python3 ./test.py -f 2-query/distribute_agg_avg.py -P +python3 ./test.py -f 2-query/distribute_agg_avg.py -P -R +python3 ./test.py -f 2-query/distribute_agg_count.py -P +python3 ./test.py -f 2-query/distribute_agg_count.py -P -R +python3 ./test.py -f 2-query/distribute_agg_max.py -P +python3 ./test.py -f 2-query/distribute_agg_max.py -P -R +python3 ./test.py -f 2-query/distribute_agg_min.py -P +python3 ./test.py -f 2-query/distribute_agg_min.py -P -R +python3 ./test.py -f 2-query/distribute_agg_spread.py -P +python3 ./test.py -f 2-query/distribute_agg_spread.py -P -R +python3 ./test.py -f 2-query/distribute_agg_stddev.py -P +python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -R +python3 ./test.py -f 2-query/distribute_agg_sum.py -P +python3 ./test.py -f 2-query/distribute_agg_sum.py -P -R +python3 ./test.py -f 2-query/explain.py -P +python3 ./test.py -f 2-query/explain.py -P -R +python3 ./test.py -f 2-query/first.py -P +python3 ./test.py -f 2-query/first.py -P -R +python3 ./test.py -f 2-query/floor.py -P +python3 ./test.py -f 2-query/floor.py -P -R +python3 ./test.py -f 2-query/function_null.py -P +python3 ./test.py -f 2-query/function_null.py -P -R +python3 ./test.py -f 2-query/function_stateduration.py -P +python3 ./test.py -f 2-query/function_stateduration.py -P -R +python3 ./test.py -f 2-query/histogram.py -P +python3 ./test.py -f 2-query/histogram.py -P -R +python3 ./test.py -f 2-query/hyperloglog.py -P +python3 ./test.py -f 2-query/hyperloglog.py -P -R +python3 ./test.py -f 2-query/interp.py -P +python3 ./test.py -f 2-query/interp.py -P -R +python3 ./test.py -f 2-query/irate.py -P +python3 ./test.py -f 2-query/irate.py -P -R +python3 ./test.py -f 2-query/join.py -P +python3 ./test.py -f 2-query/join.py -P -R +python3 ./test.py -f 2-query/last_row.py -P +python3 ./test.py -f 2-query/last_row.py -P -R +python3 ./test.py -f 2-query/last.py -P +python3 ./test.py -f 2-query/last.py -P -R +python3 ./test.py -f 2-query/leastsquares.py -P +python3 ./test.py -f 2-query/leastsquares.py -P -R +python3 ./test.py -f 2-query/length.py -P +python3 ./test.py -f 2-query/length.py -P -R +python3 ./test.py -f 2-query/limit.py -P +python3 ./test.py -f 2-query/log.py -P +python3 ./test.py -f 2-query/log.py -P -R +python3 ./test.py -f 2-query/lower.py -P +python3 ./test.py -f 2-query/lower.py -P -R +python3 ./test.py -f 2-query/ltrim.py -P +python3 ./test.py -f 2-query/ltrim.py -P -R +python3 ./test.py -f 2-query/mavg.py -P +python3 ./test.py -f 2-query/mavg.py -P -R +python3 ./test.py -f 2-query/max_partition.py -P +python3 ./test.py -f 2-query/max_partition.py -P -R +python3 ./test.py -f 2-query/max_min_last_interval.py -P +python3 ./test.py -f 2-query/last_row_interval.py -P +python3 ./test.py -f 2-query/max.py -P +python3 ./test.py -f 2-query/max.py -P -R +python3 ./test.py -f 2-query/min.py -P +python3 ./test.py -f 2-query/min.py -P -R +python3 ./test.py -f 2-query/mode.py -P +python3 ./test.py -f 2-query/mode.py -P -R +python3 ./test.py -f 2-query/Now.py -P +python3 ./test.py -f 2-query/Now.py -P -R +python3 ./test.py -f 2-query/percentile.py -P +python3 ./test.py -f 2-query/percentile.py -P -R +python3 ./test.py -f 2-query/pow.py -P +python3 ./test.py -f 2-query/pow.py -P -R +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -R +python3 ./test.py -f 2-query/round.py -P +python3 ./test.py -f 2-query/round.py -P -R +python3 ./test.py -f 2-query/rtrim.py -P +python3 ./test.py -f 2-query/rtrim.py -P -R +python3 ./test.py -f 1-insert/drop.py -P -N 3 -M 3 -i False -n 3 +python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py -P -N 3 -n 3 +python3 ./test.py -f 2-query/db.py -P -N 3 -n 3 -R +python3 ./test.py -f 2-query/stablity.py -P +python3 ./test.py -f 2-query/stablity_1.py -P +python3 ./test.py -f 2-query/elapsed.py -P +python3 ./test.py -f 2-query/csum.py -P +python3 ./test.py -f 2-query/function_diff.py -P +python3 ./test.py -f 2-query/tagFilter.py -P +python3 ./test.py -f 2-query/projectionDesc.py -P +python3 ./test.py -f 2-query/queryQnode.py -P +python3 ./test.py -f 6-cluster/5dnode1mnode.py -P + + +# -N 4 +echo " ********** -N 4 *************" +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas.py -P -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica1_insertdatas_querys.py -P -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas.py -P -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_insertdatas_querys.py -P -N 4 -M 1 +python3 ./test.py -f 6-cluster/vnode/4dnode1mnode_basic_replica3_vgroups.py -P -N 4 -M 1 +python3 ./test.py -f 2-query/varchar.py -P -R +python3 ./test.py -f 2-query/case_when.py -P +python3 ./test.py -f 2-query/case_when.py -P -R +python3 ./test.py -f 2-query/blockSMA.py -P +python3 ./test.py -f 2-query/blockSMA.py -P -R +python3 ./test.py -f 2-query/projectionDesc.py -P +python3 ./test.py -f 2-query/projectionDesc.py -P -R +python3 ./test.py -f 1-insert/update_data.py -P +python3 ./test.py -f 1-insert/tb_100w_data_order.py -P +python3 ./test.py -f 1-insert/delete_childtable.py -P +python3 ./test.py -f 1-insert/delete_normaltable.py -P +python3 ./test.py -f 1-insert/keep_expired.py -P +python3 ./test.py -f 1-insert/drop.py -P +python3 ./test.py -f 2-query/join2.py -P +python3 ./test.py -f 2-query/union1.py -P +python3 ./test.py -f 2-query/concat2.py -P +python3 ./test.py -f 2-query/json_tag.py -P +python3 ./test.py -f 2-query/nestedQueryInterval.py -P + + +# -N 5 +echo " ********** -N 5 *************" +python3 ./test.py -f 6-cluster/5dnode2mnode.py -P -N 5 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3 -i False +python3 ./test.py -f 6-cluster/5dnode3mnodeStopLoop.py -P -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -P -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -P -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -P -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop.py -P -N 5 -M 3 +python3 ./test.py -f 0-others/taosdShell.py -P -N 5 -M 3 -Q 3 +python3 ./test.py -f 7-tmq/tmqSubscribeStb-r3.py -P -N 5 +python3 ./test.py -f 2-query/timezone.py -P +python3 ./test.py -f 2-query/timezone.py -P -R +python3 ./test.py -f 2-query/To_iso8601.py -P +python3 ./test.py -f 2-query/To_iso8601.py -P -R +python3 ./test.py -f 2-query/To_unixtimestamp.py -P +python3 ./test.py -f 2-query/To_unixtimestamp.py -P -R +python3 ./test.py -f 2-query/Today.py -P +python3 ./test.py -f 2-query/Today.py -P -R +python3 ./test.py -f 2-query/top.py -P +python3 ./test.py -f 2-query/top.py -P -R +python3 ./test.py -f 2-query/tsbsQuery.py -P +python3 ./test.py -f 2-query/tsbsQuery.py -P -R +python3 ./test.py -f 2-query/ttl_comment.py -P +python3 ./test.py -f 2-query/ttl_comment.py -P -R +python3 ./test.py -f 2-query/twa.py -P +python3 ./test.py -f 2-query/twa.py -P -R +python3 ./test.py -f 2-query/union.py -P +python3 ./test.py -f 2-query/union.py -P -R +python3 ./test.py -f 2-query/unique.py -P +python3 ./test.py -f 2-query/unique.py -P -R +python3 ./test.py -f 2-query/upper.py -P +python3 ./test.py -f 2-query/upper.py -P -R +python3 ./test.py -f 2-query/varchar.py -P + +# -N6 +echo " ********** -N 6 *************" +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateDb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateDb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateDb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeModifyMeta.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeModifyMeta.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopDnodeCreateStb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopMnodeCreateStb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeSep1VnodeStopVnodeCreateStb.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertDataAsync.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3 +python3 ./test.py -f 7-tmq/tmq3mnodeSwitch.py -P -N 6 -M 3 -n 3 +python3 ./test.py -f 0-others/balance_vgroups_r1.py -P -N 6 + +python3 ./test.py -f 2-query/sample.py -P +python3 ./test.py -f 2-query/sample.py -P -R +python3 ./test.py -f 2-query/sin.py -P +python3 ./test.py -f 2-query/sin.py -P -R +python3 ./test.py -f 2-query/smaTest.py -P +python3 ./test.py -f 2-query/smaTest.py -P -R +python3 ./test.py -f 2-query/sml.py -P +python3 ./test.py -f 2-query/sml.py -P -R +python3 ./test.py -f 2-query/spread.py -P +python3 ./test.py -f 2-query/spread.py -P -R +python3 ./test.py -f 2-query/sqrt.py -P +python3 ./test.py -f 2-query/sqrt.py -P -R +python3 ./test.py -f 2-query/statecount.py -P +python3 ./test.py -f 2-query/statecount.py -P -R +python3 ./test.py -f 2-query/stateduration.py -P +python3 ./test.py -f 2-query/stateduration.py -P -R +python3 ./test.py -f 2-query/substr.py -P +python3 ./test.py -f 2-query/substr.py -P -R +python3 ./test.py -f 2-query/sum.py -P +python3 ./test.py -f 2-query/sum.py -P -R +python3 ./test.py -f 2-query/tail.py -P +python3 ./test.py -f 2-query/tail.py -P -R +python3 ./test.py -f 2-query/tan.py -P +python3 ./test.py -f 2-query/tan.py -P -R +python3 ./test.py -f 2-query/Timediff.py -P +python3 ./test.py -f 2-query/Timediff.py -P -R +python3 ./test.py -f 2-query/timetruncate.py -P +python3 ./test.py -f 2-query/timetruncate.py -P -R + +# N-7 +echo " ********** -N 7 *************" +python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 7 -M 3 -C 6 +python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -P -N 7 -M 3 -C 6 -n 3 + +python3 ./test.py -f 2-query/between.py -P -Q 2 +python3 ./test.py -f 2-query/distinct.py -P -Q 2 +python3 ./test.py -f 2-query/varchar.py -P -Q 2 +python3 ./test.py -f 2-query/ltrim.py -P -Q 2 +python3 ./test.py -f 2-query/rtrim.py -P -Q 2 +python3 ./test.py -f 2-query/length.py -P -Q 2 +python3 ./test.py -f 2-query/char_length.py -P -Q 2 +python3 ./test.py -f 2-query/upper.py -P -Q 2 +python3 ./test.py -f 2-query/lower.py -P -Q 2 +python3 ./test.py -f 2-query/join.py -P -Q 2 +python3 ./test.py -f 2-query/join2.py -P -Q 2 +python3 ./test.py -f 2-query/cast.py -P -Q 2 +python3 ./test.py -f 2-query/substr.py -P -Q 2 +python3 ./test.py -f 2-query/union.py -P -Q 2 +python3 ./test.py -f 2-query/union1.py -P -Q 2 +python3 ./test.py -f 2-query/concat.py -P -Q 2 +python3 ./test.py -f 2-query/concat2.py -P -Q 2 +python3 ./test.py -f 2-query/concat_ws.py -P -Q 2 +python3 ./test.py -f 2-query/concat_ws2.py -P -Q 2 +python3 ./test.py -f 2-query/check_tsdb.py -P -Q 2 +python3 ./test.py -f 2-query/spread.py -P -Q 2 +python3 ./test.py -f 2-query/hyperloglog.py -P -Q 2 +python3 ./test.py -f 2-query/explain.py -P -Q 2 +python3 ./test.py -f 2-query/leastsquares.py -P -Q 2 +python3 ./test.py -f 2-query/timezone.py -P -Q 2 +python3 ./test.py -f 2-query/Now.py -P -Q 2 +python3 ./test.py -f 2-query/Today.py -P -Q 2 +python3 ./test.py -f 2-query/max.py -P -Q 2 +python3 ./test.py -f 2-query/min.py -P -Q 2 +python3 ./test.py -f 2-query/mode.py -P -Q 2 +python3 ./test.py -f 2-query/count.py -P -Q 2 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 2 +python3 ./test.py -f 2-query/last.py -P -Q 2 +python3 ./test.py -f 2-query/first.py -P -Q 2 +python3 ./test.py -f 2-query/To_iso8601.py -P -Q 2 +python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 2 +python3 ./test.py -f 2-query/timetruncate.py -P -Q 2 +python3 ./test.py -f 2-query/diff.py -P -Q 2 +python3 ./test.py -f 2-query/Timediff.py -P -Q 2 +python3 ./test.py -f 2-query/json_tag.py -P -Q 2 +python3 ./test.py -f 2-query/top.py -P -Q 2 +python3 ./test.py -f 2-query/bottom.py -P -Q 2 +python3 ./test.py -f 2-query/percentile.py -P -Q 2 +python3 ./test.py -f 2-query/apercentile.py -P -Q 2 +python3 ./test.py -f 2-query/abs.py -P -Q 2 +python3 ./test.py -f 2-query/ceil.py -P -Q 2 +python3 ./test.py -f 2-query/floor.py -P -Q 2 +python3 ./test.py -f 2-query/round.py -P -Q 2 +python3 ./test.py -f 2-query/log.py -P -Q 2 +python3 ./test.py -f 2-query/pow.py -P -Q 2 +python3 ./test.py -f 2-query/sqrt.py -P -Q 2 +python3 ./test.py -f 2-query/sin.py -P -Q 2 +python3 ./test.py -f 2-query/cos.py -P -Q 2 +python3 ./test.py -f 2-query/tan.py -P -Q 2 +python3 ./test.py -f 2-query/arcsin.py -P -Q 2 +python3 ./test.py -f 2-query/arccos.py -P -Q 2 +python3 ./test.py -f 2-query/arctan.py -P -Q 2 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 2 +python3 ./test.py -f 2-query/interp.py -P -Q 2 +python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 2 +python3 ./test.py -f 2-query/stablity.py -P -Q 2 +python3 ./test.py -f 2-query/stablity_1.py -P -Q 2 +python3 ./test.py -f 2-query/avg.py -P -Q 2 +python3 ./test.py -f 2-query/elapsed.py -P -Q 2 +python3 ./test.py -f 2-query/csum.py -P -Q 2 +python3 ./test.py -f 2-query/mavg.py -P -Q 2 +python3 ./test.py -f 2-query/sample.py -P -Q 2 +python3 ./test.py -f 2-query/function_diff.py -P -Q 2 +python3 ./test.py -f 2-query/unique.py -P -Q 2 +python3 ./test.py -f 2-query/stateduration.py -P -Q 2 +python3 ./test.py -f 2-query/function_stateduration.py -P -Q 2 +python3 ./test.py -f 2-query/statecount.py -P -Q 2 +python3 ./test.py -f 2-query/tail.py -P -Q 2 +python3 ./test.py -f 2-query/ttl_comment.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 2 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 2 +python3 ./test.py -f 2-query/twa.py -P -Q 2 +python3 ./test.py -f 2-query/irate.py -P -Q 2 +python3 ./test.py -f 2-query/function_null.py -P -Q 2 +python3 ./test.py -f 2-query/count_partition.py -P -Q 2 +python3 ./test.py -f 2-query/max_partition.py -P -Q 2 +python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 2 +python3 ./test.py -f 2-query/last_row_interval.py -P -Q 2 +python3 ./test.py -f 2-query/last_row.py -P -Q 2 +python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 2 +python3 ./test.py -f 2-query/sml.py -P -Q 2 +python3 ./test.py -f 2-query/case_when.py -P -Q 2 +python3 ./test.py -f 2-query/blockSMA.py -P -Q 2 +python3 ./test.py -f 2-query/projectionDesc.py -P -Q 2 +python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 2 + +python3 ./test.py -f 2-query/between.py -P -Q 3 +python3 ./test.py -f 2-query/distinct.py -P -Q 3 +python3 ./test.py -f 2-query/varchar.py -P -Q 3 +python3 ./test.py -f 2-query/ltrim.py -P -Q 3 +python3 ./test.py -f 2-query/rtrim.py -P -Q 3 +python3 ./test.py -f 2-query/length.py -P -Q 3 +python3 ./test.py -f 2-query/char_length.py -P -Q 3 +python3 ./test.py -f 2-query/upper.py -P -Q 3 +python3 ./test.py -f 2-query/lower.py -P -Q 3 +python3 ./test.py -f 2-query/join.py -P -Q 3 +python3 ./test.py -f 2-query/join2.py -P -Q 3 +python3 ./test.py -f 2-query/cast.py -P -Q 3 +python3 ./test.py -f 2-query/substr.py -P -Q 3 +python3 ./test.py -f 2-query/union.py -P -Q 3 +python3 ./test.py -f 2-query/union1.py -P -Q 3 +python3 ./test.py -f 2-query/concat2.py -P -Q 3 +python3 ./test.py -f 2-query/concat_ws.py -P -Q 3 +python3 ./test.py -f 2-query/concat_ws2.py -P -Q 3 +python3 ./test.py -f 2-query/check_tsdb.py -P -Q 3 +python3 ./test.py -f 2-query/spread.py -P -Q 3 +python3 ./test.py -f 2-query/hyperloglog.py -P -Q 3 +python3 ./test.py -f 2-query/explain.py -P -Q 3 +python3 ./test.py -f 2-query/leastsquares.py -P -Q 3 +python3 ./test.py -f 2-query/timezone.py -P -Q 3 +python3 ./test.py -f 2-query/Now.py -P -Q 3 +python3 ./test.py -f 2-query/Today.py -P -Q 3 +python3 ./test.py -f 2-query/max.py -P -Q 3 +python3 ./test.py -f 2-query/min.py -P -Q 3 +python3 ./test.py -f 2-query/mode.py -P -Q 3 +python3 ./test.py -f 2-query/count.py -P -Q 3 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 3 +python3 ./test.py -f 2-query/last.py -P -Q 3 +python3 ./test.py -f 2-query/first.py -P -Q 3 +python3 ./test.py -f 2-query/To_iso8601.py -P -Q 3 +python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 3 +python3 ./test.py -f 2-query/timetruncate.py -P -Q 3 +python3 ./test.py -f 2-query/diff.py -P -Q 3 +python3 ./test.py -f 2-query/Timediff.py -P -Q 3 +python3 ./test.py -f 2-query/json_tag.py -P -Q 3 +python3 ./test.py -f 2-query/top.py -P -Q 3 +python3 ./test.py -f 2-query/bottom.py -P -Q 3 +python3 ./test.py -f 2-query/percentile.py -P -Q 3 +python3 ./test.py -f 2-query/apercentile.py -P -Q 3 +python3 ./test.py -f 2-query/abs.py -P -Q 3 +python3 ./test.py -f 2-query/ceil.py -P -Q 3 +python3 ./test.py -f 2-query/floor.py -P -Q 3 +python3 ./test.py -f 2-query/round.py -P -Q 3 +python3 ./test.py -f 2-query/log.py -P -Q 3 +python3 ./test.py -f 2-query/pow.py -P -Q 3 +python3 ./test.py -f 2-query/sqrt.py -P -Q 3 +python3 ./test.py -f 2-query/sin.py -P -Q 3 +python3 ./test.py -f 2-query/cos.py -P -Q 3 +python3 ./test.py -f 2-query/tan.py -P -Q 3 +python3 ./test.py -f 2-query/arcsin.py -P -Q 3 +python3 ./test.py -f 2-query/arccos.py -P -Q 3 +python3 ./test.py -f 2-query/arctan.py -P -Q 3 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 3 +python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 3 +python3 ./test.py -f 2-query/stablity.py -P -Q 3 +python3 ./test.py -f 2-query/stablity_1.py -P -Q 3 +python3 ./test.py -f 2-query/avg.py -P -Q 3 +python3 ./test.py -f 2-query/elapsed.py -P -Q 3 +python3 ./test.py -f 2-query/csum.py -P -Q 3 +python3 ./test.py -f 2-query/mavg.py -P -Q 3 +python3 ./test.py -f 2-query/sample.py -P -Q 3 +python3 ./test.py -f 2-query/function_diff.py -P -Q 3 +python3 ./test.py -f 2-query/unique.py -P -Q 3 +python3 ./test.py -f 2-query/stateduration.py -P -Q 3 +python3 ./test.py -f 2-query/function_stateduration.py -P -Q 3 +python3 ./test.py -f 2-query/statecount.py -P -Q 3 +python3 ./test.py -f 2-query/tail.py -P -Q 3 +python3 ./test.py -f 2-query/ttl_comment.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 3 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 3 +python3 ./test.py -f 2-query/twa.py -P -Q 3 +python3 ./test.py -f 2-query/irate.py -P -Q 3 +python3 ./test.py -f 2-query/function_null.py -P -Q 3 +python3 ./test.py -f 2-query/count_partition.py -P -Q 3 +python3 ./test.py -f 2-query/max_partition.py -P -Q 3 +python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 3 +python3 ./test.py -f 2-query/last_row_interval.py -P -Q 3 +python3 ./test.py -f 2-query/last_row.py -P -Q 3 +python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 3 +python3 ./test.py -f 2-query/sml.py -P -Q 3 +python3 ./test.py -f 2-query/interp.py -P -Q 3 +python3 ./test.py -f 2-query/case_when.py -P -Q 3 +python3 ./test.py -f 2-query/blockSMA.py -P -Q 3 +python3 ./test.py -f 2-query/projectionDesc.py -P -Q 3 +python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 3 +python3 ./test.py -f 2-query/between.py -P -Q 4 +python3 ./test.py -f 2-query/distinct.py -P -Q 4 +python3 ./test.py -f 2-query/varchar.py -P -Q 4 +python3 ./test.py -f 2-query/ltrim.py -P -Q 4 +python3 ./test.py -f 2-query/rtrim.py -P -Q 4 +python3 ./test.py -f 2-query/length.py -P -Q 4 +python3 ./test.py -f 2-query/char_length.py -P -Q 4 +python3 ./test.py -f 2-query/upper.py -P -Q 4 +python3 ./test.py -f 2-query/lower.py -P -Q 4 +python3 ./test.py -f 2-query/join.py -P -Q 4 +python3 ./test.py -f 2-query/join2.py -P -Q 4 +python3 ./test.py -f 2-query/substr.py -P -Q 4 +python3 ./test.py -f 2-query/union.py -P -Q 4 +python3 ./test.py -f 2-query/union1.py -P -Q 4 +python3 ./test.py -f 2-query/concat.py -P -Q 4 +python3 ./test.py -f 2-query/concat2.py -P -Q 4 +python3 ./test.py -f 2-query/concat_ws.py -P -Q 4 +python3 ./test.py -f 2-query/concat_ws2.py -P -Q 4 +python3 ./test.py -f 2-query/check_tsdb.py -P -Q 4 +python3 ./test.py -f 2-query/spread.py -P -Q 4 +python3 ./test.py -f 2-query/hyperloglog.py -P -Q 4 +python3 ./test.py -f 2-query/explain.py -P -Q 4 +python3 ./test.py -f 2-query/leastsquares.py -P -Q 4 +python3 ./test.py -f 2-query/timezone.py -P -Q 4 +python3 ./test.py -f 2-query/Now.py -P -Q 4 +python3 ./test.py -f 2-query/Today.py -P -Q 4 +python3 ./test.py -f 2-query/max.py -P -Q 4 +python3 ./test.py -f 2-query/min.py -P -Q 4 +python3 ./test.py -f 2-query/mode.py -P -Q 4 +python3 ./test.py -f 2-query/count.py -P -Q 4 +python3 ./test.py -f 2-query/countAlwaysReturnValue.py -P -Q 4 +python3 ./test.py -f 2-query/last.py -P -Q 4 +python3 ./test.py -f 2-query/first.py -P -Q 4 +python3 ./test.py -f 2-query/To_iso8601.py -P -Q 4 +python3 ./test.py -f 2-query/To_unixtimestamp.py -P -Q 4 +python3 ./test.py -f 2-query/timetruncate.py -P -Q 4 +python3 ./test.py -f 2-query/diff.py -P -Q 4 +python3 ./test.py -f 2-query/Timediff.py -P -Q 4 +python3 ./test.py -f 2-query/json_tag.py -P -Q 4 +python3 ./test.py -f 2-query/top.py -P -Q 4 +python3 ./test.py -f 2-query/bottom.py -P -Q 4 +python3 ./test.py -f 2-query/percentile.py -P -Q 4 +python3 ./test.py -f 2-query/apercentile.py -P -Q 4 +python3 ./test.py -f 2-query/abs.py -P -Q 4 +python3 ./test.py -f 2-query/ceil.py -P -Q 4 +python3 ./test.py -f 2-query/floor.py -P -Q 4 +python3 ./test.py -f 2-query/round.py -P -Q 4 +python3 ./test.py -f 2-query/log.py -P -Q 4 +python3 ./test.py -f 2-query/pow.py -P -Q 4 +python3 ./test.py -f 2-query/sqrt.py -P -Q 4 +python3 ./test.py -f 2-query/sin.py -P -Q 4 +python3 ./test.py -f 2-query/cos.py -P -Q 4 +python3 ./test.py -f 2-query/tan.py -P -Q 4 +python3 ./test.py -f 2-query/arcsin.py -P -Q 4 +python3 ./test.py -f 2-query/arccos.py -P -Q 4 +python3 ./test.py -f 2-query/arctan.py -P -Q 4 +python3 ./test.py -f 2-query/query_cols_tags_and_or.py -P -Q 4 +python3 ./test.py -f 2-query/nestedQueryInterval.py -P -Q 4 +python3 ./test.py -f 2-query/stablity.py -P -Q 4 +python3 ./test.py -f 2-query/stablity_1.py -P -Q 4 +python3 ./test.py -f 2-query/avg.py -P -Q 4 +python3 ./test.py -f 2-query/elapsed.py -P -Q 4 +python3 ./test.py -f 2-query/csum.py -P -Q 4 +python3 ./test.py -f 2-query/mavg.py -P -Q 4 +python3 ./test.py -f 2-query/sample.py -P -Q 4 +python3 ./test.py -f 2-query/cast.py -P -Q 4 +python3 ./test.py -f 2-query/function_diff.py -P -Q 4 +python3 ./test.py -f 2-query/unique.py -P -Q 4 +python3 ./test.py -f 2-query/stateduration.py -P -Q 4 +python3 ./test.py -f 2-query/function_stateduration.py -P -Q 4 +python3 ./test.py -f 2-query/statecount.py -P -Q 4 +python3 ./test.py -f 2-query/tail.py -P -Q 4 +python3 ./test.py -f 2-query/ttl_comment.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_count.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_max.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_min.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_sum.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_spread.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_avg.py -P -Q 4 +python3 ./test.py -f 2-query/distribute_agg_stddev.py -P -Q 4 +python3 ./test.py -f 2-query/twa.py -P -Q 4 +python3 ./test.py -f 2-query/irate.py -P -Q 4 +python3 ./test.py -f 2-query/function_null.py -P -Q 4 +python3 ./test.py -f 2-query/count_partition.py -P -Q 4 +python3 ./test.py -f 2-query/max_partition.py -P -Q 4 +python3 ./test.py -f 2-query/max_min_last_interval.py -P -Q 4 +python3 ./test.py -f 2-query/last_row_interval.py -P -Q 4 +python3 ./test.py -f 2-query/last_row.py -P -Q 4 +python3 ./test.py -f 2-query/tsbsQuery.py -P -Q 4 +python3 ./test.py -f 2-query/sml.py -P -Q 4 +python3 ./test.py -f 2-query/interp.py -P -Q 4 +python3 ./test.py -f 2-query/case_when.py -P -Q 4 +python3 ./test.py -f 2-query/insert_select.py -P +python3 ./test.py -f 2-query/insert_select.py -P -R +python3 ./test.py -f 2-query/insert_select.py -P -Q 2 +python3 ./test.py -f 2-query/insert_select.py -P -Q 3 +python3 ./test.py -f 2-query/insert_select.py -P -Q 4 +python3 ./test.py -f 2-query/out_of_order.py -P -R +python3 ./test.py -f 2-query/blockSMA.py -P -Q 4 +python3 ./test.py -f 2-query/projectionDesc.py -P -Q 4 +python3 ./test.py -f 2-query/odbc.py -P +python3 ./test.py -f 99-TDcase/TD-21561.py -P -Q 4 +python3 ./test.py -f 99-TDcase/TD-20582.py -P \ No newline at end of file From 71d59281ffeb8ecb6f62e3f87a3d4d67cc54160c Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 10 Apr 2023 14:03:56 +0800 Subject: [PATCH 42/71] fix: select * from (select * from t order by ts desc) order by ts --- source/libs/planner/src/planOptimizer.c | 12 +++++ tests/parallel_test/cases.task | 1 + tests/script/tsim/query/multi_order_by.sim | 57 ++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 tests/script/tsim/query/multi_order_by.sim diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index 8fee17d968..52bb03466c 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -1079,11 +1079,23 @@ static bool sortPriKeyOptMayBeOptimized(SLogicNode* pNode) { if (!sortPriKeyOptIsPriKeyOrderBy(pSort->pSortKeys) || 1 != LIST_LENGTH(pSort->node.pChildren)) { return false; } + SNode* pChild; + FOREACH(pChild, pSort->node.pChildren) { + SLogicNode* pSortDescendent = optFindPossibleNode((SLogicNode*)pChild, sortPriKeyOptMayBeOptimized); + if (pSortDescendent != NULL) { + return false; + } + } return true; } static int32_t sortPriKeyOptGetSequencingNodesImpl(SLogicNode* pNode, bool groupSort, bool* pNotOptimize, SNodeList** pSequencingNodes) { + if (NULL != pNode->pLimit || NULL != pNode->pSlimit) { + *pNotOptimize = false; + return TSDB_CODE_SUCCESS; + } + switch (nodeType(pNode)) { case QUERY_NODE_LOGIC_PLAN_SCAN: { SScanLogicNode* pScan = (SScanLogicNode*)pNode; diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index d1fbacdadf..e6aa2f1fea 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -875,6 +875,7 @@ ,,y,script,./test.sh -f tsim/query/udf_with_const.sim ,,y,script,./test.sh -f tsim/query/join_interval.sim ,,y,script,./test.sh -f tsim/query/unionall_as_table.sim +,,y,script,./test.sh -f tsim/query/multi_order_by.sim ,,y,script,./test.sh -f tsim/query/sys_tbname.sim ,,y,script,./test.sh -f tsim/query/groupby.sim ,,y,script,./test.sh -f tsim/query/event.sim diff --git a/tests/script/tsim/query/multi_order_by.sim b/tests/script/tsim/query/multi_order_by.sim new file mode 100644 index 0000000000..7b7f2abe36 --- /dev/null +++ b/tests/script/tsim/query/multi_order_by.sim @@ -0,0 +1,57 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/exec.sh -n dnode1 -s start +sql connect + +sql create database test; +sql use test; + +sql create table t(ts timestamp, f int); +sql insert into t values(now,0)(now+1s, 1)(now+2s, 2)(now+3s,3)(now+4s,4)(now+5s,5)(now+6s,6)(now+7s,7)(now+8s,8)(now+9s,9) +sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts; +print $data01 $data11 $data21 +if $data01 != 5 then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data21 != 7 then + return -1 +endi +sql select * from (select * from t order by ts limit 3 offset 2) order by ts desc; +print $data01 $data11 $data21 +if $data01 != 4 then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data21 != 2 then + return -1 +endi +sql select * from (select * from t order by ts desc limit 3 offset 2) order by ts desc; +print $data01 $data11 $data21 +if $data01 != 7 then + return -1 +endi +if $data11 != 6 then + return -1 +endi +if $data21 != 5 then + return -1 +endi +sql select * from (select * from t order by ts limit 3 offset 2) order by ts; +print $data01 $data11 $data21 +if $data01 != 2 then + return -1 +endi +if $data11 != 3 then + return -1 +endi +if $data21 != 4 then + return -1 +endi + + +system sh/exec.sh -n dnode1 -s stop -x SIGINT From 5cc85e7f41cc4560f47f75d50ac847ca8a141c9d Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Mon, 10 Apr 2023 15:16:28 +0800 Subject: [PATCH 43/71] fix: remove unused macros (#20839) --- tools/shell/src/shellArguments.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 0f5585991e..8300e2e1e3 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -20,18 +20,6 @@ #include "shellInt.h" #include "version.h" -#ifndef CUS_NAME -char cusName[] = "TDengine"; -#endif - -#ifndef CUS_PROMPT -char cusPrompt[] = "taos"; -#endif - -#ifndef CUS_EMAIL -char cusEmail[] = ""; -#endif - #if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) #include "cus_name.h" #endif From e40b978d3046b4928fdf68c19302563ffc753d2a Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 10 Apr 2023 15:24:26 +0800 Subject: [PATCH 44/71] fix: catalog memory leak --- source/common/src/tmsg.c | 2 ++ source/libs/catalog/src/ctgCache.c | 12 ++++++++++++ source/libs/catalog/src/ctgUtil.c | 2 ++ tests/system-test/0-others/user_control.py | 4 ++-- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7d517e3e1e..fbd417368a 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1626,6 +1626,8 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { taosHashCleanup(pRsp->createdDbs); taosHashCleanup(pRsp->readDbs); taosHashCleanup(pRsp->writeDbs); + taosHashCleanup(pRsp->writeTbs); + taosHashCleanup(pRsp->readTbs); } int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index d847735f4f..ec5807f310 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -2035,6 +2035,14 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { pUser->userAuth.writeDbs = msg->userAuth.writeDbs; msg->userAuth.writeDbs = NULL; + taosHashCleanup(pUser->userAuth.readTbs); + pUser->userAuth.readTbs = msg->userAuth.readTbs; + msg->userAuth.readTbs = NULL; + + taosHashCleanup(pUser->userAuth.writeTbs); + pUser->userAuth.writeTbs = msg->userAuth.writeTbs; + msg->userAuth.writeTbs = NULL; + CTG_UNLOCK(CTG_WRITE, &pUser->lock); _return: @@ -2042,6 +2050,8 @@ _return: taosHashCleanup(msg->userAuth.createdDbs); taosHashCleanup(msg->userAuth.readDbs); taosHashCleanup(msg->userAuth.writeDbs); + taosHashCleanup(msg->userAuth.readTbs); + taosHashCleanup(msg->userAuth.writeTbs); taosMemoryFreeClear(msg); @@ -2234,6 +2244,8 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) { taosHashCleanup(msg->userAuth.createdDbs); taosHashCleanup(msg->userAuth.readDbs); taosHashCleanup(msg->userAuth.writeDbs); + taosHashCleanup(msg->userAuth.readTbs); + taosHashCleanup(msg->userAuth.writeTbs); taosMemoryFreeClear(op->data); break; } diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 4fd5f126f3..a5bed110df 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -425,6 +425,8 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) { taosHashCleanup(pOut->createdDbs); taosHashCleanup(pOut->readDbs); taosHashCleanup(pOut->writeDbs); + taosHashCleanup(pOut->readTbs); + taosHashCleanup(pOut->writeTbs); taosMemoryFreeClear(pCtx->out); break; } diff --git a/tests/system-test/0-others/user_control.py b/tests/system-test/0-others/user_control.py index d27892b588..7b5578ba45 100644 --- a/tests/system-test/0-others/user_control.py +++ b/tests/system-test/0-others/user_control.py @@ -444,7 +444,7 @@ class TDTestCase: self.__grant_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) , self.__grant_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) , f"GRANT {self.__privilege[0]} ON * TO {self.__user_list[0]}" , - f"GRANT {self.__privilege[0]} ON {DBNAME}.{NTBNAME} TO {self.__user_list[0]}" , + # f"GRANT {self.__privilege[0]} ON {DBNAME}.{NTBNAME} TO {self.__user_list[0]}" , ] def __revoke_err(self): @@ -456,7 +456,7 @@ class TDTestCase: self.__revoke_user_privileges(privilege="", dbname="db", user_name=self.__user_list[0]) , self.__revoke_user_privileges(privilege=" ".join(self.__privilege), user_name=self.__user_list[0]) , f"REVOKE {self.__privilege[0]} ON * FROM {self.__user_list[0]}" , - f"REVOKE {self.__privilege[0]} ON {DBNAME}.{NTBNAME} FROM {self.__user_list[0]}" , + # f"REVOKE {self.__privilege[0]} ON {DBNAME}.{NTBNAME} FROM {self.__user_list[0]}" , ] def test_grant_err(self): From 655be1e55da036b19bb76e43c5fccf90a3cb3d59 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Mon, 10 Apr 2023 16:37:10 +0800 Subject: [PATCH 45/71] feat: table level privilege --- tests/system-test/2-query/odbc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system-test/2-query/odbc.py b/tests/system-test/2-query/odbc.py index 9bbff4af21..f9232dddf8 100644 --- a/tests/system-test/2-query/odbc.py +++ b/tests/system-test/2-query/odbc.py @@ -22,7 +22,7 @@ class TDTestCase: tdSql.execute("insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)") tdSql.query("select count(*) from information_schema.ins_columns") - tdSql.checkData(0, 0, 272) + tdSql.checkData(0, 0, 274) tdSql.query("select * from information_schema.ins_columns where table_name = 'ntb'") tdSql.checkRows(14) From fc4cb6826243dcbdc27e0c292f6c968b4e524b74 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 10 Apr 2023 16:38:42 +0800 Subject: [PATCH 46/71] test: remove compatible.py --- tests/system-test/runAllOne.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/system-test/runAllOne.sh b/tests/system-test/runAllOne.sh index 0877555f36..5a8d358d98 100644 --- a/tests/system-test/runAllOne.sh +++ b/tests/system-test/runAllOne.sh @@ -130,7 +130,6 @@ python3 ./test.py -f 0-others/sysinfo.py -P python3 ./test.py -f 0-others/user_control.py -P python3 ./test.py -f 0-others/user_manage.py -P python3 ./test.py -f 0-others/fsync.py -P -python3 ./test.py -f 0-others/compatibility.py -P python3 ./test.py -f 0-others/tag_index_basic.py -P python3 ./test.py -f 0-others/show.py -P python3 ./test.py -f 0-others/information_schema.py -P From fc370bfdcd3b54a3c5dd4df35a92b1c2ecdff32e Mon Sep 17 00:00:00 2001 From: Huo Linhe Date: Mon, 10 Apr 2023 17:44:44 +0800 Subject: [PATCH 47/71] chore: do not show red warnings --- packaging/tools/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 63ea55cf82..88f53a9ca3 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -576,7 +576,6 @@ function install_share_etc() { for c in `ls ${script_dir}/share/etc/`; do if [ -e /etc/$c ]; then out=/etc/$c.new.`date +%F` - echo -e -n "${RED} /etc/$c exists, save a new cfg file as $out" ${csudo}cp -f ${script_dir}/share/etc/$c $out else ${csudo}cp -f ${script_dir}/share/etc/$c /etc/$c From 38231fc48eaff00e31114316913eb122aa06b06a Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 11 Apr 2023 09:01:19 +0800 Subject: [PATCH 48/71] enh: add queryMaxConcurrentTables configuration --- include/common/tglobal.h | 1 + source/common/src/tglobal.c | 3 +++ source/libs/scheduler/inc/schInt.h | 5 ++--- source/libs/scheduler/src/schFlowCtrl.c | 24 ++++++++++++------------ source/libs/scheduler/src/scheduler.c | 6 ++++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 13e8454ac3..29182ef277 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -104,6 +104,7 @@ extern int32_t tsCacheLazyLoadThreshold; // cost threshold for last/last_row lo // query client extern int32_t tsQueryPolicy; extern int32_t tsQueryRspPolicy; +extern int64_t tsQueryMaxConcurrentTables; extern int32_t tsQuerySmaOptimize; extern int32_t tsQueryRsmaTolerance; extern bool tsQueryPlannerTrace; diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 56e34da4ce..af2da6ae2a 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -103,6 +103,7 @@ char tsSmlChildTableName[TSDB_TABLE_NAME_LEN] = ""; // user defined child table // query int32_t tsQueryPolicy = 1; int32_t tsQueryRspPolicy = 0; +int64_t tsQueryMaxConcurrentTables = 200; // unit is TSDB_TABLE_NUM_UNIT bool tsEnableQueryHb = false; int32_t tsQuerySmaOptimize = 0; int32_t tsQueryRsmaTolerance = 1000; // the tolerance time (ms) to judge from which level to query rsma data. @@ -340,6 +341,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) { if (cfgAddInt32(pCfg, "maxRetryWaitTime", tsMaxRetryWaitTime, 0, 86400000, 0) != 0) return -1; if (cfgAddBool(pCfg, "useAdapter", tsUseAdapter, true) != 0) return -1; if (cfgAddBool(pCfg, "crashReporting", tsEnableCrashReport, true) != 0) return -1; + if (cfgAddInt64(pCfg, "queryMaxConcurrentTables", tsQueryMaxConcurrentTables, INT64_MIN, INT64_MAX, 1) != 0) return -1; tsNumOfRpcThreads = tsNumOfCores / 2; tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS); @@ -735,6 +737,7 @@ static int32_t taosSetClientCfg(SConfig *pCfg) { tsKeepColumnName = cfgGetItem(pCfg, "keepColumnName")->bval; tsUseAdapter = cfgGetItem(pCfg, "useAdapter")->bval; tsEnableCrashReport = cfgGetItem(pCfg, "crashReporting")->bval; + tsQueryMaxConcurrentTables = cfgGetItem(pCfg, "queryMaxConcurrentTables")->i64; tsMaxRetryWaitTime = cfgGetItem(pCfg, "maxRetryWaitTime")->i32; diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index d002b5dfa9..7840fe2017 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -54,7 +54,6 @@ typedef enum { #define SCHEDULE_DEFAULT_MAX_JOB_NUM 1000 #define SCHEDULE_DEFAULT_MAX_TASK_NUM 1000 -#define SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM 200 // unit is TSDB_TABLE_NUM_UNIT #define SCHEDULE_DEFAULT_POLICY SCH_LOAD_SEQ #define SCHEDULE_DEFAULT_MAX_NODE_NUM 20 @@ -134,7 +133,7 @@ typedef struct SSchStatusFps { typedef struct SSchedulerCfg { uint32_t maxJobNum; - int32_t maxNodeTableNum; + int64_t maxNodeTableNum; SCH_POLICY schPolicy; bool enableReSchedule; } SSchedulerCfg; @@ -175,7 +174,7 @@ typedef struct SSchHbCallbackParam { typedef struct SSchFlowControl { SRWLatch lock; bool sorted; - int32_t tableNumSum; + int64_t tableNumSum; uint32_t execTaskNum; SArray *taskList; // Element is SSchTask* } SSchFlowControl; diff --git a/source/libs/scheduler/src/schFlowCtrl.c b/source/libs/scheduler/src/schFlowCtrl.c index 9cb95a6bbe..8c2b65e125 100644 --- a/source/libs/scheduler/src/schFlowCtrl.c +++ b/source/libs/scheduler/src/schFlowCtrl.c @@ -46,7 +46,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { return TSDB_CODE_SUCCESS; } - int32_t sum = 0; + int64_t sum = 0; int32_t taskNum = taosArrayGetSize(pJob->dataSrcTasks); for (int32_t i = 0; i < taskNum; ++i) { SSchTask *pTask = *(SSchTask **)taosArrayGet(pJob->dataSrcTasks, i); @@ -55,7 +55,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { } if (schMgmt.cfg.maxNodeTableNum <= 0 || sum < schMgmt.cfg.maxNodeTableNum) { - SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%d", sum); + SCH_JOB_DLOG("job no need flow ctrl, totalTableNum:%" PRId64, sum); return TSDB_CODE_SUCCESS; } @@ -68,7 +68,7 @@ int32_t schChkJobNeedFlowCtrl(SSchJob *pJob, SSchLevel *pLevel) { SCH_SET_JOB_NEED_FLOW_CTRL(pJob); - SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%d", sum); + SCH_JOB_DLOG("job NEED flow ctrl, totalTableNum:%" PRId64, sum); return TSDB_CODE_SUCCESS; } @@ -94,7 +94,7 @@ int32_t schDecTaskFlowQuota(SSchJob *pJob, SSchTask *pTask) { --ctrl->execTaskNum; ctrl->tableNumSum -= pTask->plan->execNodeStat.tableNum; - SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, + SCH_TASK_DLOG("task quota removed, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); _return: @@ -125,7 +125,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { SCH_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } - SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, + SCH_TASK_DLOG("task quota added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, nctrl.tableNumSum, nctrl.execTaskNum); *enough = true; @@ -142,7 +142,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { break; } - int32_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum; + int64_t sum = pTask->plan->execNodeStat.tableNum + ctrl->tableNumSum; if (sum <= schMgmt.cfg.maxNodeTableNum) { ctrl->tableNumSum = sum; @@ -173,7 +173,7 @@ int32_t schCheckIncTaskFlowQuota(SSchJob *pJob, SSchTask *pTask, bool *enough) { _return: - SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", + SCH_TASK_DLOG("task quota %s added, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ((*enough) ? "" : "NOT"), ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); @@ -203,7 +203,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { return TSDB_CODE_SUCCESS; } - int32_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum; + int64_t remainNum = schMgmt.cfg.maxNodeTableNum - ctrl->tableNumSum; int32_t taskNum = taosArrayGetSize(ctrl->taskList); int32_t code = 0; SSchTask *pTask = NULL; @@ -217,7 +217,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { SEp *ep = SCH_GET_CUR_EP(&pTask->plan->execNode); if (pTask->plan->execNodeStat.tableNum > remainNum && ctrl->execTaskNum > 0) { - SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, + SCH_TASK_DLOG("task NOT to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); continue; @@ -228,14 +228,14 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { taosArrayRemove(ctrl->taskList, i); - SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, + SCH_TASK_DLOG("task to launch, fqdn:%s, port:%d, tableNum:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port, pTask->plan->execNodeStat.tableNum, ctrl->tableNumSum, ctrl->execTaskNum); SCH_ERR_JRET(schAsyncLaunchTaskImpl(pJob, pTask)); remainNum -= pTask->plan->execNodeStat.tableNum; if (remainNum <= 0) { - SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d", ep->fqdn, ep->port, + SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d", ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum); break; @@ -244,7 +244,7 @@ int32_t schLaunchTasksInFlowCtrlListImpl(SSchJob *pJob, SSchFlowControl *ctrl) { if (i < (taskNum - 1)) { SSchTask *pLastTask = *(SSchTask **)taosArrayGetLast(ctrl->taskList); if (remainNum < pLastTask->plan->execNodeStat.tableNum) { - SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%d, remainExecTaskNum:%d, smallestInList:%d", + SCH_TASK_DLOG("no more task to launch, fqdn:%s, port:%d, remainNum:%" PRId64 ", remainExecTaskNum:%d, smallestInList:%d", ep->fqdn, ep->port, ctrl->tableNumSum, ctrl->execTaskNum, pLastTask->plan->execNodeStat.tableNum); break; diff --git a/source/libs/scheduler/src/scheduler.c b/source/libs/scheduler/src/scheduler.c index 2b46a4710e..e7561ccb7e 100644 --- a/source/libs/scheduler/src/scheduler.c +++ b/source/libs/scheduler/src/scheduler.c @@ -18,6 +18,7 @@ #include "schInt.h" #include "tmsg.h" #include "tref.h" +#include "tglobal.h" SSchedulerMgmt schMgmt = { .jobRef = -1, @@ -30,11 +31,12 @@ int32_t schedulerInit() { } schMgmt.cfg.maxJobNum = SCHEDULE_DEFAULT_MAX_JOB_NUM; - schMgmt.cfg.maxNodeTableNum = SCHEDULE_DEFAULT_MAX_NODE_TABLE_NUM; + schMgmt.cfg.maxNodeTableNum = tsQueryMaxConcurrentTables; schMgmt.cfg.schPolicy = SCHEDULE_DEFAULT_POLICY; schMgmt.cfg.enableReSchedule = true; - qDebug("schedule policy init to %d", schMgmt.cfg.schPolicy); + qDebug("schedule init, policy: %d, maxNodeTableNum: %" PRId64", reSchedule:%d", + schMgmt.cfg.schPolicy, schMgmt.cfg.maxNodeTableNum, schMgmt.cfg.enableReSchedule); schMgmt.jobRef = taosOpenRef(schMgmt.cfg.maxJobNum, schFreeJobImpl); if (schMgmt.jobRef < 0) { From 1e84961d028c97a87b4dc9992facaf74f0c0c307 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Tue, 11 Apr 2023 09:39:07 +0800 Subject: [PATCH 49/71] fix: packaging/tools/install.sh (#20849) --- packaging/tools/install.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 88f53a9ca3..849ab5a92a 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -599,12 +599,14 @@ function install_data() { } function install_connector() { - [ -d "${script_dir}/connector/" ] && ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ + if [ -d "${script_dir}/connector/" ]; then + ${csudo}cp -rf ${script_dir}/connector/ ${install_main_dir}/ || echo "failed to copy connector" + fi } function install_examples() { if [ -d ${script_dir}/examples ]; then - ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples + ${csudo}cp -rf ${script_dir}/examples/* ${install_main_dir}/examples || echo "failed to copy examples" fi } From 965af6cc82b311c40cc58e8144d59929dc5dc691 Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Tue, 11 Apr 2023 09:46:06 +0800 Subject: [PATCH 50/71] fix: handle leak (#20836) * fix: handle leak * fix: del unused code --------- Co-authored-by: facetosea <25808407@qq.com> --- source/libs/executor/inc/dataSinkInt.h | 1 - source/libs/executor/src/dataSinkMgt.c | 1 - 2 files changed, 2 deletions(-) diff --git a/source/libs/executor/inc/dataSinkInt.h b/source/libs/executor/inc/dataSinkInt.h index 220e9c0b6c..57a771b275 100644 --- a/source/libs/executor/inc/dataSinkInt.h +++ b/source/libs/executor/inc/dataSinkInt.h @@ -29,7 +29,6 @@ struct SDataSinkHandle; typedef struct SDataSinkManager { SDataSinkMgtCfg cfg; - TdThreadMutex mutex; } SDataSinkManager; typedef int32_t (*FPutDataBlock)(struct SDataSinkHandle* pHandle, const SInputData* pInput, bool* pContinue); diff --git a/source/libs/executor/src/dataSinkMgt.c b/source/libs/executor/src/dataSinkMgt.c index 2b50be33ad..6796cf1130 100644 --- a/source/libs/executor/src/dataSinkMgt.c +++ b/source/libs/executor/src/dataSinkMgt.c @@ -23,7 +23,6 @@ SDataSinkStat gDataSinkStat = {0}; int32_t dsDataSinkMgtInit(SDataSinkMgtCfg* cfg) { gDataSinkManager.cfg = *cfg; - taosThreadMutexInit(&gDataSinkManager.mutex, NULL); return 0; // to avoid compiler eror } From 416af9a58d0d3ac289c9dec9d30b0ac138731c4c Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 11 Apr 2023 10:11:25 +0800 Subject: [PATCH 51/71] feat: table level privilege --- include/common/tmsg.h | 9 +- source/common/src/tmsg.c | 102 ++++++---- source/dnode/mnode/impl/inc/mndDef.h | 1 + source/dnode/mnode/impl/src/mndUser.c | 152 ++++++++------- source/libs/catalog/src/ctgCache.c | 52 +++--- source/libs/catalog/src/ctgUtil.c | 215 +++++++++++----------- source/libs/parser/src/parAstParser.c | 19 ++ source/libs/parser/src/parAuthenticator.c | 30 +++ 8 files changed, 347 insertions(+), 233 deletions(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 3f8df42e1d..66925471fb 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -181,12 +181,8 @@ typedef enum _mgmt_table { #define TSDB_ALTER_USER_REMOVE_READ_TABLE 0xE #define TSDB_ALTER_USER_ADD_WRITE_TABLE 0xF #define TSDB_ALTER_USER_REMOVE_WRITE_TABLE 0x10 -#define TSDB_ALTER_USER_ADD_READ_TAG 0x11 -#define TSDB_ALTER_USER_REMOVE_READ_TAG 0x12 -#define TSDB_ALTER_USER_ADD_WRITE_TAG 0x13 -#define TSDB_ALTER_USER_REMOVE_WRITE_TAG 0x14 -#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x15 -#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x16 +#define TSDB_ALTER_USER_ADD_ALL_TABLE 0x11 +#define TSDB_ALTER_USER_REMOVE_ALL_TABLE 0x12 #define TSDB_ALTER_USER_PRIVILEGES 0x2 @@ -713,6 +709,7 @@ typedef struct { SHashObj* writeDbs; SHashObj* readTbs; SHashObj* writeTbs; + SHashObj* useDbs; } SGetUserAuthRsp; int32_t tSerializeSGetUserAuthRsp(void* buf, int32_t bufLen, SGetUserAuthRsp* pRsp); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a85c1e9ce0..5f605c80f7 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1445,14 +1445,10 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) int32_t numOfCreatedDbs = taosHashGetSize(pRsp->createdDbs); int32_t numOfReadDbs = taosHashGetSize(pRsp->readDbs); int32_t numOfWriteDbs = taosHashGetSize(pRsp->writeDbs); - int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs); - int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs); if (tEncodeI32(pEncoder, numOfCreatedDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfReadDbs) < 0) return -1; if (tEncodeI32(pEncoder, numOfWriteDbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1; - if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1; char *db = taosHashIterate(pRsp->createdDbs, NULL); while (db != NULL) { @@ -1472,6 +1468,13 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) db = taosHashIterate(pRsp->writeDbs, db); } + int32_t numOfReadTbs = taosHashGetSize(pRsp->readTbs); + int32_t numOfWriteTbs = taosHashGetSize(pRsp->writeTbs); + int32_t numOfUseTbs = taosHashGetSize(pRsp->useDbs); + if (tEncodeI32(pEncoder, numOfReadTbs) < 0) return -1; + if (tEncodeI32(pEncoder, numOfWriteTbs) < 0) return -1; + if (tEncodeI32(pEncoder, numOfUseTbs) < 0) return -1; + char *tb = taosHashIterate(pRsp->readTbs, NULL); while (tb != NULL) { size_t keyLen = 0; @@ -1502,6 +1505,17 @@ int32_t tSerializeSGetUserAuthRspImpl(SEncoder *pEncoder, SGetUserAuthRsp *pRsp) tb = taosHashIterate(pRsp->writeTbs, tb); } + int32_t *useDb = taosHashIterate(pRsp->useDbs, NULL); + while (useDb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(useDb, &keyLen); + if (tEncodeI32(pEncoder, keyLen) < 0) return -1; + if (tEncodeCStr(pEncoder, key) < 0) return -1; + + if (tEncodeI32(pEncoder, *useDb) < 0) return -1; + useDb = taosHashIterate(pRsp->useDbs, useDb); + } + return 0; } @@ -1526,7 +1540,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs pRsp->writeDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->readTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pRsp->writeTbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - if (pRsp->readDbs == NULL || pRsp->writeDbs == NULL) { + pRsp->useDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (pRsp->createdDbs == NULL || pRsp->readDbs == NULL || pRsp->writeDbs == NULL || pRsp->readTbs == NULL || + pRsp->writeTbs == NULL || pRsp->useDbs == NULL) { return -1; } @@ -1540,13 +1556,9 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs int32_t numOfCreatedDbs = 0; int32_t numOfReadDbs = 0; int32_t numOfWriteDbs = 0; - int32_t numOfReadTbs = 0; - int32_t numOfWriteTbs = 0; if (tDecodeI32(pDecoder, &numOfCreatedDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfReadDbs) < 0) return -1; if (tDecodeI32(pDecoder, &numOfWriteDbs) < 0) return -1; - if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1; - if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1; for (int32_t i = 0; i < numOfCreatedDbs; ++i) { char db[TSDB_DB_FNAME_LEN] = {0}; @@ -1569,40 +1581,61 @@ int32_t tDeserializeSGetUserAuthRspImpl(SDecoder *pDecoder, SGetUserAuthRsp *pRs taosHashPut(pRsp->writeDbs, db, len, db, len); } - for (int32_t i = 0; i < numOfReadTbs; ++i) { - int32_t keyLen = 0; - if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; + if (!tDecodeIsEnd(pDecoder)) { + int32_t numOfReadTbs = 0; + int32_t numOfWriteTbs = 0; + int32_t numOfUseDbs = 0; + if (tDecodeI32(pDecoder, &numOfReadTbs) < 0) return -1; + if (tDecodeI32(pDecoder, &numOfWriteTbs) < 0) return -1; + if (tDecodeI32(pDecoder, &numOfUseDbs) < 0) return -1; - char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); - if (tDecodeCStrTo(pDecoder, key) < 0) return -1; + for (int32_t i = 0; i < numOfReadTbs; ++i) { + int32_t keyLen = 0; + if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; - int32_t valuelen = 0; - if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; - char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); - if (tDecodeCStrTo(pDecoder, value) < 0) return -1; + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, key) < 0) return -1; - taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen); + int32_t valuelen = 0; + if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, value) < 0) return -1; - taosMemoryFree(key); - taosMemoryFree(value); - } + taosHashPut(pRsp->readTbs, key, strlen(key), value, valuelen + 1); - for (int32_t i = 0; i < numOfWriteTbs; ++i) { - int32_t keyLen = 0; - if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; + taosMemoryFree(key); + taosMemoryFree(value); + } - char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); - if (tDecodeCStrTo(pDecoder, key) < 0) return -1; + for (int32_t i = 0; i < numOfWriteTbs; ++i) { + int32_t keyLen = 0; + if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; - int32_t valuelen = 0; - if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; - char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); - if (tDecodeCStrTo(pDecoder, value) < 0) return -1; + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, key) < 0) return -1; - taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen); + int32_t valuelen = 0; + if (tDecodeI32(pDecoder, &valuelen) < 0) return -1; + char *value = taosMemoryCalloc(valuelen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, value) < 0) return -1; - taosMemoryFree(key); - taosMemoryFree(value); + taosHashPut(pRsp->writeTbs, key, strlen(key), value, valuelen + 1); + + taosMemoryFree(key); + taosMemoryFree(value); + } + + for (int32_t i = 0; i < numOfUseDbs; ++i) { + int32_t keyLen = 0; + if (tDecodeI32(pDecoder, &keyLen) < 0) return -1; + + char *key = taosMemoryCalloc(keyLen + 1, sizeof(char)); + if (tDecodeCStrTo(pDecoder, key) < 0) return -1; + + int32_t ref = 0; + if (tDecodeI32(pDecoder, &ref) < 0) return -1; + taosHashPut(pRsp->useDbs, key, strlen(key), &ref, sizeof(ref)); + } } return 0; @@ -1628,6 +1661,7 @@ void tFreeSGetUserAuthRsp(SGetUserAuthRsp *pRsp) { taosHashCleanup(pRsp->writeDbs); taosHashCleanup(pRsp->writeTbs); taosHashCleanup(pRsp->readTbs); + taosHashCleanup(pRsp->useDbs); } int32_t tSerializeSCreateDropMQSNodeReq(void *buf, int32_t bufLen, SMCreateQnodeReq *pReq) { diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h index d8519a2328..b7b430678e 100644 --- a/source/dnode/mnode/impl/inc/mndDef.h +++ b/source/dnode/mnode/impl/inc/mndDef.h @@ -282,6 +282,7 @@ typedef struct { SHashObj* topics; SHashObj* readTbs; SHashObj* writeTbs; + SHashObj* useDbs; SRWLatch lock; } SUserObj; diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 5e562806a2..34914d80f0 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -128,8 +128,9 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { int32_t numOfReadStbs = taosHashGetSize(pUser->readTbs); int32_t numOfWriteStbs = taosHashGetSize(pUser->writeTbs); int32_t numOfTopics = taosHashGetSize(pUser->topics); - int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + (numOfReadDbs + numOfWriteDbs) * TSDB_DB_FNAME_LEN + - numOfTopics * TSDB_TOPIC_FNAME_LEN; + int32_t numOfUseDbs = taosHashGetSize(pUser->useDbs); + int32_t size = sizeof(SUserObj) + USER_RESERVE_SIZE + + (numOfReadDbs + numOfWriteDbs + numOfUseDbs) * TSDB_DB_FNAME_LEN + numOfTopics * TSDB_TOPIC_FNAME_LEN; char *stb = taosHashIterate(pUser->readTbs, NULL); while (stb != NULL) { @@ -176,8 +177,6 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { SDB_SET_INT32(pRaw, dataPos, numOfReadDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfWriteDbs, _OVER) SDB_SET_INT32(pRaw, dataPos, numOfTopics, _OVER) - SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER) - SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER) char *db = taosHashIterate(pUser->readDbs, NULL); while (db != NULL) { @@ -197,6 +196,10 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { topic = taosHashIterate(pUser->topics, topic); } + SDB_SET_INT32(pRaw, dataPos, numOfReadStbs, _OVER) + SDB_SET_INT32(pRaw, dataPos, numOfWriteStbs, _OVER) + SDB_SET_INT32(pRaw, dataPos, numOfUseDbs, _OVER) + stb = taosHashIterate(pUser->readTbs, NULL); while (stb != NULL) { size_t keyLen = 0; @@ -225,6 +228,17 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { stb = taosHashIterate(pUser->writeTbs, stb); } + int32_t *useDb = taosHashIterate(pUser->useDbs, NULL); + while (useDb != NULL) { + size_t keyLen = 0; + void *key = taosHashGetKey(useDb, &keyLen); + SDB_SET_INT32(pRaw, dataPos, keyLen, _OVER) + SDB_SET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + SDB_SET_INT32(pRaw, dataPos, *useDb, _OVER) + useDb = taosHashIterate(pUser->writeTbs, useDb); + } + SDB_SET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) SDB_SET_DATALEN(pRaw, dataPos, _OVER) @@ -275,26 +289,16 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t numOfReadDbs = 0; int32_t numOfWriteDbs = 0; int32_t numOfTopics = 0; - int32_t numOfReadStbs = 0; - int32_t numOfWriteStbs = 0; SDB_GET_INT32(pRaw, dataPos, &numOfReadDbs, _OVER) SDB_GET_INT32(pRaw, dataPos, &numOfWriteDbs, _OVER) if (sver >= 2) { SDB_GET_INT32(pRaw, dataPos, &numOfTopics, _OVER) } - if (sver >= 3) { - SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER) - SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER) - } pUser->readDbs = taosHashInit(numOfReadDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->writeDbs = taosHashInit(numOfWriteDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); pUser->topics = taosHashInit(numOfTopics, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - pUser->readTbs = - taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); - pUser->writeTbs = - taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pUser->readDbs == NULL || pUser->writeDbs == NULL || pUser->topics == NULL) goto _OVER; for (int32_t i = 0; i < numOfReadDbs; ++i) { @@ -321,6 +325,19 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { } if (sver >= 3) { + int32_t numOfReadStbs = 0; + int32_t numOfWriteStbs = 0; + int32_t numOfUseDbs = 0; + SDB_GET_INT32(pRaw, dataPos, &numOfReadStbs, _OVER) + SDB_GET_INT32(pRaw, dataPos, &numOfWriteStbs, _OVER) + SDB_GET_INT32(pRaw, dataPos, &numOfUseDbs, _OVER) + + pUser->readTbs = + taosHashInit(numOfReadStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->writeTbs = + taosHashInit(numOfWriteStbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + pUser->useDbs = taosHashInit(numOfUseDbs, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + for (int32_t i = 0; i < numOfReadStbs; ++i) { int32_t keyLen = 0; SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); @@ -332,7 +349,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t valuelen = 0; SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); char *value = taosMemoryCalloc(valuelen, sizeof(char)); - memset(value, 0, keyLen); + memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) taosHashPut(pUser->readTbs, key, keyLen, value, valuelen); @@ -360,6 +377,20 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { taosMemoryFree(key); taosMemoryFree(value); } + + for (int32_t i = 0; i < numOfUseDbs; ++i) { + int32_t keyLen = 0; + SDB_GET_INT32(pRaw, dataPos, &keyLen, _OVER); + + char *key = taosMemoryCalloc(keyLen, sizeof(char)); + memset(key, 0, keyLen); + SDB_GET_BINARY(pRaw, dataPos, key, keyLen, _OVER); + + int32_t ref = 0; + SDB_GET_INT32(pRaw, dataPos, &ref, _OVER); + + taosHashPut(pUser->useDbs, key, keyLen, &ref, sizeof(ref)); + } } SDB_GET_RESERVE(pRaw, dataPos, USER_RESERVE_SIZE, _OVER) @@ -376,6 +407,7 @@ _OVER: taosHashCleanup(pUser->topics); taosHashCleanup(pUser->readTbs); taosHashCleanup(pUser->writeTbs); + taosHashCleanup(pUser->useDbs); } taosMemoryFreeClear(pRow); return NULL; @@ -437,6 +469,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { pNew->readTbs = mndDupTableHash(pUser->readTbs); pNew->writeTbs = mndDupTableHash(pUser->writeTbs); pNew->topics = mndDupTopicHash(pUser->topics); + pNew->useDbs = mndDupDbHash(pUser->useDbs); taosRUnLockLatch(&pUser->lock); if (pNew->readDbs == NULL || pNew->writeDbs == NULL || pNew->topics == NULL) { @@ -451,11 +484,13 @@ static void mndUserFreeObj(SUserObj *pUser) { taosHashCleanup(pUser->topics); taosHashCleanup(pUser->readTbs); taosHashCleanup(pUser->writeTbs); + taosHashCleanup(pUser->useDbs); pUser->readDbs = NULL; pUser->writeDbs = NULL; pUser->topics = NULL; pUser->readTbs = NULL; pUser->writeTbs = NULL; + pUser->useDbs = NULL; } static int32_t mndUserActionDelete(SSdb *pSdb, SUserObj *pUser) { @@ -477,6 +512,7 @@ static int32_t mndUserActionUpdate(SSdb *pSdb, SUserObj *pOld, SUserObj *pNew) { TSWAP(pOld->topics, pNew->topics); TSWAP(pOld->readTbs, pNew->readTbs); TSWAP(pOld->writeTbs, pNew->writeTbs); + TSWAP(pOld->useDbs, pNew->useDbs); taosWUnLockLatch(&pOld->lock); return 0; @@ -647,38 +683,8 @@ SHashObj *mndDupDbHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_DB_FNAM SHashObj *mndDupTopicHash(SHashObj *pOld) { return mndDupObjHash(pOld, TSDB_TOPIC_FNAME_LEN); } -static int32_t mndTagPriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq) { - char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; - snprintf(tbFName, TSDB_TABLE_FNAME_LEN, "%s.%s", alterReq->objname, alterReq->tabName); - int32_t len = strlen(tbFName) + 1; - - SStbObj *pStb = mndAcquireStb(pMnode, tbFName); - if (pStb == NULL) { - mndReleaseStb(pMnode, pStb); - return -1; - } - if (alterReq->tagCond == NULL) { - mndReleaseStb(pMnode, pStb); - return -1; - } - - char *value = taosHashGet(hash, tbFName, len); - if (value != NULL) { - mndReleaseStb(pMnode, pStb); - terrno = TSDB_CODE_MND_PRIVILEDGE_EXIST; - return -1; - } - - int32_t condLen = alterReq->tagCondLen + 1; - if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { - mndReleaseStb(pMnode, pStb); - return -1; - } - mndReleaseStb(pMnode, pStb); - return 0; -} - -static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) { +static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq, + SSdb *pSdb) { void *pIter = NULL; char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; @@ -692,7 +698,7 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq return -1; } - int32_t condLen = alterReq->tagCondLen + 1; + int32_t condLen = alterReq->tagCondLen; if (taosHashPut(hash, tbFName, len, alterReq->tagCond, condLen) != 0) { return -1; } @@ -702,10 +708,21 @@ static int32_t mndTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq } } + int32_t dbKeyLen = strlen(alterReq->objname) + 1; + int32_t ref = 1; + int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen); + if (NULL != currRef) { + ref = (*currRef) + 1; + } + if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) { + return -1; + } + return 0; } -static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUserReq *alterReq, SSdb *pSdb) { +static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SHashObj *useDbHash, SAlterUserReq *alterReq, + SSdb *pSdb) { void *pIter = NULL; char tbFName[TSDB_TABLE_FNAME_LEN] = {0}; snprintf(tbFName, sizeof(tbFName), "%s.%s", alterReq->objname, alterReq->tabName); @@ -715,6 +732,19 @@ static int32_t mndRemoveTablePriviledge(SMnode *pMnode, SHashObj *hash, SAlterUs return -1; } + int32_t dbKeyLen = strlen(alterReq->objname) + 1; + int32_t *currRef = taosHashGet(useDbHash, alterReq->objname, dbKeyLen); + if (NULL == currRef || 1 == *currRef) { + if (taosHashRemove(useDbHash, alterReq->objname, dbKeyLen) != 0) { + return -1; + } + return 0; + } + int32_t ref = (*currRef) - 1; + if (taosHashPut(useDbHash, alterReq->objname, dbKeyLen, &ref, sizeof(ref)) != 0) { + return -1; + } + return 0; } @@ -858,21 +888,19 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { } if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TABLE) { - if (mndTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; + if (mndTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TABLE) { - if (mndTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; + if (mndTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER; } - if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TAG) { - if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, &alterReq, pSdb) != 0) goto _OVER; + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_READ_TABLE) { + if (mndRemoveTablePriviledge(pMnode, newUser.readTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER; } - if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE || - alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TAG) { - if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, &alterReq, pSdb) != 0) goto _OVER; + if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_WRITE_TABLE) { + if (mndRemoveTablePriviledge(pMnode, newUser.writeTbs, newUser.useDbs, &alterReq, pSdb) != 0) goto _OVER; } if (alterReq.alterType == TSDB_ALTER_USER_ADD_SUBSCRIBE_TOPIC) { @@ -885,14 +913,6 @@ static int32_t mndProcessAlterUserReq(SRpcMsg *pReq) { taosHashPut(newUser.topics, pTopic->name, len, pTopic->name, TSDB_TOPIC_FNAME_LEN); } - if (alterReq.alterType == TSDB_ALTER_USER_ADD_READ_TAG) { - if (mndTagPriviledge(pMnode, newUser.readTbs, &alterReq) != 0) goto _OVER; - } - - if (alterReq.alterType == TSDB_ALTER_USER_ADD_WRITE_TAG) { - if (mndTagPriviledge(pMnode, newUser.writeTbs, &alterReq) != 0) goto _OVER; - } - if (alterReq.alterType == TSDB_ALTER_USER_REMOVE_SUBSCRIBE_TOPIC) { int32_t len = strlen(alterReq.objname) + 1; SMqTopicObj *pTopic = mndAcquireTopic(pMnode, alterReq.objname); @@ -1397,8 +1417,6 @@ int32_t mndUserRemoveDb(SMnode *pMnode, STrans *pTrans, char *db) { if (inRead || inWrite) { (void)taosHashRemove(newUser.readDbs, db, len); (void)taosHashRemove(newUser.writeDbs, db, len); - (void)taosHashRemove(newUser.readTbs, db, len); - (void)taosHashRemove(newUser.writeTbs, db, len); SSdbRaw *pCommitRaw = mndUserActionEncode(&newUser); if (pCommitRaw == NULL || mndTransAppendCommitlog(pTrans, pCommitRaw) != 0) break; diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index ec5807f310..dec92a4483 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -238,10 +238,11 @@ _return: return TSDB_CODE_SUCCESS; } -int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, SCtgTbCache **pTb) { +int32_t ctgAcquireVgMetaFromCache(SCatalog *pCtg, const char *dbFName, const char *tbName, SCtgDBCache **pDb, + SCtgTbCache **pTb) { SCtgDBCache *dbCache = NULL; SCtgTbCache *tbCache = NULL; - bool vgInCache = false; + bool vgInCache = false; ctgAcquireDBCache(pCtg, dbFName, &dbCache); if (NULL == dbCache) { @@ -306,7 +307,6 @@ _return: return TSDB_CODE_SUCCESS; } - /* int32_t ctgAcquireStbMetaFromCache(SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgDBCache **pDb, SCtgTbCache **pTb) { SCtgDBCache *dbCache = NULL; @@ -360,9 +360,10 @@ _return: } */ -int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid, SCtgTbCache **pTb) { +int32_t ctgAcquireStbMetaFromCache(SCtgDBCache *dbCache, SCatalog *pCtg, char *dbFName, uint64_t suid, + SCtgTbCache **pTb) { SCtgTbCache *pCache = NULL; - char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid)); + char *stName = taosHashAcquire(dbCache->stbCache, &suid, sizeof(suid)); if (NULL == stName) { ctgDebug("stb 0x%" PRIx64 " not in cache, dbFName:%s", suid, dbFName); goto _return; @@ -459,10 +460,11 @@ int32_t ctgTbMetaExistInCache(SCatalog *pCtg, char *dbFName, char *tbName, int32 return TSDB_CODE_SUCCESS; } -int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, char* dbFName) { +int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCtgTbCache **pTb, STableMeta **pTableMeta, + char *dbFName) { SCtgDBCache *dbCache = *pDb; SCtgTbCache *tbCache = *pTb; - STableMeta *tbMeta = tbCache->pMeta; + STableMeta *tbMeta = tbCache->pMeta; ctx->tbInfo.inCache = true; ctx->tbInfo.dbId = dbCache->dbId; ctx->tbInfo.suid = tbMeta->suid; @@ -491,12 +493,12 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt memcpy(*pTableMeta, tbMeta, metaSize); - //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); + // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); CTG_UNLOCK(CTG_READ, &tbCache->metaLock); taosHashRelease(dbCache->tbCache, tbCache); *pTb = NULL; - + ctgDebug("Got ctb %s meta from cache, will continue to get its stb meta, type:%d, dbFName:%s", ctx->pName->tname, ctx->tbInfo.tbType, dbFName); @@ -528,7 +530,6 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt return TSDB_CODE_SUCCESS; } - int32_t ctgReadTbMetaFromCache(SCatalog *pCtg, SCtgTbMetaCtx *ctx, STableMeta **pTableMeta) { int32_t code = 0; SCtgDBCache *dbCache = NULL; @@ -598,17 +599,17 @@ int32_t ctgReadTbVerFromCache(SCatalog *pCtg, SName *pTableName, int32_t *sver, // PROCESS FOR CHILD TABLE - //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); + // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); if (tbCache) { CTG_UNLOCK(CTG_READ, &tbCache->metaLock); taosHashRelease(dbCache->tbCache, tbCache); } - + ctgDebug("Got ctb %s ver from cache, will continue to get its stb ver, dbFName:%s", pTableName->tname, dbFName); ctgAcquireStbMetaFromCache(dbCache, pCtg, dbFName, *suid, &tbCache); if (NULL == tbCache) { - //ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); + // ctgReleaseTbMetaToCache(pCtg, dbCache, tbCache); ctgDebug("stb 0x%" PRIx64 " meta not in cache", *suid); return TSDB_CODE_SUCCESS; } @@ -678,7 +679,7 @@ _return: CTG_RET(code); } -int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp* pRes) { +int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, SCtgAuthRsp *pRes) { if (IS_SYS_DBNAME(pReq->tbName.dbname)) { *inCache = true; pRes->pRawRes->pass = true; @@ -706,7 +707,7 @@ int32_t ctgChkAuthFromCache(SCatalog *pCtg, SUserAuthInfo *pReq, bool *inCache, int32_t code = ctgChkSetAuthRes(pCtg, &req, pRes); CTG_UNLOCK(CTG_READ, &pUser->lock); CTG_ERR_JRET(code); - + if (pRes->metaNotExists) { goto _return; } @@ -1685,9 +1686,9 @@ void ctgFreeAllInstance(void) { taosHashClear(gCtgMgmt.pCluster); } -int32_t ctgVgInfoIdComp(void const* lp, void const* rp) { - int32_t* key = (int32_t*)lp; - SVgroupInfo* pVg = (SVgroupInfo*)rp; +int32_t ctgVgInfoIdComp(void const *lp, void const *rp) { + int32_t *key = (int32_t *)lp; + SVgroupInfo *pVg = (SVgroupInfo *)rp; if (*key < pVg->vgId) { return -1; @@ -1698,7 +1699,6 @@ int32_t ctgVgInfoIdComp(void const* lp, void const* rp) { return 0; } - int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { int32_t code = 0; SCtgUpdateVgMsg *msg = operation->data; @@ -1763,10 +1763,10 @@ int32_t ctgOpUpdateVgroup(SCtgCacheOperation *operation) { dbCache = NULL; - //if (!IS_SYS_DBNAME(dbFName)) { - tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); - CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), - ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); + // if (!IS_SYS_DBNAME(dbFName)) { + tstrncpy(vgVersion.dbFName, dbFName, sizeof(vgVersion.dbFName)); + CTG_ERR_JRET(ctgMetaRentUpdate(&msg->pCtg->dbRent, &vgVersion, vgVersion.dbId, sizeof(SDbVgVersion), + ctgDbVgVersionSortCompare, ctgDbVgVersionSearchCompare)); //} _return: @@ -2043,6 +2043,10 @@ int32_t ctgOpUpdateUser(SCtgCacheOperation *operation) { pUser->userAuth.writeTbs = msg->userAuth.writeTbs; msg->userAuth.writeTbs = NULL; + taosHashCleanup(pUser->userAuth.useDbs); + pUser->userAuth.useDbs = msg->userAuth.useDbs; + msg->userAuth.useDbs = NULL; + CTG_UNLOCK(CTG_WRITE, &pUser->lock); _return: @@ -2052,6 +2056,7 @@ _return: taosHashCleanup(msg->userAuth.writeDbs); taosHashCleanup(msg->userAuth.readTbs); taosHashCleanup(msg->userAuth.writeTbs); + taosHashCleanup(msg->userAuth.useDbs); taosMemoryFreeClear(msg); @@ -2246,6 +2251,7 @@ void ctgFreeCacheOperationData(SCtgCacheOperation *op) { taosHashCleanup(msg->userAuth.writeDbs); taosHashCleanup(msg->userAuth.readTbs); taosHashCleanup(msg->userAuth.writeTbs); + taosHashCleanup(msg->userAuth.useDbs); taosMemoryFreeClear(op->data); break; } diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index a5bed110df..d02f94c939 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -179,6 +179,7 @@ void ctgFreeSCtgUserAuth(SCtgUserAuth* userCache) { taosHashCleanup(userCache->userAuth.writeDbs); taosHashCleanup(userCache->userAuth.readTbs); taosHashCleanup(userCache->userAuth.writeTbs); + taosHashCleanup(userCache->userAuth.useDbs); } void ctgFreeMetaRent(SCtgRentMgmt* mgmt) { @@ -427,6 +428,7 @@ void ctgFreeMsgCtx(SCtgMsgCtx* pCtx) { taosHashCleanup(pOut->writeDbs); taosHashCleanup(pOut->readTbs); taosHashCleanup(pOut->writeTbs); + taosHashCleanup(pOut->useDbs); taosMemoryFreeClear(pCtx->out); break; } @@ -873,19 +875,19 @@ int32_t ctgGetVgInfoFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, const SName vgInfo = taosArraySearch(dbInfo->vgArray, &hashValue, ctgHashValueComp, TD_EQ); -/* - void* pIter = taosHashIterate(dbInfo->vgHash, NULL); - while (pIter) { - vgInfo = pIter; - if (hashValue >= vgInfo->hashBegin && hashValue <= vgInfo->hashEnd) { - taosHashCancelIterate(dbInfo->vgHash, pIter); - break; - } + /* + void* pIter = taosHashIterate(dbInfo->vgHash, NULL); + while (pIter) { + vgInfo = pIter; + if (hashValue >= vgInfo->hashBegin && hashValue <= vgInfo->hashEnd) { + taosHashCancelIterate(dbInfo->vgHash, pIter); + break; + } - pIter = taosHashIterate(dbInfo->vgHash, pIter); - vgInfo = NULL; - } -*/ + pIter = taosHashIterate(dbInfo->vgHash, pIter); + vgInfo = NULL; + } + */ if (NULL == vgInfo) { ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, db, @@ -910,7 +912,7 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo* CTG_ERR_RET(ctgMakeVgArray(dbInfo)); - int32_t vgNum = taosArrayGetSize(dbInfo->vgArray); + int32_t vgNum = taosArrayGetSize(dbInfo->vgArray); if (vgNum <= 0) { ctgError("db vgroup cache invalid, db:%s, vgroup number:%d", dbFName, vgNum); CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); @@ -990,43 +992,43 @@ int32_t ctgGetVgInfosFromHashValue(SCatalog* pCtg, SCtgTaskReq* tReq, SDBVgInfo* CTG_RET(code); } -int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum, int32_t* vgId) { - int32_t code = 0; - CTG_ERR_RET(ctgMakeVgArray(dbInfo)); +int32_t ctgGetVgIdsFromHashValue(SCatalog* pCtg, SDBVgInfo* dbInfo, char* dbFName, const char* pTbs[], int32_t tbNum, + int32_t* vgId) { + int32_t code = 0; + CTG_ERR_RET(ctgMakeVgArray(dbInfo)); - int32_t vgNum = taosArrayGetSize(dbInfo->vgArray); + int32_t vgNum = taosArrayGetSize(dbInfo->vgArray); - if (vgNum <= 0) { - ctgError("db vgroup cache invalid, db:%s, vgroup number:%d", dbFName, vgNum); - CTG_ERR_RET(TSDB_CODE_TSC_DB_NOT_SELECTED); - } + if (vgNum <= 0) { + ctgError("db vgroup cache invalid, db:%s, vgroup number:%d", dbFName, vgNum); + CTG_ERR_RET(TSDB_CODE_TSC_DB_NOT_SELECTED); + } - SVgroupInfo* vgInfo = NULL; - char tbFullName[TSDB_TABLE_FNAME_LEN]; - snprintf(tbFullName, sizeof(tbFullName), "%s.", dbFName); - int32_t offset = strlen(tbFullName); - - for (int32_t i = 0; i < tbNum; ++i) { - snprintf(tbFullName + offset, sizeof(tbFullName) - offset, "%s", pTbs[i]); - uint32_t hashValue = taosGetTbHashVal(tbFullName, (uint32_t)strlen(tbFullName), dbInfo->hashMethod, - dbInfo->hashPrefix, dbInfo->hashSuffix); + SVgroupInfo* vgInfo = NULL; + char tbFullName[TSDB_TABLE_FNAME_LEN]; + snprintf(tbFullName, sizeof(tbFullName), "%s.", dbFName); + int32_t offset = strlen(tbFullName); - vgInfo = taosArraySearch(dbInfo->vgArray, &hashValue, ctgHashValueComp, TD_EQ); - if (NULL == vgInfo) { - ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, dbFName, - (int32_t)taosArrayGetSize(dbInfo->vgArray)); - CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); - } + for (int32_t i = 0; i < tbNum; ++i) { + snprintf(tbFullName + offset, sizeof(tbFullName) - offset, "%s", pTbs[i]); + uint32_t hashValue = taosGetTbHashVal(tbFullName, (uint32_t)strlen(tbFullName), dbInfo->hashMethod, + dbInfo->hashPrefix, dbInfo->hashSuffix); - vgId[i] = vgInfo->vgId; + vgInfo = taosArraySearch(dbInfo->vgArray, &hashValue, ctgHashValueComp, TD_EQ); + if (NULL == vgInfo) { + ctgError("no hash range found for hash value [%u], db:%s, numOfVgId:%d", hashValue, dbFName, + (int32_t)taosArrayGetSize(dbInfo->vgArray)); + CTG_ERR_RET(TSDB_CODE_CTG_INTERNAL_ERROR); + } - ctgDebug("Got tb %s vgId:%d", tbFullName, vgInfo->vgId); - } + vgId[i] = vgInfo->vgId; - CTG_RET(code); + ctgDebug("Got tb %s vgId:%d", tbFullName, vgInfo->vgId); + } + + CTG_RET(code); } - int32_t ctgStbVersionSearchCompare(const void* key1, const void* key2) { if (*(uint64_t*)key1 < ((SSTableVersion*)key2)->suid) { return -1; @@ -1071,26 +1073,25 @@ int32_t ctgMakeVgArray(SDBVgInfo* dbInfo) { if (NULL == dbInfo) { return TSDB_CODE_SUCCESS; } - + if (dbInfo->vgHash && NULL == dbInfo->vgArray) { dbInfo->vgArray = taosArrayInit(100, sizeof(SVgroupInfo)); if (NULL == dbInfo->vgArray) { CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } - - void* pIter = taosHashIterate(dbInfo->vgHash, NULL); + + void* pIter = taosHashIterate(dbInfo->vgHash, NULL); while (pIter) { taosArrayPush(dbInfo->vgArray, pIter); pIter = taosHashIterate(dbInfo->vgHash, pIter); } - + taosArraySort(dbInfo->vgArray, ctgVgInfoComp); } return TSDB_CODE_SUCCESS; } - int32_t ctgCloneVgInfo(SDBVgInfo* src, SDBVgInfo** dst) { CTG_ERR_RET(ctgMakeVgArray(src)); @@ -1334,72 +1335,74 @@ static void* ctgCloneDnodeList(void* pSrc) { return taosArrayDup((const SArray*) static void ctgFreeDnodeList(void* p) { taosArrayDestroy((SArray*)((SMetaRes*)p)->pRes); } -int32_t ctgChkSetTbAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { - int32_t code = 0; - STableMeta *pMeta = NULL; - SGetUserAuthRsp *pInfo = &req->authInfo; - SHashObj *pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs; +int32_t ctgChkSetTbAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) { + int32_t code = 0; + STableMeta* pMeta = NULL; + SGetUserAuthRsp* pInfo = &req->authInfo; + SHashObj* pTbs = (AUTH_TYPE_READ == req->singleType) ? pInfo->readTbs : pInfo->writeTbs; char tbFullName[TSDB_TABLE_FNAME_LEN]; tNameExtractFullName(&req->pRawReq->tbName, tbFullName); - char *pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName)); + char* pCond = taosHashGet(pTbs, tbFullName, strlen(tbFullName)); if (pCond) { if (strlen(pCond) > 1) { CTG_ERR_RET(nodesStringToNode(pCond, &res->pRawRes->pCond)); } - + res->pRawRes->pass = true; return TSDB_CODE_SUCCESS; } - CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta)); - if (NULL == pMeta) { - if (req->onlyCache) { - res->metaNotExists = true; - ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname); - return TSDB_CODE_SUCCESS; - } + res->pRawRes->pass = false; - CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta)); - } + // CTG_ERR_RET(catalogGetCachedTableMeta(pCtg, &req->pRawReq->tbName, &pMeta)); + // if (NULL == pMeta) { + // if (req->onlyCache) { + // res->metaNotExists = true; + // ctgDebug("db %s tb %s meta not in cache for auth", req->pRawReq->tbName.dbname, req->pRawReq->tbName.tname); + // return TSDB_CODE_SUCCESS; + // } - if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) { - res->pRawRes->pass = false; - goto _return; - } + // CTG_ERR_RET(catalogGetTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, &pMeta)); + // } - if (TSDB_CHILD_TABLE == pMeta->tableType) { - res->pRawRes->pass = true; + // if (TSDB_SUPER_TABLE == pMeta->tableType || TSDB_NORMAL_TABLE == pMeta->tableType) { + // res->pRawRes->pass = false; + // goto _return; + // } -/* - char stbName[TSDB_TABLE_NAME_LEN] = {0}; - CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName)); - if (0 == stbName[0]) { - if (req->onlyCache) { - res->notExists = true; - return TSDB_CODE_SUCCESS; - } - - CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0)); - } -*/ - } + // if (TSDB_CHILD_TABLE == pMeta->tableType) { + // res->pRawRes->pass = true; + + // /* + // char stbName[TSDB_TABLE_NAME_LEN] = {0}; + // CTG_ERR_JRET(ctgGetCachedStbNameFromSuid(pCtg, pMeta->suid, stbName)); + // if (0 == stbName[0]) { + // if (req->onlyCache) { + // res->notExists = true; + // return TSDB_CODE_SUCCESS; + // } + + // CTG_ERR_RET(catalogRefreshTableMeta(pCtg, req->pConn, &req->pRawReq->tbName, 0)); + // } + // */ + // } _return: taosMemoryFree(pMeta); - + CTG_RET(code); } -int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { - int32_t code = 0; - SUserAuthInfo* pReq = req->pRawReq; - SUserAuthRes* pRes = res->pRawRes; - SGetUserAuthRsp *pInfo = &req->authInfo; - +int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) { + int32_t code = 0; + SUserAuthInfo* pReq = req->pRawReq; + SUserAuthRes* pRes = res->pRawRes; + SGetUserAuthRsp* pInfo = &req->authInfo; + pRes->pass = false; - pRes->pCond = NULL; + pRes->pCond = NULL; if (!pInfo->enable) { pRes->pass = false; @@ -1421,36 +1424,44 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { switch (pReq->type) { case AUTH_TYPE_READ: { + if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) { + req->singleType = AUTH_TYPE_READ; + CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res)); + if (pRes->pass) { + return TSDB_CODE_SUCCESS; + } + } + if (pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) { pRes->pass = true; return TSDB_CODE_SUCCESS; } - if (pInfo->readTbs && taosHashGetSize(pInfo->readTbs) > 0) { - req->singleType = AUTH_TYPE_READ; - CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res)); - } - + break; } case AUTH_TYPE_WRITE: { + if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) { + req->singleType = AUTH_TYPE_WRITE; + CTG_ERR_RET(ctgChkSetTbAuthRes(pCtg, req, res)); + if (pRes->pass) { + return TSDB_CODE_SUCCESS; + } + } + if (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) { pRes->pass = true; return TSDB_CODE_SUCCESS; } - if (pInfo->writeTbs && taosHashGetSize(pInfo->writeTbs) > 0) { - req->singleType = AUTH_TYPE_WRITE; - CTG_RET(ctgChkSetTbAuthRes(pCtg, req, res)); - } - + break; } case AUTH_TYPE_READ_OR_WRITE: { if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) || - (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName)))){ + (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName)))) { pRes->pass = true; return TSDB_CODE_SUCCESS; } - + break; } default: @@ -1460,7 +1471,6 @@ int32_t ctgChkSetAuthRes(SCatalog *pCtg, SCtgAuthReq *req, SCtgAuthRsp* res) { return TSDB_CODE_SUCCESS; } - #if 0 static int32_t ctgCloneMetaDataArray(SArray* pSrc, __array_item_dup_fn_t copyFunc, SArray** pDst) { if (NULL == pSrc) { @@ -1554,4 +1564,3 @@ void catalogFreeMetaData(SMetaData* pData) { taosMemoryFree(pData); } #endif - diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index b416fc0d9a..5db1f5dbdb 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -287,6 +287,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS if (TSDB_CODE_SUCCESS == code) { code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, pCxt->pMetaCache); } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pClause->dbName, + pClause->tableName, AUTH_TYPE_WRITE, pCxt->pMetaCache); + } if (TSDB_CODE_SUCCESS != code) { break; } @@ -294,6 +298,11 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS return code; } +static int32_t collectMetaKeyFromDropStable(SCollectMetaKeyCxt* pCxt, SDropSuperTableStmt* pStmt) { + return reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName, + AUTH_TYPE_WRITE, pCxt->pMetaCache); +} + static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) { int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache); if (TSDB_CODE_SUCCESS == code) { @@ -302,6 +311,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl if (TSDB_CODE_SUCCESS == code) { code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName, + AUTH_TYPE_WRITE, pCxt->pMetaCache); + } return code; } @@ -310,6 +323,10 @@ static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTab if (TSDB_CODE_SUCCESS == code) { code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); } + if (TSDB_CODE_SUCCESS == code) { + code = reserveUserAuthInCache(pCxt->pParseCxt->acctId, pCxt->pParseCxt->pUser, pStmt->dbName, pStmt->tableName, + AUTH_TYPE_WRITE, pCxt->pMetaCache); + } return code; } @@ -638,6 +655,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) { return collectMetaKeyFromCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt); case QUERY_NODE_DROP_TABLE_STMT: return collectMetaKeyFromDropTable(pCxt, (SDropTableStmt*)pStmt); + case QUERY_NODE_DROP_SUPER_TABLE_STMT: + return collectMetaKeyFromDropStable(pCxt, (SDropSuperTableStmt*)pStmt); case QUERY_NODE_ALTER_TABLE_STMT: return collectMetaKeyFromAlterTable(pCxt, (SAlterTableStmt*)pStmt); case QUERY_NODE_ALTER_SUPER_TABLE_STMT: diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c index 66ba47af48..b06d48a690 100644 --- a/source/libs/parser/src/parAuthenticator.c +++ b/source/libs/parser/src/parAuthenticator.c @@ -197,6 +197,29 @@ static int32_t authCreateMultiTable(SAuthCxt* pCxt, SCreateMultiTablesStmt* pStm return code; } +static int32_t authDropTable(SAuthCxt* pCxt, SDropTableStmt* pStmt) { + int32_t code = TSDB_CODE_SUCCESS; + SNode* pNode = NULL; + FOREACH(pNode, pStmt->pTables) { + SDropTableClause* pClause = (SDropTableClause*)pNode; + code = checkAuth(pCxt, pClause->dbName, pClause->tableName, AUTH_TYPE_WRITE, NULL); + if (TSDB_CODE_SUCCESS != code) { + break; + } + } + return code; +} + +static int32_t authDropStable(SAuthCxt* pCxt, SDropSuperTableStmt* pStmt) { + return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL); +} + +static int32_t authAlterTable(SAuthCxt* pCxt, SAlterTableStmt* pStmt) { + SNode* pTagCond = NULL; + // todo check tag condition for subtable + return checkAuth(pCxt, pStmt->dbName, pStmt->tableName, AUTH_TYPE_WRITE, NULL); +} + static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { switch (nodeType(pStmt)) { case QUERY_NODE_SET_OPERATOR: @@ -213,6 +236,13 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) { return authCreateTable(pCxt, (SCreateTableStmt*)pStmt); case QUERY_NODE_CREATE_MULTI_TABLES_STMT: return authCreateMultiTable(pCxt, (SCreateMultiTablesStmt*)pStmt); + case QUERY_NODE_DROP_TABLE_STMT: + return authDropTable(pCxt, (SDropTableStmt*)pStmt); + case QUERY_NODE_DROP_SUPER_TABLE_STMT: + return authDropStable(pCxt, (SDropSuperTableStmt*)pStmt); + case QUERY_NODE_ALTER_TABLE_STMT: + case QUERY_NODE_ALTER_SUPER_TABLE_STMT: + return authAlterTable(pCxt, (SAlterTableStmt*)pStmt); case QUERY_NODE_SHOW_DNODES_STMT: case QUERY_NODE_SHOW_MNODES_STMT: case QUERY_NODE_SHOW_MODULES_STMT: From e2b5d27c2a7ec71109c2f90b66d58afc613f3df2 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 11 Apr 2023 10:22:47 +0800 Subject: [PATCH 52/71] enh: stmt ignore get fields errors --- source/client/inc/clientStmt.h | 9 +++++++++ source/client/src/clientStmt.c | 30 ++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/source/client/inc/clientStmt.h b/source/client/inc/clientStmt.h index 0c9696f1c8..cbef80b6da 100644 --- a/source/client/inc/clientStmt.h +++ b/source/client/inc/clientStmt.h @@ -144,6 +144,15 @@ extern char *gStmtStatusStr[]; goto _return; \ } \ } while (0) +#define STMT_ERRI_JRET(c) \ + do { \ + code = c; \ + if (code != TSDB_CODE_SUCCESS) { \ + terrno = code; \ + goto _return; \ + } \ + } while (0) + #define STMT_ELOG(param, ...) qError("stmt:%p " param, pStmt, __VA_ARGS__) #define STMT_DLOG(param, ...) qDebug("stmt:%p " param, pStmt, __VA_ARGS__) diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 71a41c68e7..ac60a069eb 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -975,15 +975,16 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) { } int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { + int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; STMT_DLOG_E("start to get tag fields"); if (STMT_TYPE_QUERY == pStmt->sql.type) { - STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR); + STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR); } - STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); + STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { @@ -995,27 +996,30 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { pStmt->exec.pRequest = NULL; } - STMT_ERR_RET(stmtCreateRequest(pStmt)); + STMT_ERRI_JRET(stmtCreateRequest(pStmt)); if (pStmt->bInfo.needParse) { - STMT_ERR_RET(stmtParseSql(pStmt)); + STMT_ERRI_JRET(stmtParseSql(pStmt)); } - STMT_ERR_RET(stmtFetchTagFields(stmt, nums, fields)); + STMT_ERRI_JRET(stmtFetchTagFields(stmt, nums, fields)); - return TSDB_CODE_SUCCESS; +_return: + + return code; } int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { + int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; STMT_DLOG_E("start to get col fields"); if (STMT_TYPE_QUERY == pStmt->sql.type) { - STMT_RET(TSDB_CODE_TSC_STMT_API_ERROR); + STMT_ERRI_JRET(TSDB_CODE_TSC_STMT_API_ERROR); } - STMT_ERR_RET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); + STMT_ERRI_JRET(stmtSwitchStatus(pStmt, STMT_FETCH_FIELDS)); if (pStmt->bInfo.needParse && pStmt->sql.runTimes && pStmt->sql.type > 0 && STMT_TYPE_MULTI_INSERT != pStmt->sql.type) { @@ -1027,15 +1031,17 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { pStmt->exec.pRequest = NULL; } - STMT_ERR_RET(stmtCreateRequest(pStmt)); + STMT_ERRI_JRET(stmtCreateRequest(pStmt)); if (pStmt->bInfo.needParse) { - STMT_ERR_RET(stmtParseSql(pStmt)); + STMT_ERRI_JRET(stmtParseSql(pStmt)); } - STMT_ERR_RET(stmtFetchColFields(stmt, nums, fields)); + STMT_ERRI_JRET(stmtFetchColFields(stmt, nums, fields)); - return TSDB_CODE_SUCCESS; +_return: + + return code; } int stmtGetParamNum(TAOS_STMT* stmt, int* nums) { From 8060e77be35e4b9e281e057a9d32a94aecff6078 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 11 Apr 2023 10:41:35 +0800 Subject: [PATCH 53/71] fix(udf): make strncat working for release building --- source/libs/function/src/udfd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index c368788243..e444a974f9 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -571,13 +571,13 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { char initFuncName[TSDB_FUNC_NAME_LEN + 5] = {0}; char *initSuffix = "_init"; strcpy(initFuncName, udfName); - strncat(initFuncName, initSuffix, strlen(initSuffix)); + strncat(initFuncName, initSuffix, TSDB_FUNC_NAME_LEN + 5 - strlen(initFuncName) - 1); uv_dlsym(&udf->lib, initFuncName, (void **)(&udf->initFunc)); char destroyFuncName[TSDB_FUNC_NAME_LEN + 5] = {0}; char *destroySuffix = "_destroy"; strcpy(destroyFuncName, udfName); - strncat(destroyFuncName, destroySuffix, strlen(destroySuffix)); + strncat(destroyFuncName, destroySuffix, TSDB_FUNC_NAME_LEN + 5 - strlen(destroyFuncName) - 1); uv_dlsym(&udf->lib, destroyFuncName, (void **)(&udf->destroyFunc)); if (udf->funcType == TSDB_FUNC_TYPE_SCALAR) { @@ -591,17 +591,17 @@ int32_t udfdLoadUdf(char *udfName, SUdf *udf) { char startFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; char *startSuffix = "_start"; strncpy(startFuncName, processFuncName, sizeof(startFuncName)); - strncat(startFuncName, startSuffix, strlen(startSuffix)); + strncat(startFuncName, startSuffix, TSDB_FUNC_NAME_LEN + 6 - strlen(startSuffix) - 1); uv_dlsym(&udf->lib, startFuncName, (void **)(&udf->aggStartFunc)); char finishFuncName[TSDB_FUNC_NAME_LEN + 7] = {0}; char *finishSuffix = "_finish"; strncpy(finishFuncName, processFuncName, sizeof(finishFuncName)); - strncat(finishFuncName, finishSuffix, strlen(finishSuffix)); + strncat(finishFuncName, finishSuffix, TSDB_FUNC_NAME_LEN + 7 - strlen(finishFuncName) - 1); uv_dlsym(&udf->lib, finishFuncName, (void **)(&udf->aggFinishFunc)); char mergeFuncName[TSDB_FUNC_NAME_LEN + 6] = {0}; char *mergeSuffix = "_merge"; strncpy(mergeFuncName, processFuncName, sizeof(mergeFuncName)); - strncat(mergeFuncName, mergeSuffix, strlen(mergeSuffix)); + strncat(mergeFuncName, mergeSuffix, TSDB_FUNC_NAME_LEN + 6 - strlen(mergeFuncName) - 1); uv_dlsym(&udf->lib, mergeFuncName, (void **)(&udf->aggMergeFunc)); } return 0; From d99a849956536825b71e0530564d3f075b12815e Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 11 Apr 2023 10:47:15 +0800 Subject: [PATCH 54/71] fix: ignore stmt get fields error --- source/client/src/clientStmt.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index ac60a069eb..6e529f1a0b 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -977,6 +977,7 @@ int stmtIsInsert(TAOS_STMT* stmt, int* insert) { int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; + int32_t preCode = pStmt->errCode; STMT_DLOG_E("start to get tag fields"); @@ -1006,12 +1007,15 @@ int stmtGetTagFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { _return: + pStmt->errCode = preCode; + return code; } int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { int32_t code = 0; STscStmt* pStmt = (STscStmt*)stmt; + int32_t preCode = pStmt->errCode; STMT_DLOG_E("start to get col fields"); @@ -1041,6 +1045,8 @@ int stmtGetColFields(TAOS_STMT* stmt, int* nums, TAOS_FIELD_E** fields) { _return: + pStmt->errCode = preCode; + return code; } From c40c695ea74b9af6427431481c705fd3631544a4 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 11 Apr 2023 13:49:18 +0800 Subject: [PATCH 55/71] fix:optimize log & change the length of tag if tag is null in schemaless --- source/client/src/clientSml.c | 2 +- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 4 ++-- source/dnode/vnode/src/tq/tqRead.c | 3 +-- source/libs/executor/src/executor.c | 7 ++++++- source/libs/executor/src/executorimpl.c | 2 ++ source/libs/wal/src/walRead.c | 10 +--------- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/source/client/src/clientSml.c b/source/client/src/clientSml.c index 4c28ee76c3..2e040052c3 100644 --- a/source/client/src/clientSml.c +++ b/source/client/src/clientSml.c @@ -699,7 +699,7 @@ static int32_t smlSendMetaMsg(SSmlHandle *info, SName *pName, SArray *pColumns, pReq.numOfTags = 1; SField field = {0}; field.type = TSDB_DATA_TYPE_NCHAR; - field.bytes = 1; + field.bytes = TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE; strcpy(field.name, tsSmlTagName); taosArrayPush(pReq.pTags, &field); } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index e4e0d608de..756ca008b0 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -114,11 +114,11 @@ static void vmProcessFetchQueue(SQueueInfo *pInfo, STaosQall *qall, int32_t numO int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); if (code != 0) { if (terrno != 0) code = terrno; - dGError("vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr(code)); + dGError("vnodeProcessFetchMsg vgId:%d, msg:%p failed to fetch since %s", pVnode->vgId, pMsg, terrstr()); vmSendRsp(pMsg, code); } - dGTrace("vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code); + dGTrace("vnodeProcessFetchMsg vgId:%d, msg:%p is freed, code:0x%x", pVnode->vgId, pMsg, code); rpcFreeCont(pMsg->pCont); taosFreeQitem(pMsg); } diff --git a/source/dnode/vnode/src/tq/tqRead.c b/source/dnode/vnode/src/tq/tqRead.c index 54e4e393ec..72b478e6bf 100644 --- a/source/dnode/vnode/src/tq/tqRead.c +++ b/source/dnode/vnode/src/tq/tqRead.c @@ -296,10 +296,9 @@ void tqCloseReader(STqReader* pReader) { int32_t tqSeekVer(STqReader* pReader, int64_t ver, const char* id) { if (walReadSeekVer(pReader->pWalReader, ver) < 0) { - tqDebug("tmq poll: wal reader failed to seek to ver:%"PRId64" code:%s, %s", ver, tstrerror(terrno), id); return -1; } - tqDebug("tmq poll: wal reader seek to ver:%"PRId64" %s", ver, id); + tqDebug("tmq poll: wal reader seek to ver success ver:%"PRId64" %s", ver, id); return 0; } diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index 1670eb3c59..cd7a76f7ad 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -1062,6 +1062,7 @@ int32_t qStreamSetScanMemData(qTaskInfo_t tinfo, SPackedData submit) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; if((pTaskInfo->execModel != OPTR_EXEC_MODEL_QUEUE) || (pTaskInfo->streamInfo.submit.msgStr != NULL)){ qError("qStreamSetScanMemData err:%d,%p", pTaskInfo->execModel, pTaskInfo->streamInfo.submit.msgStr); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } qDebug("set the submit block for future scan"); @@ -1102,7 +1103,6 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT // let's seek to the next version in wal file if (tqSeekVer(pInfo->tqReader, pOffset->version + 1, id) < 0) { - qError("tqSeekVer failed ver:%"PRId64", %s", pOffset->version + 1, id); return -1; } } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { @@ -1125,6 +1125,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT } else { taosRUnLockLatch(&pTaskInfo->lock); qError("no table in table list, %s", id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } } @@ -1143,6 +1144,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT } else { qError("vgId:%d uid:%" PRIu64 " not found in table list, total:%d, index:%d %s", pTaskInfo->id.vgId, uid, numOfTables, pScanInfo->currentTable, id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } @@ -1175,6 +1177,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT pScanBaseInfo->cond.twindows.skey = oldSkey; } else { qError("invalid pOffset->type:%d, %s", pOffset->type, id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } @@ -1189,6 +1192,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT if (setForSnapShot(sContext, pOffset->uid) != 0) { qError("setDataForSnapShot error. uid:%" PRId64" , %s", pOffset->uid, id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } @@ -1224,6 +1228,7 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, STqOffsetVal* pOffset, int8_t subT SSnapContext* sContext = pInfo->sContext; if (setForSnapShot(sContext, pOffset->uid) != 0) { qError("setForSnapShot error. uid:%" PRIu64 " ,version:%" PRId64, pOffset->uid, pOffset->version); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return -1; } qDebug("tmqsnap qStreamPrepareScan snapshot meta uid:%" PRId64 " ts %" PRId64 " %s", pOffset->uid, pOffset->ts, id); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 11753c181c..4e44e0e223 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -999,6 +999,7 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, const char* id) { if (pOperator == NULL) { qError("invalid operator, failed to find tableScanOperator %s", id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return NULL; } @@ -1007,6 +1008,7 @@ SOperatorInfo* extractOperatorInTree(SOperatorInfo* pOperator, int32_t type, con } else { if (pOperator->pDownstream == NULL || pOperator->pDownstream[0] == NULL) { qError("invalid operator, failed to find tableScanOperator %s", id); + terrno = TSDB_CODE_PAR_INTERNAL_ERROR; return NULL; } diff --git a/source/libs/wal/src/walRead.c b/source/libs/wal/src/walRead.c index ad6127ead2..db4e3a4759 100644 --- a/source/libs/wal/src/walRead.c +++ b/source/libs/wal/src/walRead.c @@ -207,17 +207,12 @@ int32_t walReadSeekVer(SWalReader *pReader, int64_t ver) { return 0; } -// pReader->curInvalid = 1; -// pReader->curVersion = ver; - if (ver > pWal->vers.lastVer || ver < pWal->vers.firstVer) { - wDebug("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId, + wInfo("vgId:%d, invalid index:%" PRId64 ", first index:%" PRId64 ", last index:%" PRId64, pReader->pWal->cfg.vgId, ver, pWal->vers.firstVer, pWal->vers.lastVer); terrno = TSDB_CODE_WAL_LOG_NOT_EXIST; return -1; } -// if (ver < pWal->vers.snapshotVer) { -// } if (walReadSeekVerImpl(pReader, ver) < 0) { return -1; @@ -236,8 +231,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { if (pRead->curVersion != fetchVer) { if (walReadSeekVer(pRead, fetchVer) < 0) { -// pRead->curVersion = fetchVer; -// pRead->curInvalid = 1; return -1; } seeked = true; @@ -256,7 +249,6 @@ static int32_t walFetchHeadNew(SWalReader *pRead, int64_t fetchVer) { } else { terrno = TSDB_CODE_WAL_FILE_CORRUPTED; } -// pRead->curInvalid = 1; return -1; } } From 42a5a87e964b4d54b0cbfaa7b1bc14f7de4f7ea1 Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Tue, 11 Apr 2023 15:08:42 +0800 Subject: [PATCH 56/71] fix: table level privilege --- source/dnode/mnode/impl/src/mndUser.c | 31 ++++++++++++++++++++++++--- source/libs/catalog/src/ctgUtil.c | 3 ++- source/libs/parser/src/parInsertSql.c | 2 +- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 34914d80f0..3a1c4ce58f 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -156,7 +156,7 @@ SSdbRaw *mndUserActionEncode(SUserObj *pUser) { size_t valueLen = 0; valueLen = strlen(stb); size += sizeof(int32_t); - size += keyLen; + size += valueLen; stb = taosHashIterate(pUser->writeTbs, stb); } @@ -369,7 +369,7 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { int32_t valuelen = 0; SDB_GET_INT32(pRaw, dataPos, &valuelen, _OVER); char *value = taosMemoryCalloc(valuelen, sizeof(char)); - memset(value, 0, keyLen); + memset(value, 0, valuelen); SDB_GET_BINARY(pRaw, dataPos, value, valuelen, _OVER) taosHashPut(pUser->writeTbs, key, keyLen, value, valuelen); @@ -458,6 +458,31 @@ SHashObj *mndDupTableHash(SHashObj *pOld) { return pNew; } +SHashObj *mndDupUseDbHash(SHashObj *pOld) { + SHashObj *pNew = + taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); + if (pNew == NULL) { + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + + int32_t *db = taosHashIterate(pOld, NULL); + while (db != NULL) { + size_t keyLen = 0; + char *key = taosHashGetKey(db, &keyLen); + + if (taosHashPut(pNew, key, keyLen, db, sizeof(*db)) != 0) { + taosHashCancelIterate(pOld, db); + taosHashCleanup(pNew); + terrno = TSDB_CODE_OUT_OF_MEMORY; + return NULL; + } + db = taosHashIterate(pOld, db); + } + + return pNew; +} + static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { memcpy(pNew, pUser, sizeof(SUserObj)); pNew->authVersion++; @@ -469,7 +494,7 @@ static int32_t mndUserDupObj(SUserObj *pUser, SUserObj *pNew) { pNew->readTbs = mndDupTableHash(pUser->readTbs); pNew->writeTbs = mndDupTableHash(pUser->writeTbs); pNew->topics = mndDupTopicHash(pUser->topics); - pNew->useDbs = mndDupDbHash(pUser->useDbs); + pNew->useDbs = mndDupUseDbHash(pUser->useDbs); taosRUnLockLatch(&pUser->lock); if (pNew->readDbs == NULL || pNew->writeDbs == NULL || pNew->topics == NULL) { diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index d02f94c939..f7c7522a88 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -1457,7 +1457,8 @@ int32_t ctgChkSetAuthRes(SCatalog* pCtg, SCtgAuthReq* req, SCtgAuthRsp* res) { } case AUTH_TYPE_READ_OR_WRITE: { if ((pInfo->readDbs && taosHashGet(pInfo->readDbs, dbFName, strlen(dbFName))) || - (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName)))) { + (pInfo->writeDbs && taosHashGet(pInfo->writeDbs, dbFName, strlen(dbFName))) || + (pInfo->useDbs && taosHashGet(pInfo->useDbs, dbFName, strlen(dbFName)))) { pRes->pass = true; return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parInsertSql.c b/source/libs/parser/src/parInsertSql.c index d734479b98..83528288fc 100644 --- a/source/libs/parser/src/parInsertSql.c +++ b/source/libs/parser/src/parInsertSql.c @@ -2022,7 +2022,7 @@ static int32_t buildInsertUserAuthReq(const char* pUser, SName* pName, SArray** SUserAuthInfo userAuth = {.type = AUTH_TYPE_WRITE}; snprintf(userAuth.user, sizeof(userAuth.user), "%s", pUser); - // tNameGetFullDbName(pName, userAuth.dbFName); + memcpy(&userAuth.tbName, pName, sizeof(SName)); taosArrayPush(*pUserAuth, &userAuth); return TSDB_CODE_SUCCESS; From 171647bdbd5730b73097e45ba4ed5a0876f22884 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 11 Apr 2023 15:46:36 +0800 Subject: [PATCH 57/71] fix(shell): update the double display. --- tools/shell/src/shellEngine.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index f9602aaa4d..4798151d38 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -315,7 +315,6 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i quotationStr[0] = '\"'; quotationStr[1] = 0; - int n; char buf[TSDB_MAX_BYTES_PER_ROW]; switch (field->type) { case TSDB_DATA_TYPE_BOOL: @@ -346,15 +345,11 @@ void shellDumpFieldToFile(TdFilePtr pFile, const char *val, TAOS_FIELD *field, i taosFprintfFile(pFile, "%" PRIu64, *((uint64_t *)val)); break; case TSDB_DATA_TYPE_FLOAT: - taosFprintfFile(pFile, "%.5f", GET_FLOAT_VAL(val)); + taosFprintfFile(pFile, "%e", GET_FLOAT_VAL(val)); break; case TSDB_DATA_TYPE_DOUBLE: - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", length, GET_DOUBLE_VAL(val)); - if (n > TMAX(25, length)) { - taosFprintfFile(pFile, "%*.15e", length, GET_DOUBLE_VAL(val)); - } else { - taosFprintfFile(pFile, "%s", buf); - } + snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.15e", 23, GET_DOUBLE_VAL(val)); + taosFprintfFile(pFile, "%s", buf); break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: @@ -510,7 +505,6 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t return; } - int n; char buf[TSDB_MAX_BYTES_PER_ROW]; switch (field->type) { case TSDB_DATA_TYPE_BOOL: @@ -541,15 +535,11 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t printf("%*" PRIu64, width, *((uint64_t *)val)); break; case TSDB_DATA_TYPE_FLOAT: - printf("%*ef", width, GET_FLOAT_VAL(val)); + printf("%*e", width, GET_FLOAT_VAL(val)); break; case TSDB_DATA_TYPE_DOUBLE: - n = snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%*.9f", width, GET_DOUBLE_VAL(val)); - if (n > TMAX(25, width)) { - printf("%*.15e", width, GET_DOUBLE_VAL(val)); - } else { - printf("%s", buf); - } + snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%.15e", GET_DOUBLE_VAL(val)); + printf("%*s", width, buf); break; case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_NCHAR: From 9961f824797b926fb7b6e5831e1fc15216274470 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 11 Apr 2023 16:52:56 +0800 Subject: [PATCH 58/71] fix(udf1): use 1 as luck number to make new gcc happy --- source/libs/function/test/udf1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/function/test/udf1.c b/source/libs/function/test/udf1.c index 71d30b6755..0dc53f006f 100644 --- a/source/libs/function/test/udf1.c +++ b/source/libs/function/test/udf1.c @@ -31,7 +31,7 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) { } } if (j == block->numOfCols) { - int32_t luckyNum = 88; + int32_t luckyNum = 1; udfColDataSet(resultCol, i, (char *)&luckyNum, false); } } @@ -43,4 +43,4 @@ DLL_EXPORT int32_t udf1(SUdfDataBlock *block, SUdfColumn *resultCol) { Sleep(1); #endif return 0; -} \ No newline at end of file +} From 20013b3f77cb4af8da5c7703d0ac3409a2a6b09b Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Tue, 11 Apr 2023 17:26:05 +0800 Subject: [PATCH 59/71] fix(shell): update the display of double value. --- tools/shell/src/shellEngine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 4798151d38..11758c76dc 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -538,7 +538,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t printf("%*e", width, GET_FLOAT_VAL(val)); break; case TSDB_DATA_TYPE_DOUBLE: - snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%.15e", GET_DOUBLE_VAL(val)); + snprintf(buf, TSDB_MAX_BYTES_PER_ROW, "%.9e", GET_DOUBLE_VAL(val)); printf("%*s", width, buf); break; case TSDB_DATA_TYPE_BINARY: From bf45ff56cafb2d21cfdf7cbbb91af9e15fa48023 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 11 Apr 2023 18:27:05 +0800 Subject: [PATCH 60/71] fix:modify fileContent for data compare --- tests/system-test/7-tmq/tmq3mnodeSwitch.py | 30 +------------------- tests/system-test/7-tmq/tmqCheckData.py | 33 ++-------------------- tests/system-test/7-tmq/tmqCommon.py | 22 +++++++++------ 3 files changed, 17 insertions(+), 68 deletions(-) diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py index 7c95f7a3db..54ccc88226 100644 --- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py +++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py @@ -138,34 +138,6 @@ class TDTestCase: else: tdLog.exit("three mnodes is not ready in 10s ") - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db1', @@ -256,7 +228,7 @@ class TDTestCase: tdLog.exit("0 tmq consume rows error!") if expectRowsList[0] == resultList[0]: - self.checkFileContent(consumerId, queryString) + tqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqCheckData.py b/tests/system-test/7-tmq/tmqCheckData.py index 04d0744ab5..1b45646c79 100644 --- a/tests/system-test/7-tmq/tmqCheckData.py +++ b/tests/system-test/7-tmq/tmqCheckData.py @@ -5,6 +5,7 @@ import time import socket import os import threading +import math from util.log import * from util.sql import * @@ -21,34 +22,6 @@ class TDTestCase: tdSql.init(conn.cursor()) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db1', @@ -109,7 +82,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -135,7 +108,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index 895da95e5d..d17fea7b5a 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -10,7 +10,7 @@ ################################################################### # -*- coding: utf-8 -*- - +import math from asyncore import loop from collections import defaultdict import subprocess @@ -462,18 +462,22 @@ class TMQCom: for i in range(0,skipRowsOfCons): consumeFile.readline() - lines = 0 while True: dst = queryFile.readline() src = consumeFile.readline() - lines += 1 - if dst: - if dst != src: - tdLog.info("src row: %s"%src) - tdLog.info("dst row: %s"%dst) - tdLog.exit("consumerId %d consume rows[%d] is not match the rows by direct query"%(consumerId, lines)) - else: + dstSplit = dst.split(',') + srcSplit = src.split(',') + + if len(dstSplit) != len(srcSplit): + tdLog.exit("consumerId %d consume rows len is not match the rows by direct query"%consumerId) + if not dst or not src: break + for i in range(len(dstSplit)): + if srcSplit[i] != dstSplit[i]: + srcFloat = float(srcSplit[i]) + dstFloat = float(dstSplit[i]) + if not math.isclose(srcFloat, dstFloat, abs_tol=1e-9): + tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) return def getResultFileByTaosShell(self, consumerId, queryString): From 54a414a93418f20e90b521dd5be0bdc43b3f8fa6 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 11 Apr 2023 18:35:05 +0800 Subject: [PATCH 61/71] fix:rm useless fileContent function --- tests/system-test/2-query/sml.py | 4 +-- .../7-tmq/dropDbR3ConflictTransaction.py | 28 --------------- tests/system-test/7-tmq/tmq3mnodeSwitch.py | 2 +- tests/system-test/7-tmq/tmqCheckData.py | 2 +- tests/system-test/7-tmq/tmqCheckData1.py | 34 ++---------------- tests/system-test/7-tmq/tmqConsumerGroup.py | 28 --------------- .../7-tmq/tmqUdf-multCtb-snapshot0.py | 36 +++---------------- .../7-tmq/tmqUdf-multCtb-snapshot1.py | 36 +++---------------- tests/system-test/7-tmq/tmqUdf.py | 36 +++---------------- tests/system-test/99-TDcase/TD-16821.py | 34 ++---------------- 10 files changed, 22 insertions(+), 218 deletions(-) diff --git a/tests/system-test/2-query/sml.py b/tests/system-test/2-query/sml.py index ec6309c71a..f96ed8a3ff 100644 --- a/tests/system-test/2-query/sml.py +++ b/tests/system-test/2-query/sml.py @@ -24,7 +24,7 @@ class TDTestCase: tdSql.init(conn.cursor(), True) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, dbname="sml_db"): + def checkContent(self, dbname="sml_db"): simClientCfg="%s/taos.cfg"%tdDnodes.getSimCfgPath() buildPath = tdCom.getBuildPath() cmdStr = '%s/build/bin/sml_test %s'%(buildPath, simClientCfg) @@ -102,7 +102,7 @@ class TDTestCase: def run(self): tdSql.prepare() - self.checkFileContent() + self.checkContent() def stop(self): tdSql.close() diff --git a/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py b/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py index 4371a909c2..e25fb412af 100644 --- a/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py +++ b/tests/system-test/7-tmq/dropDbR3ConflictTransaction.py @@ -32,34 +32,6 @@ class TDTestCase: tdSql.init(conn.cursor()) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def prepareTestEnv(self): tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") paraDict = {'dbName': 'dbt', diff --git a/tests/system-test/7-tmq/tmq3mnodeSwitch.py b/tests/system-test/7-tmq/tmq3mnodeSwitch.py index 54ccc88226..8c5dc5e693 100644 --- a/tests/system-test/7-tmq/tmq3mnodeSwitch.py +++ b/tests/system-test/7-tmq/tmq3mnodeSwitch.py @@ -228,7 +228,7 @@ class TDTestCase: tdLog.exit("0 tmq consume rows error!") if expectRowsList[0] == resultList[0]: - tqCom.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqCheckData.py b/tests/system-test/7-tmq/tmqCheckData.py index 1b45646c79..4d5edf87f1 100644 --- a/tests/system-test/7-tmq/tmqCheckData.py +++ b/tests/system-test/7-tmq/tmqCheckData.py @@ -134,7 +134,7 @@ class TDTestCase: # tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0])) # tdLog.exit("2 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqCheckData1.py b/tests/system-test/7-tmq/tmqCheckData1.py index b9dac62833..1209c2812c 100644 --- a/tests/system-test/7-tmq/tmqCheckData1.py +++ b/tests/system-test/7-tmq/tmqCheckData1.py @@ -21,34 +21,6 @@ class TDTestCase: tdSql.init(conn.cursor()) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db1', @@ -109,7 +81,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -134,7 +106,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -159,7 +131,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0])) tdLog.exit("2 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): diff --git a/tests/system-test/7-tmq/tmqConsumerGroup.py b/tests/system-test/7-tmq/tmqConsumerGroup.py index 02093a2d88..ed70866c5d 100644 --- a/tests/system-test/7-tmq/tmqConsumerGroup.py +++ b/tests/system-test/7-tmq/tmqConsumerGroup.py @@ -21,34 +21,6 @@ class TDTestCase: tdSql.init(conn.cursor()) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db1', diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py index 297429b495..6ce798ab87 100644 --- a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py +++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot0.py @@ -60,34 +60,6 @@ class TDTestCase: tdLog.exit("create udf functions fail") return - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def prepareTestEnv(self): tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") paraDict = {'dbName': 'dbt', @@ -199,7 +171,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) # reinit consume info, and start tmq_sim, then check consume result @@ -226,7 +198,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) @@ -309,7 +281,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("2 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) # reinit consume info, and start tmq_sim, then check consume result @@ -336,7 +308,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("3 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) diff --git a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py index 9c139b50de..143c8762b8 100644 --- a/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py +++ b/tests/system-test/7-tmq/tmqUdf-multCtb-snapshot1.py @@ -60,34 +60,6 @@ class TDTestCase: tdLog.exit("create udf functions fail") return - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def prepareTestEnv(self): tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") paraDict = {'dbName': 'dbt', @@ -199,7 +171,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) # reinit consume info, and start tmq_sim, then check consume result @@ -226,7 +198,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) @@ -309,7 +281,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("2 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) # reinit consume info, and start tmq_sim, then check consume result @@ -336,7 +308,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("3 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) # tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) diff --git a/tests/system-test/7-tmq/tmqUdf.py b/tests/system-test/7-tmq/tmqUdf.py index 8593fd4f1e..04a3a2301d 100644 --- a/tests/system-test/7-tmq/tmqUdf.py +++ b/tests/system-test/7-tmq/tmqUdf.py @@ -60,34 +60,6 @@ class TDTestCase: tdLog.exit("create udf functions fail") return - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def prepareTestEnv(self): tdLog.printNoPrefix("======== prepare test env include database, stable, ctables, and insert data: ") paraDict = {'dbName': 'dbt', @@ -199,7 +171,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) @@ -227,7 +199,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) @@ -310,7 +282,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("2 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) # reinit consume info, and start tmq_sim, then check consume result @@ -337,7 +309,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("3 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) tdLog.printNoPrefix("consumerId %d check data ok!"%(consumerId)) time.sleep(10) diff --git a/tests/system-test/99-TDcase/TD-16821.py b/tests/system-test/99-TDcase/TD-16821.py index f57fae752f..26b41e6afc 100644 --- a/tests/system-test/99-TDcase/TD-16821.py +++ b/tests/system-test/99-TDcase/TD-16821.py @@ -21,34 +21,6 @@ class TDTestCase: tdSql.init(conn.cursor()) #tdSql.init(conn.cursor(), logSql) # output sql.txt file - def checkFileContent(self, consumerId, queryString): - buildPath = tdCom.getBuildPath() - cfgPath = tdCom.getClientCfgPath() - dstFile = '%s/../log/dstrows_%d.txt'%(cfgPath, consumerId) - cmdStr = '%s/build/bin/taos -c %s -s "%s >> %s"'%(buildPath, cfgPath, queryString, dstFile) - tdLog.info(cmdStr) - os.system(cmdStr) - - consumeRowsFile = '%s/../log/consumerid_%d.txt'%(cfgPath, consumerId) - tdLog.info("rows file: %s, %s"%(consumeRowsFile, dstFile)) - - consumeFile = open(consumeRowsFile, mode='r') - queryFile = open(dstFile, mode='r') - - # skip first line for it is schema - queryFile.readline() - - while True: - dst = queryFile.readline() - src = consumeFile.readline() - - if dst: - if dst != src: - tdLog.exit("consumerId %d consume rows is not match the rows by direct query"%consumerId) - else: - break - return - def tmqCase1(self): tdLog.printNoPrefix("======== test case 1: ") paraDict = {'dbName': 'db1', @@ -113,7 +85,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[0], resultList[0])) tdLog.exit("0 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -139,7 +111,7 @@ class TDTestCase: tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[1], resultList[0])) tdLog.exit("1 tmq consume rows error!") - self.checkFileContent(consumerId, queryString) + tmqCom.checkFileContent(consumerId, queryString) # reinit consume info, and start tmq_sim, then check consume result tmqCom.initConsumerTable() @@ -165,7 +137,7 @@ class TDTestCase: # tdLog.info("expect consume rows: %d, act consume rows: %d"%(expectRowsList[2], resultList[0])) # tdLog.exit("2 tmq consume rows error!") - # self.checkFileContent(consumerId, queryString) + # tmqCom.checkFileContent(consumerId, queryString) time.sleep(10) for i in range(len(topicNameList)): From cb690ee2eaf90d9b2f87fb3604b7581939ca6601 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 11 Apr 2023 18:46:16 +0800 Subject: [PATCH 62/71] fix(test/udf): use 1 as lucky number instead of 88 --- tests/script/tsim/valgrind/checkUdf.sim | 16 +++--- tests/system-test/0-others/udfTest.py | 50 ++++++++--------- tests/system-test/0-others/udf_cfg2.py | 50 ++++++++--------- tests/system-test/0-others/udf_create.py | 50 ++++++++--------- .../system-test/0-others/udf_restart_taosd.py | 54 +++++++++---------- 5 files changed, 110 insertions(+), 110 deletions(-) diff --git a/tests/script/tsim/valgrind/checkUdf.sim b/tests/script/tsim/valgrind/checkUdf.sim index caf316bd86..b811834211 100644 --- a/tests/script/tsim/valgrind/checkUdf.sim +++ b/tests/script/tsim/valgrind/checkUdf.sim @@ -29,10 +29,10 @@ sql select udf1(f) from t; if $rows != 2 then return -1 endi -if $data00 != 88 then +if $data00 != 1 then return -1 endi -if $data10 != 88 then +if $data10 != 1 then return -1 endi @@ -51,10 +51,10 @@ sql select udf1(f1, f2) from t2; if $rows != 2 then return -1 endi -if $data00 != 88 then +if $data00 != 1 then return -1 endi -if $data10 != 88 then +if $data10 != 1 then return -1 endi @@ -72,10 +72,10 @@ print $rows , $data00 , $data10 , $data20 , $data30 if $rows != 4 then return -1 endi -if $data00 != 88 then +if $data00 != 1 then return -1 endi -if $data10 != 88 then +if $data10 != 1 then return -1 endi @@ -114,10 +114,10 @@ print $rows , $data00 , $data01 if $rows != 1 then return -1 endi -if $data00 != 176.000000000 then +if $data00 != 2.000000000 then return -1 endi -if $data01 != 152.420471066 then +if $data01 != 1.732050808 then return -1 endi diff --git a/tests/system-test/0-others/udfTest.py b/tests/system-test/0-others/udfTest.py index 15253df0c4..30451e75b8 100644 --- a/tests/system-test/0-others/udfTest.py +++ b/tests/system-test/0-others/udfTest.py @@ -191,20 +191,20 @@ class TDTestCase: tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) tdSql.checkData(0,2,1) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(0,4,1.000000000) - tdSql.checkData(0,5,88) + tdSql.checkData(0,5,1) tdSql.checkData(0,6,"binary1") - tdSql.checkData(0,7,88) + tdSql.checkData(0,7,1) tdSql.checkData(3,0,3) - tdSql.checkData(3,1,88) + tdSql.checkData(3,1,1) tdSql.checkData(3,2,33333) - tdSql.checkData(3,3,88) + tdSql.checkData(3,3,1) tdSql.checkData(3,4,33.000000000) - tdSql.checkData(3,5,88) + tdSql.checkData(3,5,1) tdSql.checkData(3,6,"binary1") - tdSql.checkData(3,7,88) + tdSql.checkData(3,7,1) tdSql.checkData(11,0,None) tdSql.checkData(11,1,None) @@ -213,7 +213,7 @@ class TDTestCase: tdSql.checkData(11,4,None) tdSql.checkData(11,5,None) tdSql.checkData(11,6,"binary1") - tdSql.checkData(11,7,88) + tdSql.checkData(11,7,1) tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1") tdSql.checkData(0,0,None) @@ -226,13 +226,13 @@ class TDTestCase: tdSql.checkData(0,7,None) tdSql.checkData(20,0,8) - tdSql.checkData(20,1,88) + tdSql.checkData(20,1,1) tdSql.checkData(20,2,88888) - tdSql.checkData(20,3,88) + tdSql.checkData(20,3,1) tdSql.checkData(20,4,888) - tdSql.checkData(20,5,88) + tdSql.checkData(20,5,1) tdSql.checkData(20,6,88) - tdSql.checkData(20,7,88) + tdSql.checkData(20,7,1) # aggregate functions @@ -375,14 +375,14 @@ class TDTestCase: tdSql.checkRows(25) tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,8) tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;") tdSql.checkRows(13) - tdSql.checkData(0,0,88) + tdSql.checkData(0,0,1) tdSql.checkData(0,1,8) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,7) # bug fix for crash @@ -401,9 +401,9 @@ class TDTestCase: tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts") tdSql.checkRows(3) tdSql.checkData(0,0,9) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,-99.990000000) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) @@ -412,20 +412,20 @@ class TDTestCase: tdSql.checkData(1,1,10) tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - tdSql.checkData(0,0,88) - tdSql.checkData(0,1,88) - tdSql.checkData(1,0,88) - tdSql.checkData(1,1,88) + tdSql.checkData(0,0,1) + tdSql.checkData(0,1,1) + tdSql.checkData(1,0,1) + tdSql.checkData(1,1,1) tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,0) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(1,0,1) - tdSql.checkData(1,1,88) + tdSql.checkData(1,1,1) tdSql.checkData(1,2,10) - tdSql.checkData(1,3,88) + tdSql.checkData(1,3,1) tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,16.881943016) diff --git a/tests/system-test/0-others/udf_cfg2.py b/tests/system-test/0-others/udf_cfg2.py index 869cb098e2..f00a0eed69 100644 --- a/tests/system-test/0-others/udf_cfg2.py +++ b/tests/system-test/0-others/udf_cfg2.py @@ -193,20 +193,20 @@ class TDTestCase: tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) tdSql.checkData(0,2,1) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(0,4,1.000000000) - tdSql.checkData(0,5,88) + tdSql.checkData(0,5,1) tdSql.checkData(0,6,"binary1") - tdSql.checkData(0,7,88) + tdSql.checkData(0,7,1) tdSql.checkData(3,0,3) - tdSql.checkData(3,1,88) + tdSql.checkData(3,1,1) tdSql.checkData(3,2,33333) - tdSql.checkData(3,3,88) + tdSql.checkData(3,3,1) tdSql.checkData(3,4,33.000000000) - tdSql.checkData(3,5,88) + tdSql.checkData(3,5,1) tdSql.checkData(3,6,"binary1") - tdSql.checkData(3,7,88) + tdSql.checkData(3,7,1) tdSql.checkData(11,0,None) tdSql.checkData(11,1,None) @@ -215,7 +215,7 @@ class TDTestCase: tdSql.checkData(11,4,None) tdSql.checkData(11,5,None) tdSql.checkData(11,6,"binary1") - tdSql.checkData(11,7,88) + tdSql.checkData(11,7,1) tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1") tdSql.checkData(0,0,None) @@ -228,13 +228,13 @@ class TDTestCase: tdSql.checkData(0,7,None) tdSql.checkData(20,0,8) - tdSql.checkData(20,1,88) + tdSql.checkData(20,1,1) tdSql.checkData(20,2,88888) - tdSql.checkData(20,3,88) + tdSql.checkData(20,3,1) tdSql.checkData(20,4,888) - tdSql.checkData(20,5,88) + tdSql.checkData(20,5,1) tdSql.checkData(20,6,88) - tdSql.checkData(20,7,88) + tdSql.checkData(20,7,1) # aggregate functions @@ -377,14 +377,14 @@ class TDTestCase: tdSql.checkRows(25) tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,8) tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;") tdSql.checkRows(13) - tdSql.checkData(0,0,88) + tdSql.checkData(0,0,1) tdSql.checkData(0,1,8) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,7) # bug fix for crash @@ -403,9 +403,9 @@ class TDTestCase: tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts") tdSql.checkRows(3) tdSql.checkData(0,0,9) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,-99.990000000) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) @@ -414,20 +414,20 @@ class TDTestCase: tdSql.checkData(1,1,10) tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - tdSql.checkData(0,0,88) - tdSql.checkData(0,1,88) - tdSql.checkData(1,0,88) - tdSql.checkData(1,1,88) + tdSql.checkData(0,0,1) + tdSql.checkData(0,1,1) + tdSql.checkData(1,0,1) + tdSql.checkData(1,1,1) tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,0) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(1,0,1) - tdSql.checkData(1,1,88) + tdSql.checkData(1,1,1) tdSql.checkData(1,2,10) - tdSql.checkData(1,3,88) + tdSql.checkData(1,3,1) tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,16.881943016) diff --git a/tests/system-test/0-others/udf_create.py b/tests/system-test/0-others/udf_create.py index 65dad64000..bab685b336 100644 --- a/tests/system-test/0-others/udf_create.py +++ b/tests/system-test/0-others/udf_create.py @@ -193,20 +193,20 @@ class TDTestCase: tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) tdSql.checkData(0,2,1) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(0,4,1.000000000) - tdSql.checkData(0,5,88) + tdSql.checkData(0,5,1) tdSql.checkData(0,6,"binary1") - tdSql.checkData(0,7,88) + tdSql.checkData(0,7,1) tdSql.checkData(3,0,3) - tdSql.checkData(3,1,88) + tdSql.checkData(3,1,1) tdSql.checkData(3,2,33333) - tdSql.checkData(3,3,88) + tdSql.checkData(3,3,1) tdSql.checkData(3,4,33.000000000) - tdSql.checkData(3,5,88) + tdSql.checkData(3,5,1) tdSql.checkData(3,6,"binary1") - tdSql.checkData(3,7,88) + tdSql.checkData(3,7,1) tdSql.checkData(11,0,None) tdSql.checkData(11,1,None) @@ -215,7 +215,7 @@ class TDTestCase: tdSql.checkData(11,4,None) tdSql.checkData(11,5,None) tdSql.checkData(11,6,"binary1") - tdSql.checkData(11,7,88) + tdSql.checkData(11,7,1) tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1") tdSql.checkData(0,0,None) @@ -228,13 +228,13 @@ class TDTestCase: tdSql.checkData(0,7,None) tdSql.checkData(20,0,8) - tdSql.checkData(20,1,88) + tdSql.checkData(20,1,1) tdSql.checkData(20,2,88888) - tdSql.checkData(20,3,88) + tdSql.checkData(20,3,1) tdSql.checkData(20,4,888) - tdSql.checkData(20,5,88) + tdSql.checkData(20,5,1) tdSql.checkData(20,6,88) - tdSql.checkData(20,7,88) + tdSql.checkData(20,7,1) # aggregate functions @@ -377,14 +377,14 @@ class TDTestCase: tdSql.checkRows(25) tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,8) tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;") tdSql.checkRows(13) - tdSql.checkData(0,0,88) + tdSql.checkData(0,0,1) tdSql.checkData(0,1,8) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,7) # bug fix for crash @@ -403,9 +403,9 @@ class TDTestCase: tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts") tdSql.checkRows(3) tdSql.checkData(0,0,9) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,-99.990000000) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) @@ -414,20 +414,20 @@ class TDTestCase: tdSql.checkData(1,1,10) tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - tdSql.checkData(0,0,88) - tdSql.checkData(0,1,88) - tdSql.checkData(1,0,88) - tdSql.checkData(1,1,88) + tdSql.checkData(0,0,1) + tdSql.checkData(0,1,1) + tdSql.checkData(1,0,1) + tdSql.checkData(1,1,1) tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,0) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(1,0,1) - tdSql.checkData(1,1,88) + tdSql.checkData(1,1,1) tdSql.checkData(1,2,10) - tdSql.checkData(1,3,88) + tdSql.checkData(1,3,1) tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,16.881943016) diff --git a/tests/system-test/0-others/udf_restart_taosd.py b/tests/system-test/0-others/udf_restart_taosd.py index dae707520f..42f0774c71 100644 --- a/tests/system-test/0-others/udf_restart_taosd.py +++ b/tests/system-test/0-others/udf_restart_taosd.py @@ -190,20 +190,20 @@ class TDTestCase: tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) tdSql.checkData(0,2,1) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(0,4,1.000000000) - tdSql.checkData(0,5,88) + tdSql.checkData(0,5,1) tdSql.checkData(0,6,"binary1") - tdSql.checkData(0,7,88) + tdSql.checkData(0,7,1) tdSql.checkData(3,0,3) - tdSql.checkData(3,1,88) + tdSql.checkData(3,1,1) tdSql.checkData(3,2,33333) - tdSql.checkData(3,3,88) + tdSql.checkData(3,3,1) tdSql.checkData(3,4,33.000000000) - tdSql.checkData(3,5,88) + tdSql.checkData(3,5,1) tdSql.checkData(3,6,"binary1") - tdSql.checkData(3,7,88) + tdSql.checkData(3,7,1) tdSql.checkData(11,0,None) tdSql.checkData(11,1,None) @@ -212,7 +212,7 @@ class TDTestCase: tdSql.checkData(11,4,None) tdSql.checkData(11,5,None) tdSql.checkData(11,6,"binary1") - tdSql.checkData(11,7,88) + tdSql.checkData(11,7,1) tdSql.query("select c1 , udf1(c1) ,c2 ,udf1(c2), c3 ,udf1(c3), c4 ,udf1(c4) from stb1 order by c1") tdSql.checkData(0,0,None) @@ -225,13 +225,13 @@ class TDTestCase: tdSql.checkData(0,7,None) tdSql.checkData(20,0,8) - tdSql.checkData(20,1,88) + tdSql.checkData(20,1,1) tdSql.checkData(20,2,88888) - tdSql.checkData(20,3,88) + tdSql.checkData(20,3,1) tdSql.checkData(20,4,888) - tdSql.checkData(20,5,88) + tdSql.checkData(20,5,1) tdSql.checkData(20,6,88) - tdSql.checkData(20,7,88) + tdSql.checkData(20,7,1) # aggregate functions @@ -374,14 +374,14 @@ class TDTestCase: tdSql.checkRows(25) tdSql.checkData(0,0,None) tdSql.checkData(0,1,None) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,8) tdSql.query("select abs(udf1(c1)) , abs(ceil(c1)) from ct1 order by ts;") tdSql.checkRows(13) - tdSql.checkData(0,0,88) + tdSql.checkData(0,0,1) tdSql.checkData(0,1,8) - tdSql.checkData(1,0,88) + tdSql.checkData(1,0,1) tdSql.checkData(1,1,7) # bug fix for crash @@ -400,9 +400,9 @@ class TDTestCase: tdSql.query("select c1 ,udf1(c1) , c6 ,udf1(c6) from stb1 where c1 > 8 order by ts") tdSql.checkRows(3) tdSql.checkData(0,0,9) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,-99.990000000) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.query("select sub1.c1, sub2.c2 from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) @@ -411,20 +411,20 @@ class TDTestCase: tdSql.checkData(1,1,10) tdSql.query("select udf1(sub1.c1), udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") - tdSql.checkData(0,0,88) - tdSql.checkData(0,1,88) - tdSql.checkData(1,0,88) - tdSql.checkData(1,1,88) + tdSql.checkData(0,0,1) + tdSql.checkData(0,1,1) + tdSql.checkData(1,0,1) + tdSql.checkData(1,1,1) tdSql.query("select sub1.c1 , udf1(sub1.c1), sub2.c2 ,udf1(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,0) - tdSql.checkData(0,1,88) + tdSql.checkData(0,1,1) tdSql.checkData(0,2,0) - tdSql.checkData(0,3,88) + tdSql.checkData(0,3,1) tdSql.checkData(1,0,1) - tdSql.checkData(1,1,88) + tdSql.checkData(1,1,1) tdSql.checkData(1,2,10) - tdSql.checkData(1,3,88) + tdSql.checkData(1,3,1) tdSql.query("select udf2(sub1.c1), udf2(sub2.c2) from sub1, sub2 where sub1.ts=sub2.ts and sub1.c1 is not null") tdSql.checkData(0,0,16.881943016) @@ -468,12 +468,12 @@ class TDTestCase: tdSql.checkData(1,0,1) tdSql.checkData(1,1,1) tdSql.checkData(1,2,1.110000000) - tdSql.checkData(1,3,88) + tdSql.checkData(1,3,1) tdSql.query("select c1,c6,udf1(c1,c6) from stb1 order by ts") tdSql.checkData(1,0,8) tdSql.checkData(1,1,88.880000000) - tdSql.checkData(1,2,88) + tdSql.checkData(1,2,1) tdSql.query("select abs(udf1(c1,c6,c1,c6)) , abs(ceil(c1)) from stb1 where c1 is not null order by ts;") tdSql.checkRows(22) From 3ac5b35f4b2a51c52be2c0d6c046968e4809649b Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Tue, 11 Apr 2023 18:57:11 +0800 Subject: [PATCH 63/71] fix(tsdb/cache): skip schema updating for non ts row --- source/dnode/vnode/src/tsdb/tsdbCache.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 6fc8ad8be6..b25e45228f 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -1468,11 +1468,14 @@ static int32_t mergeLastRow(tb_uid_t uid, STsdb *pTsdb, bool *dup, SArray **ppCo hasRow = true; - code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); - if (TSDB_CODE_SUCCESS != code) { - goto _err; + int32_t sversion = TSDBROW_SVERSION(pRow); + if (sversion != -1) { + code = updateTSchema(sversion, pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; } - pTSchema = pr->pCurrSchema; int16_t nCol = pTSchema->numOfCols; TSKEY rowTs = TSDBROW_TS(pRow); @@ -1622,11 +1625,14 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray, SCach hasRow = true; - code = updateTSchema(TSDBROW_SVERSION(pRow), pr, uid); - if (TSDB_CODE_SUCCESS != code) { - goto _err; + int32_t sversion = TSDBROW_SVERSION(pRow); + if (sversion != -1) { + code = updateTSchema(sversion, pr, uid); + if (TSDB_CODE_SUCCESS != code) { + goto _err; + } + pTSchema = pr->pCurrSchema; } - pTSchema = pr->pCurrSchema; int16_t nCol = pTSchema->numOfCols; TSKEY rowTs = TSDBROW_TS(pRow); From 985a2382425fb17495846b5ad5911ab71782886c Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Tue, 11 Apr 2023 19:38:10 +0800 Subject: [PATCH 64/71] fix:modify checkFileContent if one is empty --- tests/system-test/7-tmq/tmqCommon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/system-test/7-tmq/tmqCommon.py b/tests/system-test/7-tmq/tmqCommon.py index d17fea7b5a..b47601620a 100644 --- a/tests/system-test/7-tmq/tmqCommon.py +++ b/tests/system-test/7-tmq/tmqCommon.py @@ -468,10 +468,12 @@ class TMQCom: dstSplit = dst.split(',') srcSplit = src.split(',') - if len(dstSplit) != len(srcSplit): - tdLog.exit("consumerId %d consume rows len is not match the rows by direct query"%consumerId) if not dst or not src: break + if len(dstSplit) != len(srcSplit): + tdLog.exit("consumerId %d consume rows len is not match the rows by direct query,len(dstSplit):%d != len(srcSplit):%d, dst:%s, src:%s" + %(consumerId, len(dstSplit), len(srcSplit), dst, src)) + for i in range(len(dstSplit)): if srcSplit[i] != dstSplit[i]: srcFloat = float(srcSplit[i]) From 71283d6c4198d8305309743c090758638bcb819d Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 12 Apr 2023 09:35:47 +0800 Subject: [PATCH 65/71] fix: script if share not exist (#20875) --- packaging/tools/install.sh | 10 ++++++---- packaging/tools/makepkg.sh | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packaging/tools/install.sh b/packaging/tools/install.sh index 849ab5a92a..a1a95d9f30 100755 --- a/packaging/tools/install.sh +++ b/packaging/tools/install.sh @@ -573,16 +573,18 @@ function install_config() { } function install_share_etc() { + [ ! -d ${script_dir}/share/etc ] && return for c in `ls ${script_dir}/share/etc/`; do if [ -e /etc/$c ]; then out=/etc/$c.new.`date +%F` - ${csudo}cp -f ${script_dir}/share/etc/$c $out + ${csudo}cp -f ${script_dir}/share/etc/$c $out ||: else - ${csudo}cp -f ${script_dir}/share/etc/$c /etc/$c + ${csudo}cp -f ${script_dir}/share/etc/$c /etc/$c ||: fi done - ${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} + [ ! -d ${script_dir}/share/srv ] && return + ${csudo} cp ${script_dir}/share/srv/* ${service_config_dir} ||: } function install_log() { @@ -612,7 +614,7 @@ function install_examples() { function install_web() { if [ -d "${script_dir}/share" ]; then - ${csudo}cp -rf ${script_dir}/share/* ${install_main_dir}/share + ${csudo}cp -rf ${script_dir}/share/* ${install_main_dir}/share > /dev/null 2>&1 ||: fi } diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh index 12e215c62b..0dce526db6 100755 --- a/packaging/tools/makepkg.sh +++ b/packaging/tools/makepkg.sh @@ -150,7 +150,7 @@ fi mkdir -p ${install_dir}/bin && cp ${bin_files} ${install_dir}/bin && chmod a+x ${install_dir}/bin/* || : mkdir -p ${install_dir}/init.d && cp ${init_file_deb} ${install_dir}/init.d/${serverName}.deb mkdir -p ${install_dir}/init.d && cp ${init_file_rpm} ${install_dir}/init.d/${serverName}.rpm -mkdir -p ${install_dir}/share && cp -rf ${build_dir}/share/{etc,srv} ${install_dir}/share +mkdir -p ${install_dir}/share && cp -rf ${build_dir}/share/{etc,srv} ${install_dir}/share ||: if [ $adapterName != "taosadapter" ]; then mv ${install_dir}/cfg/${clientName2}adapter.toml ${install_dir}/cfg/$adapterName.toml From edc9fe9705123357da84a6441d5238d13fe2a0b0 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 11 Apr 2023 14:19:36 +0800 Subject: [PATCH 66/71] enh: change the error msg of INVALID_VGROUP_ID to Vnode is closed or removed --- source/dnode/mgmt/mgmt_vnode/src/vmWorker.c | 4 ++-- source/libs/sync/src/syncMain.c | 2 +- source/util/src/terror.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index e4e0d608de..cd42a214cd 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -163,8 +163,8 @@ static int32_t vmPutMsgToQueue(SVnodeMgmt *pMgmt, SRpcMsg *pMsg, EQueueType qtyp SVnodeObj *pVnode = vmAcquireVnode(pMgmt, pHead->vgId); if (pVnode == NULL) { - dGError("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d contLen:%d", pHead->vgId, pMsg, - terrstr(), TMSG_INFO(pMsg->msgType), qtype, pHead->contLen); + dGWarn("vgId:%d, msg:%p failed to put into vnode queue since %s, type:%s qtype:%d contLen:%d", pHead->vgId, pMsg, + terrstr(), TMSG_INFO(pMsg->msgType), qtype, pHead->contLen); terrno = (terrno != 0) ? terrno : -1; return terrno; } diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index c25ea24249..5e0c75cf2b 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -599,7 +599,7 @@ int32_t syncNodePropose(SSyncNode* pSyncNode, SRpcMsg* pMsg, bool isWeak, int64_ sNTrace(pSyncNode, "propose msg, type:%s", TMSG_INFO(pMsg->msgType)); code = (*pSyncNode->syncEqMsg)(pSyncNode->msgcb, &rpcMsg); if (code != 0) { - sError("vgId:%d, failed to propose msg while enqueue since %s", pSyncNode->vgId, terrstr()); + sWarn("vgId:%d, failed to propose msg while enqueue since %s", pSyncNode->vgId, terrstr()); (void)syncRespMgrDel(pSyncNode->pSyncRespMgr, seqNum); } diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 31ffbbf177..19ebe4b7aa 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -319,7 +319,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_SNODE_ALREADY_DEPLOYED, "Snode already deploye TAOS_DEFINE_ERROR(TSDB_CODE_SNODE_NOT_DEPLOYED, "Snode not deployed") // vnode -TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode moved to another dnode or was deleted") +TAOS_DEFINE_ERROR(TSDB_CODE_VND_INVALID_VGROUP_ID, "Vnode is closed or removed") TAOS_DEFINE_ERROR(TSDB_CODE_VND_NO_WRITE_AUTH, "Database write operation denied") TAOS_DEFINE_ERROR(TSDB_CODE_VND_NOT_EXIST, "Vnode not exist") TAOS_DEFINE_ERROR(TSDB_CODE_VND_ALREADY_EXIST, "Vnode already exist") From f6be5f2c0edb4f0a4d79f825dbcca8baf5c2042d Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 11 Apr 2023 15:15:01 +0800 Subject: [PATCH 67/71] enh: change sync log repl mgr to sync log repl in logging msg --- source/libs/sync/src/syncPipeline.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 04e52b3f49..22c87343ef 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -633,7 +633,7 @@ int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; if (pMgr->retryBackoff == SYNC_MAX_RETRY_BACKOFF) { syncLogReplReset(pMgr); - sWarn("vgId:%d, reset sync log repl mgr since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId, + sWarn("vgId:%d, reset sync log repl since retry backoff exceeding limit. peer:%" PRIx64, pNode->vgId, pDestId->addr); return -1; } @@ -658,8 +658,8 @@ int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { if (pMgr->states[pos].acked) { if (pMgr->matchIndex < index && pMgr->states[pos].timeMs + (syncGetRetryMaxWaitMs() << 3) < nowMs) { syncLogReplReset(pMgr); - sWarn("vgId:%d, reset sync log repl mgr since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId, - index, pDestId->addr); + sWarn("vgId:%d, reset sync log repl since stagnation. index:%" PRId64 ", peer:%" PRIx64, pNode->vgId, index, + pDestId->addr); goto _out; } continue; @@ -708,7 +708,7 @@ int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNod ASSERT(pMgr->matchIndex == 0); if (pMsg->matchIndex < 0) { pMgr->restored = true; - sInfo("vgId:%d, sync log repl mgr restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 + sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -725,7 +725,7 @@ int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNod if (pMsg->success && pMsg->matchIndex == pMsg->lastSendIndex) { pMgr->matchIndex = pMsg->matchIndex; pMgr->restored = true; - sInfo("vgId:%d, sync log repl mgr restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 + sInfo("vgId:%d, sync log repl restored. peer: dnode:%d (%" PRIx64 "), mgr: rs(%d) [%" PRId64 " %" PRId64 ", %" PRId64 "), buffer: [%" PRId64 " %" PRId64 " %" PRId64 ", %" PRId64 ")", pNode->vgId, DID(&destId), destId.addr, pMgr->restored, pMgr->startIndex, pMgr->matchIndex, pMgr->endIndex, pBuf->startIndex, pBuf->commitIndex, pBuf->matchIndex, pBuf->endIndex); @@ -781,7 +781,7 @@ int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != 0 && pMsg->startTime != pMgr->peerStartTime) { - sInfo("vgId:%d, reset sync log repl mgr in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "", + sInfo("vgId:%d, reset sync log repl in heartbeat. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64 "", pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); syncLogReplReset(pMgr); pMgr->peerStartTime = pMsg->startTime; @@ -794,8 +794,7 @@ int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncApp SSyncLogBuffer* pBuf = pNode->pLogBuf; taosThreadMutexLock(&pBuf->mutex); if (pMsg->startTime != pMgr->peerStartTime) { - sInfo("vgId:%d, reset sync log repl mgr in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64 - ", old:%" PRId64, + sInfo("vgId:%d, reset sync log repl in appendlog reply. peer:%" PRIx64 ", start time:%" PRId64 ", old:%" PRId64, pNode->vgId, pMsg->srcId.addr, pMsg->startTime, pMgr->peerStartTime); syncLogReplReset(pMgr); pMgr->peerStartTime = pMsg->startTime; @@ -1141,8 +1140,8 @@ int32_t syncLogReplReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncI if (terrno == TSDB_CODE_WAL_LOG_NOT_EXIST) { SSyncLogReplMgr* pMgr = syncNodeGetLogReplMgr(pNode, pDestId); if (pMgr) { - sInfo("vgId:%d, reset sync log repl mgr of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId, - pDestId->addr, terrstr(), index); + sInfo("vgId:%d, reset sync log repl of peer:%" PRIx64 " since %s. index:%" PRId64, pNode->vgId, pDestId->addr, + terrstr(), index); (void)syncLogReplReset(pMgr); } } From 09786a127d4fd0a3abc960a05b0f43a6651be223 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 11 Apr 2023 17:57:24 +0800 Subject: [PATCH 68/71] enh: refactor func names doOnce, attempt, probe, and sendTo of syncLogRepl --- source/libs/sync/inc/syncPipeline.h | 14 ++++++++------ source/libs/sync/src/syncPipeline.c | 24 ++++++++++++------------ source/libs/sync/src/syncReplication.c | 2 +- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/source/libs/sync/inc/syncPipeline.h b/source/libs/sync/inc/syncPipeline.h index 68db811b12..d709e33cd4 100644 --- a/source/libs/sync/inc/syncPipeline.h +++ b/source/libs/sync/inc/syncPipeline.h @@ -77,18 +77,19 @@ static FORCE_INLINE int32_t syncLogReplGetNextRetryBackoff(SSyncLogReplMgr* pMgr SyncTerm syncLogReplGetPrevLogTerm(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index); -int32_t syncLogReplReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode); -int32_t syncLogReplReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, - SRaftId* pDestId, bool* pBarrier); -int32_t syncLogReplReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode); -int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index); +int32_t syncLogReplDoOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode); +int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode); +int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index); + +int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode); +int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, SRaftId* pDestId, + bool* pBarrier); int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg); int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg); int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncAppendEntriesReply* pMsg); int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg); -int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode); // SSyncLogBuffer SSyncLogBuffer* syncLogBufferCreate(); @@ -100,6 +101,7 @@ int32_t syncLogBufferReInit(SSyncLogBuffer* pBuf, SSyncNode* pNode); int64_t syncLogBufferGetEndIndex(SSyncLogBuffer* pBuf); SyncTerm syncLogBufferGetLastMatchTerm(SSyncLogBuffer* pBuf); bool syncLogBufferIsEmpty(SSyncLogBuffer* pBuf); + int32_t syncLogBufferAppend(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry); int32_t syncLogBufferAccept(SSyncLogBuffer* pBuf, SSyncNode* pNode, SSyncRaftEntry* pEntry, SyncTerm prevTerm); int64_t syncLogBufferProceed(SSyncLogBuffer* pBuf, SSyncNode* pNode, SyncTerm* pMatchTerm); diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 22c87343ef..519a19e8c7 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -666,7 +666,7 @@ int32_t syncLogReplRetryOnNeed(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { } bool barrier = false; - if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { + if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { sError("vgId:%d, failed to replicate sync log entry since %s. index:%" PRId64 ", dest:%" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); goto _out; @@ -774,7 +774,7 @@ int32_t syncLogReplProcessReplyAsRecovery(SSyncLogReplMgr* pMgr, SSyncNode* pNod // attempt to replicate the raft log at index (void)syncLogReplReset(pMgr); - return syncLogReplReplicateProbe(pMgr, pNode, index); + return syncLogReplProbe(pMgr, pNode, index); } int32_t syncLogReplProcessHeartbeatReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncHeartbeatReply* pMsg) { @@ -809,16 +809,16 @@ int32_t syncLogReplProcessReply(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncApp return 0; } -int32_t syncLogReplReplicateOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { +int32_t syncLogReplDoOnce(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { if (pMgr->restored) { - (void)syncLogReplReplicateAttempt(pMgr, pNode); + (void)syncLogReplAttempt(pMgr, pNode); } else { - (void)syncLogReplReplicateProbe(pMgr, pNode, pNode->pLogBuf->matchIndex); + (void)syncLogReplProbe(pMgr, pNode, pNode->pLogBuf->matchIndex); } return 0; } -int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) { +int32_t syncLogReplProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index) { ASSERT(!pMgr->restored); ASSERT(pMgr->startIndex >= 0); int64_t retryMaxWaitMs = syncGetRetryMaxWaitMs(); @@ -833,7 +833,7 @@ int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncI SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; bool barrier = false; SyncTerm term = -1; - if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { + if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); return -1; @@ -856,7 +856,7 @@ int32_t syncLogReplReplicateProbe(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncI return 0; } -int32_t syncLogReplReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { +int32_t syncLogReplAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { ASSERT(pMgr->restored); SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; @@ -878,7 +878,7 @@ int32_t syncLogReplReplicateAttempt(SSyncLogReplMgr* pMgr, SSyncNode* pNode) { SRaftId* pDestId = &pNode->replicasId[pMgr->peerId]; bool barrier = false; SyncTerm term = -1; - if (syncLogReplReplicateOneTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { + if (syncLogReplSendTo(pMgr, pNode, index, &term, pDestId, &barrier) < 0) { sError("vgId:%d, failed to replicate log entry since %s. index:%" PRId64 ", dest: 0x%016" PRIx64 "", pNode->vgId, terrstr(), index, pDestId->addr); return -1; @@ -931,7 +931,7 @@ int32_t syncLogReplProcessReplyAsNormal(SSyncLogReplMgr* pMgr, SSyncNode* pNode, pMgr->startIndex = pMgr->matchIndex; } - return syncLogReplReplicateAttempt(pMgr, pNode); + return syncLogReplAttempt(pMgr, pNode); } SSyncLogReplMgr* syncLogReplCreate() { @@ -1126,8 +1126,8 @@ SSyncRaftEntry* syncLogBufferGetOneEntry(SSyncLogBuffer* pBuf, SSyncNode* pNode, return pEntry; } -int32_t syncLogReplReplicateOneTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, - SRaftId* pDestId, bool* pBarrier) { +int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex index, SyncTerm* pTerm, SRaftId* pDestId, + bool* pBarrier) { SSyncRaftEntry* pEntry = NULL; SRpcMsg msgOut = {0}; bool inBuf = false; diff --git a/source/libs/sync/src/syncReplication.c b/source/libs/sync/src/syncReplication.c index 43d2bc839b..8ac9a860e3 100644 --- a/source/libs/sync/src/syncReplication.c +++ b/source/libs/sync/src/syncReplication.c @@ -74,7 +74,7 @@ int32_t syncNodeReplicateWithoutLock(SSyncNode* pNode) { continue; } SSyncLogReplMgr* pMgr = pNode->logReplMgrs[i]; - (void)syncLogReplReplicateOnce(pMgr, pNode); + (void)syncLogReplDoOnce(pMgr, pNode); } return 0; } From 3efa36ca51f3ecdc64b3b1156906ec4eb52c905d Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 11 Apr 2023 18:22:59 +0800 Subject: [PATCH 69/71] enh: refactor func name syncLogIsReplicationBarrier to syncLogReplBarrier --- source/libs/sync/inc/syncRaftEntry.h | 2 +- source/libs/sync/src/syncPipeline.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/libs/sync/inc/syncRaftEntry.h b/source/libs/sync/inc/syncRaftEntry.h index a39e043c52..f9447e0168 100644 --- a/source/libs/sync/inc/syncRaftEntry.h +++ b/source/libs/sync/inc/syncRaftEntry.h @@ -45,7 +45,7 @@ SSyncRaftEntry* syncEntryBuildNoop(SyncTerm term, SyncIndex index, int32_t vgId) void syncEntryDestroy(SSyncRaftEntry* pEntry); void syncEntry2OriginalRpc(const SSyncRaftEntry* pEntry, SRpcMsg* pRpcMsg); // step 7 -static FORCE_INLINE bool syncLogIsReplicationBarrier(SSyncRaftEntry* pEntry) { +static FORCE_INLINE bool syncLogReplBarrier(SSyncRaftEntry* pEntry) { return pEntry->originalRpcType == TDMT_SYNC_NOOP; } diff --git a/source/libs/sync/src/syncPipeline.c b/source/libs/sync/src/syncPipeline.c index 519a19e8c7..69888ed8ea 100644 --- a/source/libs/sync/src/syncPipeline.c +++ b/source/libs/sync/src/syncPipeline.c @@ -1147,7 +1147,7 @@ int32_t syncLogReplSendTo(SSyncLogReplMgr* pMgr, SSyncNode* pNode, SyncIndex ind } goto _err; } - *pBarrier = syncLogIsReplicationBarrier(pEntry); + *pBarrier = syncLogReplBarrier(pEntry); prevLogTerm = syncLogReplGetPrevLogTerm(pMgr, pNode, index); if (prevLogTerm < 0) { From 19f09a10e64734702013810f7820a4709dd3acad Mon Sep 17 00:00:00 2001 From: Xiaoyu Wang Date: Wed, 12 Apr 2023 10:14:45 +0800 Subject: [PATCH 70/71] fix: show user privileges invalid write --- source/dnode/mnode/impl/src/mndUser.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 3a1c4ce58f..d08227927a 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -1168,15 +1168,13 @@ static void mndLoopHash(SHashObj *hash, char *priType, SSDataBlock *pBlock, int3 sprintf(sql, "error"); } - // char *obj = taosMemoryMalloc(sqlLen + VARSTR_HEADER_SIZE + 1); char obj[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(obj, sql, pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)obj, false); - // taosMemoryFree(obj); } else { - char condition[20] = {0}; + char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, *numOfRows, (const char *)condition, false); @@ -1257,12 +1255,12 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); - char tableName[20] = {0}; + char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); - char condition[20] = {0}; + char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); @@ -1292,12 +1290,12 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)objName, false); - char tableName[20] = {0}; + char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); - char condition[20] = {0}; + char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); @@ -1329,12 +1327,12 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)topicName, false); - char tableName[20] = {0}; + char tableName[TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(tableName, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)tableName, false); - char condition[20] = {0}; + char condition[TSDB_PRIVILEDGE_CONDITION_LEN + VARSTR_HEADER_SIZE] = {0}; STR_WITH_MAXSIZE_TO_VARSTR(condition, "", pShow->pMeta->pSchemas[cols].bytes); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataSetVal(pColInfo, numOfRows, (const char *)condition, false); From d551075bbada11f4bafafdb7ecfeeb8f4f1ea4de Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 12 Apr 2023 16:22:25 +0800 Subject: [PATCH 71/71] fix: taosdump continue if ts out of range for main (#20887) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 0110b27b32..d8bf3a09b4 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 149ac34 + GIT_TAG 0681d8b SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE