diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 91710c4633e1436cf90bfaebf1a8c2f9d2de7e43..a123777b2a5035275e126554e5dfa5c62642f613 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -913,6 +913,8 @@ int32_t tDeserializeSCreateDnodeReq(void* buf, int32_t bufLen, SCreateDnodeReq* typedef struct { int32_t dnodeId; + char fqdn[TSDB_FQDN_LEN]; + int32_t port; } SDropDnodeReq; int32_t tSerializeSDropDnodeReq(void* buf, int32_t bufLen, SDropDnodeReq* pReq); diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 6235fbaf974de00e733d5f60150954f6a0a3b3bb..f5556c709ce9e12c0f957bf949e40db86a2f2d16 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -34,110 +34,121 @@ #define TK_NK_REM 16 #define TK_NK_CONCAT 17 #define TK_CREATE 18 -#define TK_DATABASE 19 -#define TK_IF 20 -#define TK_NOT 21 -#define TK_EXISTS 22 -#define TK_BLOCKS 23 -#define TK_NK_INTEGER 24 -#define TK_CACHE 25 -#define TK_CACHELAST 26 -#define TK_COMP 27 -#define TK_DAYS 28 -#define TK_FSYNC 29 -#define TK_MAXROWS 30 -#define TK_MINROWS 31 -#define TK_KEEP 32 -#define TK_PRECISION 33 -#define TK_NK_STRING 34 -#define TK_QUORUM 35 -#define TK_REPLICA 36 -#define TK_TTL 37 -#define TK_WAL 38 -#define TK_VGROUPS 39 -#define TK_SINGLE_STABLE 40 -#define TK_STREAM_MODE 41 -#define TK_USE 42 -#define TK_TABLE 43 -#define TK_NK_LP 44 -#define TK_NK_RP 45 -#define TK_STABLE 46 -#define TK_USING 47 -#define TK_TAGS 48 -#define TK_NK_ID 49 -#define TK_NK_DOT 50 -#define TK_NK_COMMA 51 -#define TK_COMMENT 52 -#define TK_BOOL 53 -#define TK_TINYINT 54 -#define TK_SMALLINT 55 -#define TK_INT 56 -#define TK_INTEGER 57 -#define TK_BIGINT 58 -#define TK_FLOAT 59 -#define TK_DOUBLE 60 -#define TK_BINARY 61 -#define TK_TIMESTAMP 62 -#define TK_NCHAR 63 -#define TK_UNSIGNED 64 -#define TK_JSON 65 -#define TK_VARCHAR 66 -#define TK_MEDIUMBLOB 67 -#define TK_BLOB 68 -#define TK_VARBINARY 69 -#define TK_DECIMAL 70 -#define TK_SMA 71 -#define TK_SHOW 72 -#define TK_DATABASES 73 -#define TK_TABLES 74 -#define TK_NK_FLOAT 75 -#define TK_NK_BOOL 76 -#define TK_NK_VARIABLE 77 -#define TK_BETWEEN 78 -#define TK_IS 79 -#define TK_NULL 80 -#define TK_NK_LT 81 -#define TK_NK_GT 82 -#define TK_NK_LE 83 -#define TK_NK_GE 84 -#define TK_NK_NE 85 -#define TK_NK_EQ 86 -#define TK_LIKE 87 -#define TK_MATCH 88 -#define TK_NMATCH 89 -#define TK_IN 90 -#define TK_FROM 91 -#define TK_AS 92 -#define TK_JOIN 93 -#define TK_ON 94 -#define TK_INNER 95 -#define TK_SELECT 96 -#define TK_DISTINCT 97 -#define TK_WHERE 98 -#define TK_PARTITION 99 -#define TK_BY 100 -#define TK_SESSION 101 -#define TK_STATE_WINDOW 102 -#define TK_INTERVAL 103 -#define TK_SLIDING 104 -#define TK_FILL 105 -#define TK_VALUE 106 -#define TK_NONE 107 -#define TK_PREV 108 -#define TK_LINEAR 109 -#define TK_NEXT 110 -#define TK_GROUP 111 -#define TK_HAVING 112 -#define TK_ORDER 113 -#define TK_SLIMIT 114 -#define TK_SOFFSET 115 -#define TK_LIMIT 116 -#define TK_OFFSET 117 -#define TK_ASC 118 -#define TK_DESC 119 -#define TK_NULLS 120 -#define TK_FIRST 121 -#define TK_LAST 122 +#define TK_USER 19 +#define TK_PASS 20 +#define TK_NK_STRING 21 +#define TK_ALTER 22 +#define TK_PRIVILEGE 23 +#define TK_DROP 24 +#define TK_SHOW 25 +#define TK_USERS 26 +#define TK_DNODE 27 +#define TK_PORT 28 +#define TK_NK_INTEGER 29 +#define TK_DNODES 30 +#define TK_NK_ID 31 +#define TK_NK_IPTOKEN 32 +#define TK_DATABASE 33 +#define TK_DATABASES 34 +#define TK_USE 35 +#define TK_IF 36 +#define TK_NOT 37 +#define TK_EXISTS 38 +#define TK_BLOCKS 39 +#define TK_CACHE 40 +#define TK_CACHELAST 41 +#define TK_COMP 42 +#define TK_DAYS 43 +#define TK_FSYNC 44 +#define TK_MAXROWS 45 +#define TK_MINROWS 46 +#define TK_KEEP 47 +#define TK_PRECISION 48 +#define TK_QUORUM 49 +#define TK_REPLICA 50 +#define TK_TTL 51 +#define TK_WAL 52 +#define TK_VGROUPS 53 +#define TK_SINGLE_STABLE 54 +#define TK_STREAM_MODE 55 +#define TK_TABLE 56 +#define TK_NK_LP 57 +#define TK_NK_RP 58 +#define TK_STABLE 59 +#define TK_TABLES 60 +#define TK_STABLES 61 +#define TK_USING 62 +#define TK_TAGS 63 +#define TK_NK_DOT 64 +#define TK_NK_COMMA 65 +#define TK_COMMENT 66 +#define TK_BOOL 67 +#define TK_TINYINT 68 +#define TK_SMALLINT 69 +#define TK_INT 70 +#define TK_INTEGER 71 +#define TK_BIGINT 72 +#define TK_FLOAT 73 +#define TK_DOUBLE 74 +#define TK_BINARY 75 +#define TK_TIMESTAMP 76 +#define TK_NCHAR 77 +#define TK_UNSIGNED 78 +#define TK_JSON 79 +#define TK_VARCHAR 80 +#define TK_MEDIUMBLOB 81 +#define TK_BLOB 82 +#define TK_VARBINARY 83 +#define TK_DECIMAL 84 +#define TK_SMA 85 +#define TK_NK_FLOAT 86 +#define TK_NK_BOOL 87 +#define TK_NK_VARIABLE 88 +#define TK_BETWEEN 89 +#define TK_IS 90 +#define TK_NULL 91 +#define TK_NK_LT 92 +#define TK_NK_GT 93 +#define TK_NK_LE 94 +#define TK_NK_GE 95 +#define TK_NK_NE 96 +#define TK_NK_EQ 97 +#define TK_LIKE 98 +#define TK_MATCH 99 +#define TK_NMATCH 100 +#define TK_IN 101 +#define TK_FROM 102 +#define TK_AS 103 +#define TK_JOIN 104 +#define TK_ON 105 +#define TK_INNER 106 +#define TK_SELECT 107 +#define TK_DISTINCT 108 +#define TK_WHERE 109 +#define TK_PARTITION 110 +#define TK_BY 111 +#define TK_SESSION 112 +#define TK_STATE_WINDOW 113 +#define TK_INTERVAL 114 +#define TK_SLIDING 115 +#define TK_FILL 116 +#define TK_VALUE 117 +#define TK_NONE 118 +#define TK_PREV 119 +#define TK_LINEAR 120 +#define TK_NEXT 121 +#define TK_GROUP 122 +#define TK_HAVING 123 +#define TK_ORDER 124 +#define TK_SLIMIT 125 +#define TK_SOFFSET 126 +#define TK_LIMIT 127 +#define TK_OFFSET 128 +#define TK_ASC 129 +#define TK_DESC 130 +#define TK_NULLS 131 +#define TK_FIRST 132 +#define TK_LAST 133 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 @@ -155,9 +166,8 @@ #define TK_NOW 504 #define TK_VALUES 507 #define TK_IMPORT 507 -#define TK_SEMI 508 -#define TK_IPTOKEN 509 +#define TK_NK_SEMI 508 -#define TK_NIL 65535 +#define TK_NK_NIL 65535 #endif /*_TD_COMMON_TOKEN_H_*/ diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index e7067f8b6625b4dc60a56a86f5a4061420008c11..95d35ab9186610e4408ae88653a835023cdbeae0 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -54,6 +54,12 @@ typedef struct SUseDatabaseStmt { char dbName[TSDB_DB_NAME_LEN]; } SUseDatabaseStmt; +typedef struct SDropDatabaseStmt { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; + bool ignoreNotExists; +} SDropDatabaseStmt; + typedef struct STableOptions { int32_t keep; int32_t ttl; @@ -94,6 +100,49 @@ typedef struct SCreateMultiTableStmt { SNodeList* pSubTables; } SCreateMultiTableStmt; +typedef struct SDropTableClause { + ENodeType type; + char dbName[TSDB_DB_NAME_LEN]; + char tableName[TSDB_TABLE_NAME_LEN]; + bool ignoreNotExists; +} SDropTableClause; + +typedef struct SDropTableStmt { + ENodeType type; + SNodeList* pTables; +} SDropTableStmt; + +typedef struct SCreateUserStmt { + ENodeType type; + char useName[TSDB_USER_LEN]; + char password[TSDB_USET_PASSWORD_LEN]; +} SCreateUserStmt; + +typedef struct SAlterUserStmt { + ENodeType type; + char useName[TSDB_USER_LEN]; + char password[TSDB_USET_PASSWORD_LEN]; + int8_t alterType; +} SAlterUserStmt; + +typedef struct SDropUserStmt { + ENodeType type; + char useName[TSDB_USER_LEN]; +} SDropUserStmt; + +typedef struct SCreateDnodeStmt { + ENodeType type; + char fqdn[TSDB_FQDN_LEN]; + int32_t port; +} SCreateDnodeStmt; + +typedef struct SDropDnodeStmt { + ENodeType type; + int32_t dnodeId; + char fqdn[TSDB_FQDN_LEN]; + int32_t port; +} SDropDnodeStmt; + #ifdef __cplusplus } #endif diff --git a/include/libs/nodes/nodes.h b/include/libs/nodes/nodes.h index 589a0dc21bba461267f4b453e49f32dbfc0e257a..13b2ef7b7be9d6207977688d797c30f1b1bec455 100644 --- a/include/libs/nodes/nodes.h +++ b/include/libs/nodes/nodes.h @@ -72,12 +72,24 @@ typedef enum ENodeType { QUERY_NODE_SELECT_STMT, QUERY_NODE_VNODE_MODIF_STMT, QUERY_NODE_CREATE_DATABASE_STMT, + QUERY_NODE_DROP_DATABASE_STMT, + QUERY_NODE_SHOW_DATABASES_STMT, // temp QUERY_NODE_CREATE_TABLE_STMT, QUERY_NODE_CREATE_SUBTABLE_CLAUSE, QUERY_NODE_CREATE_MULTI_TABLE_STMT, - QUERY_NODE_USE_DATABASE_STMT, - QUERY_NODE_SHOW_DATABASES_STMT, // temp + QUERY_NODE_DROP_TABLE_CLAUSE, + QUERY_NODE_DROP_TABLE_STMT, QUERY_NODE_SHOW_TABLES_STMT, // temp + QUERY_NODE_SHOW_STABLES_STMT, + QUERY_NODE_CREATE_USER_STMT, + QUERY_NODE_ALTER_USER_STMT, + QUERY_NODE_DROP_USER_STMT, + QUERY_NODE_SHOW_USERS_STMT, + QUERY_NODE_USE_DATABASE_STMT, + QUERY_NODE_CREATE_DNODE_STMT, + QUERY_NODE_DROP_DNODE_STMT, + QUERY_NODE_SHOW_DNODES_STMT, + QUERY_NODE_SHOW_VGROUPS_STMT, // logic plan node QUERY_NODE_LOGIC_PLAN_SCAN, diff --git a/include/util/taoserror.h b/include/util/taoserror.h index 1722ec46da2ad31f327e075b949289d57ae4ae2e..d904881ae1361b5b624bb7895fcf4f9f817c9bcf 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -457,6 +457,7 @@ int32_t* taosGetErrno(); #define TSDB_CODE_SCH_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2502) //parser +#define TSDB_CODE_PAR_SYNTAX_ERROR TAOS_DEF_ERROR_CODE(0, 0x2600) #define TSDB_CODE_PAR_INVALID_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2601) #define TSDB_CODE_PAR_TABLE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x2602) #define TSDB_CODE_PAR_AMBIGUOUS_COLUMN TAOS_DEF_ERROR_CODE(0, 0x2603) @@ -471,6 +472,11 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) #define TSDB_CODE_PAR_TAGS_NOT_MATCHED TAOS_DEF_ERROR_CODE(0, 0x260D) #define TSDB_CODE_PAR_INVALID_TAG_NAME TAOS_DEF_ERROR_CODE(0, 0x260E) +#define TSDB_CODE_PAR_INCOMPLETE_SQL TAOS_DEF_ERROR_CODE(0, 0x260F) +#define TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG TAOS_DEF_ERROR_CODE(0, 0x2610) +#define TSDB_CODE_PAR_PASSWD_EMPTY TAOS_DEF_ERROR_CODE(0, 0x2611) +#define TSDB_CODE_PAR_INVALID_PORT TAOS_DEF_ERROR_CODE(0, 0x2612) +#define TSDB_CODE_PAR_INVALID_ENDPOINT TAOS_DEF_ERROR_CODE(0, 0x2613) #ifdef __cplusplus } diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 8b4f572feebe06cac6a1d5a7d785b84dc74c7a94..5c73c74af4243f44034bce8e9b7e847dd41a194b 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1007,11 +1007,32 @@ int32_t tDeserializeSMCreateDropQSBNodeReq(void *buf, int32_t bufLen, SMCreateQn } int32_t tSerializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq) { - return tSerializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq); + SCoder encoder = {0}; + tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER); + + if (tStartEncode(&encoder) < 0) return -1; + if (tEncodeI32(&encoder, pReq->dnodeId) < 0) return -1; + if (tEncodeCStr(&encoder, pReq->fqdn) < 0) return -1; + if (tEncodeI32(&encoder, pReq->port) < 0) return -1; + tEndEncode(&encoder); + + int32_t tlen = encoder.pos; + tCoderClear(&encoder); + return tlen; } int32_t tDeserializeSDropDnodeReq(void *buf, int32_t bufLen, SDropDnodeReq *pReq) { - return tDeserializeSMCreateDropQSBNodeReq(buf, bufLen, (SMCreateQnodeReq *)pReq); + SCoder decoder = {0}; + tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER); + + if (tStartDecode(&decoder) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->dnodeId) < 0) return -1; + if (tDecodeCStrTo(&decoder, pReq->fqdn) < 0) return -1; + if (tDecodeI32(&decoder, &pReq->port) < 0) return -1; + tEndDecode(&decoder); + + tCoderClear(&decoder); + return 0; } int32_t tSerializeSMCreateDropMnodeReq(void *buf, int32_t bufLen, SMCreateMnodeReq *pReq) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 83996a79b7090e4f1f3c5164c3645bcc06c80484..ce3017fa27104ce3c089f84606fb6b78d5b55291 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -82,17 +82,41 @@ SNodeptr nodesMakeNode(ENodeType type) { return makeNode(type, sizeof(SVnodeModifOpStmt)); case QUERY_NODE_CREATE_DATABASE_STMT: return makeNode(type, sizeof(SCreateDatabaseStmt)); + case QUERY_NODE_DROP_DATABASE_STMT: + return makeNode(type, sizeof(SDropDatabaseStmt)); + case QUERY_NODE_SHOW_DATABASES_STMT: + return makeNode(type, sizeof(SNode)); case QUERY_NODE_CREATE_TABLE_STMT: return makeNode(type, sizeof(SCreateTableStmt)); case QUERY_NODE_CREATE_SUBTABLE_CLAUSE: return makeNode(type, sizeof(SCreateSubTableClause)); case QUERY_NODE_CREATE_MULTI_TABLE_STMT: return makeNode(type, sizeof(SCreateMultiTableStmt)); + case QUERY_NODE_DROP_TABLE_CLAUSE: + return makeNode(type, sizeof(SDropTableClause)); + case QUERY_NODE_DROP_TABLE_STMT: + return makeNode(type, sizeof(SDropTableStmt)); + case QUERY_NODE_SHOW_TABLES_STMT: + case QUERY_NODE_SHOW_STABLES_STMT: + return makeNode(type, sizeof(SNode)); + case QUERY_NODE_CREATE_USER_STMT: + return makeNode(type, sizeof(SCreateUserStmt)); + case QUERY_NODE_ALTER_USER_STMT: + return makeNode(type, sizeof(SAlterUserStmt)); + case QUERY_NODE_DROP_USER_STMT: + return makeNode(type, sizeof(SDropUserStmt)); + case QUERY_NODE_SHOW_USERS_STMT: + return makeNode(type, sizeof(SNode)); case QUERY_NODE_USE_DATABASE_STMT: return makeNode(type, sizeof(SUseDatabaseStmt)); - case QUERY_NODE_SHOW_DATABASES_STMT: - case QUERY_NODE_SHOW_TABLES_STMT: - return makeNode(type, sizeof(SNode));; + case QUERY_NODE_CREATE_DNODE_STMT: + return makeNode(type, sizeof(SCreateDnodeStmt)); + case QUERY_NODE_DROP_DNODE_STMT: + return makeNode(type, sizeof(SDropDnodeStmt)); + case QUERY_NODE_SHOW_DNODES_STMT: + return makeNode(type, sizeof(SNode)); + case QUERY_NODE_SHOW_VGROUPS_STMT: + return makeNode(type, sizeof(SNode)); case QUERY_NODE_LOGIC_PLAN_SCAN: return makeNode(type, sizeof(SScanLogicNode)); case QUERY_NODE_LOGIC_PLAN_JOIN: diff --git a/source/libs/parser/inc/astCreateFuncs.h b/source/libs/parser/inc/astCreateFuncs.h index 4f39e8394559209456453db70944bf30cf755cfd..2618b5328fbdb35020199a71cccf0491c0c982ab 100644 --- a/source/libs/parser/inc/astCreateFuncs.h +++ b/source/libs/parser/inc/astCreateFuncs.h @@ -22,20 +22,48 @@ extern "C" { #include "cmdnodes.h" #include "parser.h" +#include "parserUtil.h" #include "querynodes.h" #include "ttoken.h" typedef struct SAstCreateContext { SParseContext* pQueryCxt; + SMsgBuf msgBuf; bool notSupport; bool valid; SNode* pRootNode; } SAstCreateContext; -typedef struct STokenPair { - SToken first; - SToken second; -} STokenPair; +typedef enum EDatabaseOptionType { + DB_OPTION_BLOCKS = 0, + DB_OPTION_CACHE, + DB_OPTION_CACHELAST, + DB_OPTION_COMP, + DB_OPTION_DAYS, + DB_OPTION_FSYNC, + DB_OPTION_MAXROWS, + DB_OPTION_MINROWS, + DB_OPTION_KEEP, + DB_OPTION_PRECISION, + DB_OPTION_QUORUM, + DB_OPTION_REPLICA, + DB_OPTION_TTL, + DB_OPTION_WAL, + DB_OPTION_VGROUPS, + DB_OPTION_SINGLESTABLE, + DB_OPTION_STREAMMODE, + + DB_OPTION_MAX +} EDatabaseOptionType; + +typedef enum ETableOptionType { + TABLE_OPTION_KEEP = 0, + TABLE_OPTION_TTL, + TABLE_OPTION_COMMENT, + TABLE_OPTION_SMA, + + TABLE_OPTION_MAX +} ETableOptionType; extern SToken nil_token; @@ -81,53 +109,28 @@ SNode* addLimitClause(SAstCreateContext* pCxt, SNode* pStmt, SNode* pLimit); SNode* createSelectStmt(SAstCreateContext* pCxt, bool isDistinct, SNodeList* pProjectionList, SNode* pTable); SNode* createSetOperator(SAstCreateContext* pCxt, ESetOperatorType type, SNode* pLeft, SNode* pRight); -typedef enum EDatabaseOptionType { - DB_OPTION_BLOCKS = 0, - DB_OPTION_CACHE, - DB_OPTION_CACHELAST, - DB_OPTION_COMP, - DB_OPTION_DAYS, - DB_OPTION_FSYNC, - DB_OPTION_MAXROWS, - DB_OPTION_MINROWS, - DB_OPTION_KEEP, - DB_OPTION_PRECISION, - DB_OPTION_QUORUM, - DB_OPTION_REPLICA, - DB_OPTION_TTL, - DB_OPTION_WAL, - DB_OPTION_VGROUPS, - DB_OPTION_SINGLESTABLE, - DB_OPTION_STREAMMODE, - - DB_OPTION_MAX -} EDatabaseOptionType; SDatabaseOptions* createDefaultDatabaseOptions(SAstCreateContext* pCxt); SDatabaseOptions* setDatabaseOption(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, EDatabaseOptionType type, const SToken* pVal); SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, const SToken* pDbName, SDatabaseOptions* pOptions); - -typedef enum ETableOptionType { - TABLE_OPTION_KEEP = 0, - TABLE_OPTION_TTL, - TABLE_OPTION_COMMENT, - TABLE_OPTION_SMA, - - TABLE_OPTION_MAX -} ETableOptionType; +SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pDbName); STableOptions* createDefaultTableOptions(SAstCreateContext* pCxt); STableOptions* setTableOption(SAstCreateContext* pCxt, STableOptions* pOptions, ETableOptionType type, const SToken* pVal); STableOptions* setTableSmaOption(SAstCreateContext* pCxt, STableOptions* pOptions, SNodeList* pSma); SNode* createColumnDefNode(SAstCreateContext* pCxt, const SToken* pColName, SDataType dataType, const SToken* pComment); SDataType createDataType(uint8_t type); SDataType createVarLenDataType(uint8_t type, const SToken* pLen); -SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, SNodeList* pTags, STableOptions* pOptions); -SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, - const STokenPair* pFullTableName, const STokenPair* pUseFullTableName, SNodeList* pSpecificTags, SNodeList* pValsOfTags); +SNode* createCreateTableStmt(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNodeList* pCols, SNodeList* pTags, STableOptions* pOptions); +SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, SNodeList* pSpecificTags, SNodeList* pValsOfTags); SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables); - +SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable); +SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables); SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName); - SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type); +SNode* createCreateUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, const SToken* pPassword); +SNode* createAlterUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, int8_t alterType, const SToken* pVal); +SNode* createDropUserStmt(SAstCreateContext* pCxt, const SToken* pUserName); +SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort); +SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode); #ifdef __cplusplus } diff --git a/source/libs/parser/inc/new_sql.y b/source/libs/parser/inc/new_sql.y index 942eaf459a39fc2fd2b527dcc8cbafeaa8db0fab..221b3519902e837c6c059763cb230e5505559b4a 100644 --- a/source/libs/parser/inc/new_sql.y +++ b/source/libs/parser/inc/new_sql.y @@ -25,18 +25,9 @@ %syntax_error { if(TOKEN.z) { - char msg[] = "syntax error near \"%s\""; - int32_t sqlLen = strlen(&TOKEN.z[0]); - - if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > pCxt->pQueryCxt->msgLen) { - char tmpstr[128] = {0}; - memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1); - sprintf(pCxt->pQueryCxt->pMsg, msg, tmpstr); - } else { - sprintf(pCxt->pQueryCxt->pMsg, msg, &TOKEN.z[0]); - } + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } else { - sprintf(pCxt->pQueryCxt->pMsg, "Incomplete SQL statement"); + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL); } pCxt->valid = false; } @@ -52,12 +43,43 @@ %left NK_CONCAT. //%right NK_BITNOT. -/************************************************ create database *****************************************************/ -cmd ::= CREATE DATABASE exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C);} +/************************************************ create/alter/drop/show user *****************************************/ +cmd ::= CREATE USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createCreateUserStmt(pCxt, &A, &B);} +cmd ::= ALTER USER user_name(A) PASS NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PASSWD, &B);} +cmd ::= ALTER USER user_name(A) PRIVILEGE NK_STRING(B). { pCxt->pRootNode = createAlterUserStmt(pCxt, &A, TSDB_ALTER_USER_PRIVILEGES, &B);} +cmd ::= DROP USER user_name(A). { pCxt->pRootNode = createDropUserStmt(pCxt, &A); } +cmd ::= SHOW USERS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } + +/************************************************ create/drop/show dnode **********************************************/ +cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL);} +cmd ::= CREATE DNODE dnode_host_name(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B);} +cmd ::= DROP DNODE NK_INTEGER(A). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A);} +cmd ::= DROP DNODE dnode_endpoint(A). { pCxt->pRootNode = createDropDnodeStmt(pCxt, &A);} +cmd ::= SHOW DNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } + +%type dnode_endpoint { SToken } +%destructor dnode_endpoint { } +dnode_endpoint(A) ::= NK_STRING(B). { A = B; } + +%type dnode_host_name { SToken } +%destructor dnode_host_name { } +dnode_host_name(A) ::= NK_ID(B). { A = B; } +dnode_host_name(A) ::= NK_IPTOKEN(B). { A = B; } + +/************************************************ create/drop/show/use database ***************************************/ +cmd ::= CREATE DATABASE not_exists_opt(A) db_name(B) db_options(C). { pCxt->pRootNode = createCreateDatabaseStmt(pCxt, A, &B, C);} +cmd ::= DROP DATABASE exists_opt(A) db_name(B). { pCxt->pRootNode = createDropDatabaseStmt(pCxt, A, &B); } +cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } +cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A);} + +%type not_exists_opt { bool } +%destructor not_exists_opt { } +not_exists_opt(A) ::= IF NOT EXISTS. { A = true; } +not_exists_opt(A) ::= . { A = false; } %type exists_opt { bool } %destructor exists_opt { } -exists_opt(A) ::= IF NOT EXISTS. { A = true; } +exists_opt(A) ::= IF EXISTS. { A = true; } exists_opt(A) ::= . { A = false; } %type db_options { SDatabaseOptions* } @@ -81,17 +103,15 @@ db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLESTABLE, &C); } db_options(A) ::= db_options(B) STREAM_MODE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STREAMMODE, &C); } -/************************************************ create database *****************************************************/ -cmd ::= USE db_name(A). { pCxt->pRootNode = createUseDatabaseStmt(pCxt, &A);} - -/************************************************ create table/stable *************************************************/ -cmd ::= CREATE TABLE exists_opt(A) full_table_name(B) - NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D, E);} - +/************************************************ create/drop/show table/stable ***************************************/ +cmd ::= CREATE TABLE not_exists_opt(A) full_table_name(B) + NK_LP column_def_list(C) NK_RP tags_def_opt(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E);} cmd ::= CREATE TABLE multi_create_clause(A). { pCxt->pRootNode = createCreateMultiTableStmt(pCxt, A);} - -cmd ::= CREATE STABLE exists_opt(A) full_table_name(B) - NK_LP column_def_list(C) NK_RP tags_def(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, &B, C, D, E);} +cmd ::= CREATE STABLE not_exists_opt(A) full_table_name(B) + NK_LP column_def_list(C) NK_RP tags_def(D) table_options(E). { pCxt->pRootNode = createCreateTableStmt(pCxt, A, B, C, D, E);} +cmd ::= DROP TABLE multi_drop_clause(A). { pCxt->pRootNode = createDropTableStmt(pCxt, A); } +cmd ::= SHOW TABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); } +cmd ::= SHOW STABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT); } %type multi_create_clause { SNodeList* } %destructor multi_create_clause { nodesDestroyList($$); } @@ -99,18 +119,23 @@ multi_create_clause(A) ::= create_subtable_clause(B). multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C). { A = addNodeToList(pCxt, B, C); } create_subtable_clause(A) ::= - exists_opt(B) full_table_name(C) USING full_table_name(D) - specific_tags_opt(E) TAGS NK_LP literal_list(F) NK_RP. { A = createCreateSubTableClause(pCxt, B, &C, &D, E, F); } + not_exists_opt(B) full_table_name(C) USING full_table_name(D) + specific_tags_opt(E) TAGS NK_LP literal_list(F) NK_RP. { A = createCreateSubTableClause(pCxt, B, C, D, E, F); } + +%type multi_drop_clause { SNodeList* } +%destructor multi_drop_clause { nodesDestroyList($$); } +multi_drop_clause(A) ::= drop_table_clause(B). { A = createNodeList(pCxt, B); } +multi_drop_clause(A) ::= multi_drop_clause(B) drop_table_clause(C). { A = addNodeToList(pCxt, B, C); } + +drop_table_clause(A) ::= exists_opt(B) full_table_name(C). { A = createDropTableClause(pCxt, B, C); } %type specific_tags_opt { SNodeList* } %destructor specific_tags_opt { nodesDestroyList($$); } specific_tags_opt(A) ::= . { A = NULL; } specific_tags_opt(A) ::= NK_LP col_name_list(B) NK_RP. { A = B; } -%type full_table_name { STokenPair } -%destructor full_table_name { } -full_table_name(A) ::= NK_ID(B). { STokenPair t = { .first = nil_token, .second = B }; A = t; } -full_table_name(A) ::= NK_ID(B) NK_DOT NK_ID(C). { STokenPair t = { .first = B, .second = C }; A = t; } +full_table_name(A) ::= table_name(B). { A = createRealTableNode(pCxt, NULL, &B, NULL); } +full_table_name(A) ::= db_name(B) NK_DOT table_name(C). { A = createRealTableNode(pCxt, &B, &C, NULL); } %type column_def_list { SNodeList* } %destructor column_def_list { nodesDestroyList($$); } @@ -171,8 +196,7 @@ col_name_list(A) ::= col_name_list(B) NK_COMMA col_name(C). col_name(A) ::= column_name(B). { A = createColumnNode(pCxt, NULL, &B); } /************************************************ show ***************************************************************/ -cmd ::= SHOW DATABASES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } -cmd ::= SHOW TABLES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); } +cmd ::= SHOW VGROUPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT); } /************************************************ select *************************************************************/ cmd ::= query_expression(A). { pCxt->pRootNode = A; } @@ -217,6 +241,10 @@ table_alias(A) ::= NK_ID(B). %destructor column_alias { } column_alias(A) ::= NK_ID(B). { A = B; } +%type user_name { SToken } +%destructor user_name { } +user_name(A) ::= NK_ID(B). { A = B; } + /************************************************ expression **********************************************************/ expression(A) ::= literal(B). { A = B; } //expression(A) ::= NK_QUESTION(B). { A = B; } diff --git a/source/libs/parser/inc/parserUtil.h b/source/libs/parser/inc/parserUtil.h index 4fbdbeba20cbadbd3f08aae47945e9fdedbbb2e4..50c99bb08bfa79631c30135fcb301e91450f552f 100644 --- a/source/libs/parser/inc/parserUtil.h +++ b/source/libs/parser/inc/parserUtil.h @@ -29,6 +29,7 @@ typedef struct SMsgBuf { char *buf; } SMsgBuf; +int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...); int32_t buildInvalidOperationMsg(SMsgBuf* pMsgBuf, const char* msg); int32_t buildSyntaxErrMsg(SMsgBuf* pBuf, const char* additionalInfo, const char* sourceStr); diff --git a/source/libs/parser/src/astCreateFuncs.c b/source/libs/parser/src/astCreateFuncs.c index 756ade34dae338e84b64c5106cdbaad0d47642c0..214960081ab04f030f0249641215cf90a82ff9ed 100644 --- a/source/libs/parser/src/astCreateFuncs.c +++ b/source/libs/parser/src/astCreateFuncs.c @@ -33,7 +33,7 @@ } \ } while (0) -SToken nil_token = { .type = TK_NIL, .n = 0, .z = NULL }; +SToken nil_token = { .type = TK_NK_NIL, .n = 0, .z = NULL }; typedef SDatabaseOptions* (*FSetDatabaseOption)(SAstCreateContext* pCxt, SDatabaseOptions* pOptions, const SToken* pVal); static FSetDatabaseOption setDbOptionFuncs[DB_OPTION_MAX]; @@ -309,6 +309,8 @@ static void initSetTableOptionFp() { void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) { pCxt->pQueryCxt = pParseCxt; + pCxt->msgBuf.buf = pParseCxt->pMsg; + pCxt->msgBuf.len = pParseCxt->msgLen; pCxt->notSupport = false; pCxt->valid = true; pCxt->pRootNode = NULL; @@ -316,6 +318,84 @@ void initAstCreateContext(SParseContext* pParseCxt, SAstCreateContext* pCxt) { initSetTableOptionFp(); } +static bool checkUserName(SAstCreateContext* pCxt, const SToken* pUserName) { + if (NULL == pUserName) { + return false; + } + if (pUserName->n >= TSDB_USER_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG); + pCxt->valid = false; + } + return pCxt->valid; +} + +static bool checkPassword(SAstCreateContext* pCxt, const SToken* pPasswordToken, char* pPassword) { + if (NULL == pPasswordToken) { + return false; + } + if (pPasswordToken->n >= (TSDB_USET_PASSWORD_LEN - 2)) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG); + pCxt->valid = false; + return false; + } + strncpy(pPassword, pPasswordToken->z, pPasswordToken->n); + strdequote(pPassword); + if (strtrim(pPassword) <= 0) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_PASSWD_EMPTY); + pCxt->valid = false; + } + return pCxt->valid; +} + +static bool checkAndSplitEndpoint(SAstCreateContext* pCxt, const SToken* pEp, char* pFqdn, int32_t* pPort) { + if (NULL == pEp) { + return false; + } + if (pEp->n >= TSDB_FQDN_LEN + 2 + 6) { // format 'fqdn:port' + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG); + pCxt->valid = false; + } + char ep[TSDB_FQDN_LEN + 2 + 6]; + strncpy(ep, pEp->z, pEp->n); + strdequote(ep); + strtrim(ep); + char* pColon = strchr(ep, ':'); + if (NULL == pColon) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ENDPOINT); + pCxt->valid = false; + } + strncpy(pFqdn, ep, pColon - ep); + *pPort = strtol(pColon + 1, NULL, 10); + if (*pPort >= UINT16_MAX || *pPort <= 0) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_PORT); + pCxt->valid = false; + } + return pCxt->valid; +} + +static bool checkFqdn(SAstCreateContext* pCxt, const SToken* pFqdn) { + if (NULL == pFqdn) { + return false; + } + if (pFqdn->n >= TSDB_FQDN_LEN) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG); + pCxt->valid = false; + } + return pCxt->valid; +} + +static bool checkPort(SAstCreateContext* pCxt, const SToken* pPortToken, int32_t* pPort) { + if (NULL == pPortToken) { + return false; + } + *pPort = strtol(pPortToken->z, NULL, 10); + if (*pPort >= UINT16_MAX || *pPort <= 0) { + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_PORT); + pCxt->valid = false; + } + return pCxt->valid; +} + static bool checkDbName(SAstCreateContext* pCxt, const SToken* pDbName) { if (NULL == pDbName) { return true; @@ -487,7 +567,7 @@ SNode* createRealTableNode(SAstCreateContext* pCxt, const SToken* pDbName, const } else { strcpy(realTable->table.dbName, pCxt->pQueryCxt->db); } - if (NULL != pTableAlias && TK_NIL != pTableAlias->type) { + if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) { strncpy(realTable->table.tableAlias, pTableAlias->z, pTableAlias->n); } else { strncpy(realTable->table.tableAlias, pTableName->z, pTableName->n); @@ -500,7 +580,7 @@ SNode* createTempTableNode(SAstCreateContext* pCxt, SNode* pSubquery, const STok STempTableNode* tempTable = (STempTableNode*)nodesMakeNode(QUERY_NODE_TEMP_TABLE); CHECK_OUT_OF_MEM(tempTable); tempTable->pSubquery = pSubquery; - if (NULL != pTableAlias && TK_NIL != pTableAlias->type) { + if (NULL != pTableAlias && TK_NK_NIL != pTableAlias->type) { strncpy(tempTable->table.tableAlias, pTableAlias->z, pTableAlias->n); } return (SNode*)tempTable; @@ -700,6 +780,17 @@ SNode* createCreateDatabaseStmt(SAstCreateContext* pCxt, bool ignoreExists, cons return (SNode*)pStmt; } +SNode* createDropDatabaseStmt(SAstCreateContext* pCxt, bool ignoreNotExists, const SToken* pDbName) { + if (!checkDbName(pCxt, pDbName)) { + return NULL; + } + SDropDatabaseStmt* pStmt = (SDropDatabaseStmt*)nodesMakeNode(QUERY_NODE_DROP_DATABASE_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->dbName, pDbName->z, pDbName->n); + pStmt->ignoreNotExists = ignoreNotExists; + return (SNode*)pStmt; +} + STableOptions* createDefaultTableOptions(SAstCreateContext* pCxt) { STableOptions* pOptions = calloc(1, sizeof(STableOptions)); CHECK_OUT_OF_MEM(pOptions); @@ -739,41 +830,32 @@ SDataType createVarLenDataType(uint8_t type, const SToken* pLen) { } SNode* createCreateTableStmt(SAstCreateContext* pCxt, - bool ignoreExists, const STokenPair* pFullTableName, SNodeList* pCols, SNodeList* pTags, STableOptions* pOptions) { + bool ignoreExists, SNode* pRealTable, SNodeList* pCols, SNodeList* pTags, STableOptions* pOptions) { SCreateTableStmt* pStmt = (SCreateTableStmt*)nodesMakeNode(QUERY_NODE_CREATE_TABLE_STMT); CHECK_OUT_OF_MEM(pStmt); - if (TK_NIL != pFullTableName->first.type) { - strncpy(pStmt->dbName, pFullTableName->first.z, pFullTableName->first.n); - } else { - strcpy(pStmt->dbName, pCxt->pQueryCxt->db); - } - strncpy(pStmt->tableName, pFullTableName->second.z, pFullTableName->second.n); + strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); pStmt->ignoreExists = ignoreExists; pStmt->pCols = pCols; pStmt->pTags = pTags; pStmt->options = *pOptions; + nodesDestroyNode(pRealTable); return (SNode*)pStmt; } -SNode* createCreateSubTableClause(SAstCreateContext* pCxt, bool ignoreExists, - const STokenPair* pFullTableName, const STokenPair* pUseFullTableName, SNodeList* pSpecificTags, SNodeList* pValsOfTags) { +SNode* createCreateSubTableClause(SAstCreateContext* pCxt, + bool ignoreExists, SNode* pRealTable, SNode* pUseRealTable, SNodeList* pSpecificTags, SNodeList* pValsOfTags) { SCreateSubTableClause* pStmt = nodesMakeNode(QUERY_NODE_CREATE_SUBTABLE_CLAUSE); CHECK_OUT_OF_MEM(pStmt); - if (TK_NIL != pFullTableName->first.type) { - strncpy(pStmt->dbName, pFullTableName->first.z, pFullTableName->first.n); - } else { - strcpy(pStmt->dbName, pCxt->pQueryCxt->db); - } - strncpy(pStmt->tableName, pFullTableName->second.z, pFullTableName->second.n); - if (TK_NIL != pUseFullTableName->first.type) { - strncpy(pStmt->useDbName, pUseFullTableName->first.z, pUseFullTableName->first.n); - } else { - strcpy(pStmt->useDbName, pCxt->pQueryCxt->db); - } - strncpy(pStmt->useTableName, pUseFullTableName->second.z, pUseFullTableName->second.n); + strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); + strcpy(pStmt->useDbName, ((SRealTableNode*)pUseRealTable)->table.dbName); + strcpy(pStmt->useTableName, ((SRealTableNode*)pUseRealTable)->table.tableName); pStmt->ignoreExists = ignoreExists; pStmt->pSpecificTags = pSpecificTags; pStmt->pValsOfTags = pValsOfTags; + nodesDestroyNode(pRealTable); + nodesDestroyNode(pUseRealTable); return (SNode*)pStmt; } @@ -784,6 +866,23 @@ SNode* createCreateMultiTableStmt(SAstCreateContext* pCxt, SNodeList* pSubTables return (SNode*)pStmt; } +SNode* createDropTableClause(SAstCreateContext* pCxt, bool ignoreNotExists, SNode* pRealTable) { + SDropTableClause* pStmt = nodesMakeNode(QUERY_NODE_DROP_TABLE_CLAUSE); + CHECK_OUT_OF_MEM(pStmt); + strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName); + strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName); + pStmt->ignoreNotExists = ignoreNotExists; + nodesDestroyNode(pRealTable); + return (SNode*)pStmt; +} + +SNode* createDropTableStmt(SAstCreateContext* pCxt, SNodeList* pTables) { + SDropTableStmt* pStmt = nodesMakeNode(QUERY_NODE_DROP_TABLE_STMT); + CHECK_OUT_OF_MEM(pStmt); + pStmt->pTables = pTables; + return (SNode*)pStmt; +} + SNode* createUseDatabaseStmt(SAstCreateContext* pCxt, const SToken* pDbName) { SUseDatabaseStmt* pStmt = (SUseDatabaseStmt*)nodesMakeNode(QUERY_NODE_USE_DATABASE_STMT); CHECK_OUT_OF_MEM(pStmt); @@ -796,3 +895,79 @@ SNode* createShowStmt(SAstCreateContext* pCxt, ENodeType type) { CHECK_OUT_OF_MEM(pStmt); return pStmt; } + +SNode* createCreateUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, const SToken* pPassword) { + char password[TSDB_USET_PASSWORD_LEN] = {0}; + if (!checkUserName(pCxt, pUserName) || !checkPassword(pCxt, pPassword, password)) { + return NULL; + } + SCreateUserStmt* pStmt = (SCreateUserStmt*)nodesMakeNode(QUERY_NODE_CREATE_USER_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->useName, pUserName->z, pUserName->n); + strcpy(pStmt->password, password); + return (SNode*)pStmt; +} + +SNode* createAlterUserStmt(SAstCreateContext* pCxt, const SToken* pUserName, int8_t alterType, const SToken* pVal) { + if (!checkUserName(pCxt, pUserName)) { + return NULL; + } + SAlterUserStmt* pStmt = (SAlterUserStmt*)nodesMakeNode(QUERY_NODE_ALTER_USER_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->useName, pUserName->z, pUserName->n); + if (TSDB_ALTER_USER_PASSWD == alterType) { + char password[TSDB_USET_PASSWORD_LEN] = {0}; + if (!checkPassword(pCxt, pVal, password)) { + nodesDestroyNode(pStmt); + return NULL; + } + strcpy(pStmt->password, password); + } + pStmt->alterType = alterType; + return (SNode*)pStmt; +} + +SNode* createDropUserStmt(SAstCreateContext* pCxt, const SToken* pUserName) { + if (!checkUserName(pCxt, pUserName)) { + return NULL; + } + SDropUserStmt* pStmt = (SDropUserStmt*)nodesMakeNode(QUERY_NODE_DROP_USER_STMT); + CHECK_OUT_OF_MEM(pStmt); + strncpy(pStmt->useName, pUserName->z, pUserName->n); + return (SNode*)pStmt; +} + +SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort) { + int32_t port = 0; + char fqdn[TSDB_FQDN_LEN] = {0}; + if (NULL == pPort) { + if (!checkAndSplitEndpoint(pCxt, pFqdn, fqdn, &port)) { + return NULL; + } + } else if (!checkFqdn(pCxt, pFqdn) || !checkPort(pCxt, pPort, &port)) { + return NULL; + } + SCreateDnodeStmt* pStmt = (SCreateDnodeStmt*)nodesMakeNode(QUERY_NODE_CREATE_DNODE_STMT); + CHECK_OUT_OF_MEM(pStmt); + if (NULL == pPort) { + strcpy(pStmt->fqdn, fqdn); + } else { + strncpy(pStmt->fqdn, pFqdn->z, pFqdn->n); + } + pStmt->port = port; + return (SNode*)pStmt; +} + +SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode) { + SDropDnodeStmt* pStmt = (SDropDnodeStmt*)nodesMakeNode(QUERY_NODE_DROP_DNODE_STMT); + CHECK_OUT_OF_MEM(pStmt); + if (TK_NK_INTEGER == pDnode->type) { + pStmt->dnodeId = strtol(pDnode->z, NULL, 10); + } else { + if (!checkAndSplitEndpoint(pCxt, pDnode, pStmt->fqdn, &pStmt->port)) { + nodesDestroyNode(pStmt); + return NULL; + } + } + return (SNode*)pStmt; +} diff --git a/source/libs/parser/src/astParse.c b/source/libs/parser/src/astParse.c index 71ac16ce6e5ea44eb14316886532f48fe9c562fd..8be03b54b392dc91ba8b0346180619c73c61368a 100644 --- a/source/libs/parser/src/astParse.c +++ b/source/libs/parser/src/astParse.c @@ -46,7 +46,7 @@ int32_t doParse(SParseContext* pParseCxt, SQuery** pQuery) { case TK_NK_COMMENT: { break; } - case TK_SEMI: { + case TK_NK_SEMI: { NewParse(pParser, 0, t0, &cxt); goto abort_parse; } diff --git a/source/libs/parser/src/astTranslate.c b/source/libs/parser/src/astTranslate.c index aba3ea4b9b471f1b377a8e647b2f69b539b34869..e2fb84c7ed12cb1b4fba70dbd2537d906122e16b 100644 --- a/source/libs/parser/src/astTranslate.c +++ b/source/libs/parser/src/astTranslate.c @@ -42,50 +42,13 @@ typedef struct STranslateContext { static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode); -static char* getSyntaxErrFormat(int32_t errCode) { - switch (errCode) { - case TSDB_CODE_PAR_INVALID_COLUMN: - return "Invalid column name : %s"; - case TSDB_CODE_PAR_TABLE_NOT_EXIST: - return "Table does not exist : %s"; - case TSDB_CODE_PAR_AMBIGUOUS_COLUMN: - return "Column ambiguously defined : %s"; - case TSDB_CODE_PAR_WRONG_VALUE_TYPE: - return "Invalid value type : %s"; - case TSDB_CODE_PAR_INVALID_FUNTION: - return "Invalid function name : %s"; - case TSDB_CODE_PAR_FUNTION_PARA_NUM: - return "Invalid number of arguments : %s"; - case TSDB_CODE_PAR_FUNTION_PARA_TYPE: - return "Inconsistent datatypes : %s"; - case TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION: - return "There mustn't be aggregation"; - case TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT: - return "ORDER BY item must be the number of a SELECT-list expression"; - case TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION: - return "Not a GROUP BY expression"; - case TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION: - return "Not SELECTed expression"; - case TSDB_CODE_PAR_NOT_SINGLE_GROUP: - return "Not a single-group group function"; - case TSDB_CODE_PAR_TAGS_NOT_MATCHED: - return "tags number not matched"; - case TSDB_CODE_PAR_INVALID_TAG_NAME: - return "invalid tag name : %s"; - case TSDB_CODE_OUT_OF_MEMORY: - return "Out of memory"; - default: - return "Unknown error"; - } -} - -static int32_t generateSyntaxErrMsg(STranslateContext* pCxt, int32_t errCode, ...) { +static EDealRes generateDealNodeErrMsg(STranslateContext* pCxt, int32_t errCode, ...) { va_list vArgList; va_start(vArgList, errCode); - vsnprintf(pCxt->msgBuf.buf, pCxt->msgBuf.len, getSyntaxErrFormat(errCode), vArgList); + generateSyntaxErrMsg(&pCxt->msgBuf, errCode, vArgList); va_end(vArgList); pCxt->errCode = errCode; - return errCode; + return DEAL_RES_ERROR; } static int32_t addNamespace(STranslateContext* pCxt, void* pTable) { @@ -166,7 +129,7 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode for (int32_t i = 0; i < nums; ++i) { SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, (i < pMeta->tableInfo.numOfTags), pCol); nodesListAppend(pList, (SNode*)pCol); @@ -177,7 +140,7 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode FOREACH(pNode, pProjectList) { SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } setColumnInfoByExpr(pTable, (SExprNode*)pNode, pCol); nodesListAppend(pList, (SNode*)pCol); @@ -224,13 +187,11 @@ static EDealRes translateColumnWithPrefix(STranslateContext* pCxt, SColumnNode* if (findAndSetColumn(pCol, pTable)) { break; } - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, pCol->colName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, pCol->colName); } } if (!foundTable) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pCol->tableAlias); } return DEAL_RES_CONTINUE; } @@ -243,15 +204,13 @@ static EDealRes translateColumnWithoutPrefix(STranslateContext* pCxt, SColumnNod STableNode* pTable = taosArrayGetP(pTables, i); if (findAndSetColumn(pCol, pTable)) { if (found) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_AMBIGUOUS_COLUMN, pCol->colName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_AMBIGUOUS_COLUMN, pCol->colName); } found = true; } } if (!found) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, pCol->colName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_COLUMN, pCol->colName); } return DEAL_RES_CONTINUE; } @@ -297,8 +256,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { if (pVal->isDuration) { char unit = 0; if (parseAbsoluteDuration(pVal->literal, strlen(pVal->literal), &pVal->datum.i, &unit, pVal->node.resType.precision) != TSDB_CODE_SUCCESS) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } } else { switch (pVal->node.resType.type) { @@ -336,8 +294,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { int32_t n = strlen(pVal->literal); pVal->datum.p = calloc(1, n + VARSTR_HEADER_SIZE); if (NULL == pVal->datum.p) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); } trimStringWithVarFormat(pVal->literal, n, true, pVal->datum.p); break; @@ -346,14 +303,12 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { int32_t n = strlen(pVal->literal); char* tmp = calloc(1, n); if (NULL == tmp) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); } int32_t len = trimStringWithVarFormat(pVal->literal, n, false, tmp); if (taosParseTime(tmp, &pVal->datum.i, len, pVal->node.resType.precision, tsDaylight) != TSDB_CODE_SUCCESS) { tfree(tmp); - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } tfree(tmp); break; @@ -376,16 +331,14 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { if (nodesIsArithmeticOp(pOp)) { if (TSDB_DATA_TYPE_JSON == ldt.type || TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type || TSDB_DATA_TYPE_BLOB == rdt.type) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); } pOp->node.resType.type = TSDB_DATA_TYPE_DOUBLE; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_DOUBLE].bytes; } else if (nodesIsComparisonOp(pOp)) { if (TSDB_DATA_TYPE_JSON == ldt.type || TSDB_DATA_TYPE_BLOB == ldt.type || TSDB_DATA_TYPE_JSON == rdt.type || TSDB_DATA_TYPE_BLOB == rdt.type) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, ((SExprNode*)(pOp->pRight))->aliasName); } pOp->node.resType.type = TSDB_DATA_TYPE_BOOL; pOp->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes; @@ -397,17 +350,14 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) { static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode* pFunc) { if (TSDB_CODE_SUCCESS != fmGetFuncInfo(pFunc->functionName, &pFunc->funcId, &pFunc->funcType)) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_INVALID_FUNTION, pFunc->functionName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_INVALID_FUNTION, pFunc->functionName); } int32_t code = fmGetFuncResultType(pFunc); if (TSDB_CODE_SUCCESS != code) { - generateSyntaxErrMsg(pCxt, code, pFunc->functionName); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, code, pFunc->functionName); } if (fmIsAggFunc(pFunc->funcId) && beforeHaving(pCxt->currClause)) { - generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION); } return DEAL_RES_CONTINUE; } @@ -498,8 +448,7 @@ static EDealRes doCheckExprForGroupBy(SNode* pNode, void* pContext) { } if (QUERY_NODE_COLUMN == nodeType(pNode) || (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsAggFunc(((SFunctionNode*)pNode)->funcId) && isDistinctOrderBy(pCxt))) { - generateSyntaxErrMsg(pCxt, getGroupByErrorCode(pCxt)); - return DEAL_RES_ERROR; + return generateDealNodeErrMsg(pCxt, getGroupByErrorCode(pCxt)); } return DEAL_RES_CONTINUE; } @@ -545,7 +494,7 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) nodesWalkList(pSelect->pOrderByList, doCheckAggColCoexist, &cxt); } if (cxt.existAggFunc && cxt.existCol) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_NOT_SINGLE_GROUP); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SINGLE_GROUP); } return TSDB_CODE_SUCCESS; } @@ -582,7 +531,7 @@ static int32_t translateTable(STranslateContext* pCxt, SNode* pTable) { code = catalogGetTableMeta(pCxt->pParseCxt->pCatalog, pCxt->pParseCxt->pTransporter, &(pCxt->pParseCxt->mgmtEpSet), toName(pCxt->pParseCxt->acctId, pRealTable, &name), &(pRealTable->pMeta)); if (TSDB_CODE_SUCCESS != code) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TABLE_NOT_EXIST, pRealTable->table.tableName); } code = setTableVgroupList(pCxt, &name, &(pRealTable->pVgroupList)); if (TSDB_CODE_SUCCESS != code) { @@ -622,7 +571,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect, bool size_t nums = taosArrayGetSize(pTables); pSelect->pProjectionList = nodesMakeList(); if (NULL == pSelect->pProjectionList) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } for (size_t i = 0; i < nums; ++i) { STableNode* pTable = taosArrayGetP(pTables, i); @@ -684,11 +633,11 @@ static int32_t translateOrderByPosition(STranslateContext* pCxt, SNodeList* pPro ERASE_NODE(pOrderByList); continue; } else if (0 == pos || pos > LIST_LENGTH(pProjectionList)) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT); } else { SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); if (NULL == pCol) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } setColumnInfoByExpr(NULL, (SExprNode*)nodesListGetNode(pProjectionList, pos - 1), pCol); ((SOrderByExprNode*)pNode)->pExpr = (SNode*)pCol; @@ -733,7 +682,7 @@ static int32_t translateSelectList(STranslateContext* pCxt, SSelectStmt* pSelect static int32_t translateHaving(STranslateContext* pCxt, SSelectStmt* pSelect) { if (NULL == pSelect->pGroupByList && NULL != pSelect->pHaving) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION); } pCxt->currClause = SQL_CLAUSE_HAVING; int32_t code = translateExpr(pCxt, pSelect->pHaving); @@ -845,6 +794,29 @@ static int32_t translateCreateDatabase(STranslateContext* pCxt, SCreateDatabaseS return TSDB_CODE_SUCCESS; } +static int32_t translateDropDatabase(STranslateContext* pCxt, SDropDatabaseStmt* pStmt) { + SDropDbReq dropReq = {0}; + SName name = {0}; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName)); + tNameGetFullDbName(&name, dropReq.db); + dropReq.ignoreNotExists = pStmt->ignoreNotExists; + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_DROP_DB; + pCxt->pCmdMsg->msgLen = tSerializeSDropDbReq(NULL, 0, &dropReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSDropDbReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq); + + return TSDB_CODE_SUCCESS; +} + static int32_t columnNodeToField(SNodeList* pList, SArray** pArray) { *pArray = taosArrayInit(LIST_LENGTH(pList), sizeof(SField)); SNode* pNode; @@ -911,8 +883,142 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p return TSDB_CODE_SUCCESS; } -static int32_t translateShowDatabases(STranslateContext* pCxt) { - SShowReq showReq = { .type = TSDB_MGMT_TABLE_DB }; +static int32_t translateCreateUser(STranslateContext* pCxt, SCreateUserStmt* pStmt) { + SCreateUserReq createReq = {0}; + strcpy(createReq.user, pStmt->useName); + createReq.createType = 0; + createReq.superUser = 0; + strcpy(createReq.pass, pStmt->password); + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_USER; + pCxt->pCmdMsg->msgLen = tSerializeSCreateUserReq(NULL, 0, &createReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSCreateUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq); + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateAlterUser(STranslateContext* pCxt, SAlterUserStmt* pStmt) { + SAlterUserReq alterReq = {0}; + strcpy(alterReq.user, pStmt->useName); + alterReq.alterType = pStmt->alterType; + alterReq.superUser = 0; + strcpy(alterReq.pass, pStmt->password); + if (NULL != pCxt->pParseCxt->db) { + strcpy(alterReq.dbname, pCxt->pParseCxt->db); + } + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_ALTER_USER; + pCxt->pCmdMsg->msgLen = tSerializeSAlterUserReq(NULL, 0, &alterReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSAlterUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &alterReq); + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateDropUser(STranslateContext* pCxt, SDropUserStmt* pStmt) { + SDropUserReq dropReq = {0}; + strcpy(dropReq.user, pStmt->useName); + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_DROP_USER; + pCxt->pCmdMsg->msgLen = tSerializeSDropUserReq(NULL, 0, &dropReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSDropUserReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq); + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* pStmt) { + SCreateDnodeReq createReq = {0}; + strcpy(createReq.fqdn, pStmt->fqdn); + createReq.port = pStmt->port; + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_CREATE_DNODE; + pCxt->pCmdMsg->msgLen = tSerializeSCreateDnodeReq(NULL, 0, &createReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSCreateDnodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &createReq); + + return TSDB_CODE_SUCCESS; +} + +static int32_t translateDropDnode(STranslateContext* pCxt, SDropDnodeStmt* pStmt) { + SDropDnodeReq dropReq = {0}; + dropReq.dnodeId = pStmt->dnodeId; + strcpy(dropReq.fqdn, pStmt->fqdn); + dropReq.port = pStmt->port; + + pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); + if (NULL== pCxt->pCmdMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + pCxt->pCmdMsg->epSet = pCxt->pParseCxt->mgmtEpSet; + pCxt->pCmdMsg->msgType = TDMT_MND_DROP_DNODE; + pCxt->pCmdMsg->msgLen = tSerializeSDropDnodeReq(NULL, 0, &dropReq); + pCxt->pCmdMsg->pMsg = malloc(pCxt->pCmdMsg->msgLen); + if (NULL== pCxt->pCmdMsg->pMsg) { + return TSDB_CODE_OUT_OF_MEMORY; + } + tSerializeSDropDnodeReq(pCxt->pCmdMsg->pMsg, pCxt->pCmdMsg->msgLen, &dropReq); + + return TSDB_CODE_SUCCESS; +} + +static int32_t nodeTypeToShowType(ENodeType nt) { + switch (nt) { + case QUERY_NODE_SHOW_DATABASES_STMT: + return TSDB_MGMT_TABLE_DB; + case QUERY_NODE_SHOW_STABLES_STMT: + return TSDB_MGMT_TABLE_STB; + case QUERY_NODE_SHOW_USERS_STMT: + return TSDB_MGMT_TABLE_USER; + case QUERY_NODE_SHOW_DNODES_STMT: + return TSDB_MGMT_TABLE_DNODE; + default: + break; + } + return 0; +} + +static int32_t translateShow(STranslateContext* pCxt, ENodeType type) { + SShowReq showReq = { .type = nodeTypeToShowType(type) }; + if (NULL != pCxt->pParseCxt->db) { + SName name = {0}; + tNameSetDbName(&name, pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, strlen(pCxt->pParseCxt->db)); + char dbFname[TSDB_DB_FNAME_LEN] = {0}; + tNameGetFullDbName(&name, showReq.db); + } pCxt->pCmdMsg = malloc(sizeof(SCmdMsgInfo)); if (NULL== pCxt->pCmdMsg) { @@ -967,14 +1073,35 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) { case QUERY_NODE_CREATE_DATABASE_STMT: code = translateCreateDatabase(pCxt, (SCreateDatabaseStmt*)pNode); break; + case QUERY_NODE_DROP_DATABASE_STMT: + code = translateDropDatabase(pCxt, (SDropDatabaseStmt*)pNode); + break; case QUERY_NODE_CREATE_TABLE_STMT: code = translateCreateSuperTable(pCxt, (SCreateTableStmt*)pNode); break; + case QUERY_NODE_CREATE_USER_STMT: + code = translateCreateUser(pCxt, (SCreateUserStmt*)pNode); + break; + case QUERY_NODE_ALTER_USER_STMT: + code = translateAlterUser(pCxt, (SAlterUserStmt*)pNode); + break; + case QUERY_NODE_DROP_USER_STMT: + code = translateDropUser(pCxt, (SDropUserStmt*)pNode); + break; case QUERY_NODE_USE_DATABASE_STMT: code = translateUseDatabase(pCxt, (SUseDatabaseStmt*)pNode); break; + case QUERY_NODE_CREATE_DNODE_STMT: + code = translateCreateDnode(pCxt, (SCreateDnodeStmt*)pNode); + break; + case QUERY_NODE_DROP_DNODE_STMT: + code = translateDropDnode(pCxt, (SDropDnodeStmt*)pNode); + break; case QUERY_NODE_SHOW_DATABASES_STMT: - code = translateShowDatabases(pCxt); + case QUERY_NODE_SHOW_STABLES_STMT: + case QUERY_NODE_SHOW_USERS_STMT: + case QUERY_NODE_SHOW_DNODES_STMT: + code = translateShow(pCxt, nodeType(pNode)); break; case QUERY_NODE_SHOW_TABLES_STMT: code = translateShowTables(pCxt); @@ -1002,7 +1129,7 @@ static int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) { pQuery->numOfResCols = LIST_LENGTH(pSelect->pProjectionList); pQuery->pResSchema = calloc(pQuery->numOfResCols, sizeof(SSchema)); if (NULL == pQuery->pResSchema) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_OUT_OF_MEMORY); } SNode* pNode; int32_t index = 0; @@ -1236,7 +1363,7 @@ static int32_t addValToKVRow(STranslateContext* pCxt, SValueNode* pVal, const SS static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, SKVRowBuilder* pBuilder) { int32_t numOfTags = getNumOfTags(pSuperTableMeta); if (LIST_LENGTH(pStmt->pValsOfTags) != LIST_LENGTH(pStmt->pSpecificTags) || numOfTags < LIST_LENGTH(pStmt->pValsOfTags)) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_TAGS_NOT_MATCHED); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TAGS_NOT_MATCHED); } SSchema* pTagSchema = getTableTagSchema(pSuperTableMeta); @@ -1251,7 +1378,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla } } if (NULL == pSchema) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_INVALID_TAG_NAME, pCol->colName); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TAG_NAME, pCol->colName); } int32_t code = addValToKVRow(pCxt, (SValueNode*)pVal, pSchema, pBuilder); if (TSDB_CODE_SUCCESS != code) { @@ -1264,7 +1391,7 @@ static int32_t buildKVRowForBindTags(STranslateContext* pCxt, SCreateSubTableCla static int32_t buildKVRowForAllTags(STranslateContext* pCxt, SCreateSubTableClause* pStmt, STableMeta* pSuperTableMeta, SKVRowBuilder* pBuilder) { if (getNumOfTags(pSuperTableMeta) != LIST_LENGTH(pStmt->pValsOfTags)) { - return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_TAGS_NOT_MATCHED); + return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_TAGS_NOT_MATCHED); } SSchema* pTagSchema = getTableTagSchema(pSuperTableMeta); diff --git a/source/libs/parser/src/new_sql.c b/source/libs/parser/src/new_sql.c index 6b694cd0b834a9d72dbc0402220517cb142a2a2b..86392b64c14ddf40bed900218892d1fdebbea53a 100644 --- a/source/libs/parser/src/new_sql.c +++ b/source/libs/parser/src/new_sql.c @@ -99,25 +99,24 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char -#define YYNOCODE 191 +#define YYNOCODE 208 #define YYACTIONTYPE unsigned short int #define NewParseTOKENTYPE SToken typedef union { int yyinit; NewParseTOKENTYPE yy0; - EJoinType yy28; - EOrder yy29; - SDataType yy42; - EFillMode yy102; - EOperatorType yy140; - SToken yy175; - SNodeList* yy182; - bool yy187; - SNode* yy210; - SDatabaseOptions* yy211; - STableOptions* yy286; - ENullOrder yy307; - STokenPair yy341; + ENullOrder yy9; + SDatabaseOptions* yy103; + SToken yy161; + EOrder yy162; + EFillMode yy166; + SNodeList* yy184; + EOperatorType yy220; + SDataType yy240; + EJoinType yy308; + STableOptions* yy334; + bool yy377; + SNode* yy392; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -132,17 +131,17 @@ typedef union { #define NewParseCTX_PARAM #define NewParseCTX_FETCH #define NewParseCTX_STORE -#define YYNSTATE 239 -#define YYNRULE 211 -#define YYNTOKEN 123 -#define YY_MAX_SHIFT 238 -#define YY_MIN_SHIFTREDUCE 390 -#define YY_MAX_SHIFTREDUCE 600 -#define YY_ERROR_ACTION 601 -#define YY_ACCEPT_ACTION 602 -#define YY_NO_ACTION 603 -#define YY_MIN_REDUCE 604 -#define YY_MAX_REDUCE 814 +#define YYNSTATE 272 +#define YYNRULE 234 +#define YYNTOKEN 134 +#define YY_MAX_SHIFT 271 +#define YY_MIN_SHIFTREDUCE 432 +#define YY_MAX_SHIFTREDUCE 665 +#define YY_ERROR_ACTION 666 +#define YY_ACCEPT_ACTION 667 +#define YY_NO_ACTION 668 +#define YY_MIN_REDUCE 669 +#define YY_MAX_REDUCE 902 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -209,259 +208,283 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (824) +#define YY_ACTTAB_COUNT (892) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 122, 214, 135, 23, 84, 793, 746, 684, 682, 684, - /* 10 */ 682, 707, 30, 28, 26, 25, 24, 180, 673, 792, - /* 20 */ 672, 116, 151, 791, 743, 30, 28, 26, 25, 24, - /* 30 */ 604, 221, 133, 707, 116, 685, 682, 692, 682, 180, - /* 40 */ 181, 636, 57, 48, 693, 483, 696, 732, 689, 9, - /* 50 */ 8, 731, 728, 238, 687, 237, 236, 235, 234, 233, - /* 60 */ 232, 231, 230, 229, 156, 228, 227, 226, 225, 224, - /* 70 */ 223, 222, 30, 28, 26, 25, 24, 100, 22, 126, - /* 80 */ 664, 501, 502, 503, 504, 505, 506, 507, 509, 510, - /* 90 */ 511, 22, 126, 519, 501, 502, 503, 504, 505, 506, - /* 100 */ 507, 509, 510, 511, 157, 152, 150, 426, 212, 211, - /* 110 */ 210, 430, 209, 432, 433, 208, 435, 205, 93, 441, - /* 120 */ 202, 443, 444, 199, 196, 707, 474, 630, 170, 692, - /* 130 */ 682, 180, 181, 96, 476, 46, 693, 168, 696, 732, - /* 140 */ 53, 20, 629, 115, 728, 30, 28, 26, 25, 24, - /* 150 */ 508, 137, 707, 512, 627, 793, 692, 682, 166, 181, - /* 160 */ 636, 57, 47, 693, 121, 696, 732, 477, 98, 66, - /* 170 */ 124, 728, 61, 791, 221, 746, 707, 82, 596, 597, - /* 180 */ 692, 682, 180, 181, 83, 746, 58, 693, 89, 696, - /* 190 */ 141, 759, 45, 742, 707, 92, 498, 10, 692, 682, - /* 200 */ 166, 181, 165, 741, 47, 693, 10, 696, 732, 707, - /* 210 */ 68, 165, 124, 728, 61, 180, 44, 707, 132, 95, - /* 220 */ 155, 692, 682, 180, 181, 171, 806, 47, 693, 215, - /* 230 */ 696, 732, 85, 760, 707, 124, 728, 805, 692, 682, - /* 240 */ 180, 181, 67, 173, 47, 693, 766, 696, 732, 67, - /* 250 */ 139, 707, 124, 728, 805, 692, 682, 180, 181, 636, - /* 260 */ 57, 47, 693, 789, 696, 732, 29, 27, 148, 124, - /* 270 */ 728, 805, 134, 67, 673, 11, 671, 751, 463, 538, - /* 280 */ 750, 564, 29, 27, 543, 542, 463, 49, 465, 628, - /* 290 */ 550, 11, 637, 57, 463, 707, 465, 177, 1, 692, - /* 300 */ 682, 180, 181, 131, 465, 111, 693, 130, 696, 30, - /* 310 */ 28, 26, 25, 24, 1, 174, 190, 74, 138, 131, - /* 320 */ 673, 218, 671, 71, 190, 474, 217, 9, 8, 464, - /* 330 */ 466, 469, 190, 26, 25, 24, 77, 464, 466, 469, - /* 340 */ 762, 219, 483, 6, 538, 464, 466, 469, 162, 163, - /* 350 */ 67, 707, 708, 172, 170, 692, 682, 180, 181, 513, - /* 360 */ 216, 105, 693, 178, 696, 31, 2, 52, 29, 27, - /* 370 */ 480, 29, 27, 87, 50, 763, 31, 11, 541, 175, - /* 380 */ 463, 793, 477, 463, 63, 739, 740, 149, 744, 773, - /* 390 */ 465, 184, 183, 465, 146, 66, 599, 600, 69, 791, - /* 400 */ 1, 469, 144, 7, 145, 131, 707, 73, 131, 90, - /* 410 */ 692, 682, 180, 181, 772, 54, 48, 693, 190, 696, - /* 420 */ 732, 190, 419, 417, 167, 728, 123, 19, 55, 49, - /* 430 */ 162, 464, 466, 469, 464, 466, 469, 30, 28, 26, - /* 440 */ 25, 24, 447, 5, 753, 159, 170, 707, 194, 52, - /* 450 */ 567, 692, 682, 180, 181, 67, 50, 111, 693, 142, - /* 460 */ 696, 76, 29, 27, 169, 143, 80, 739, 161, 451, - /* 470 */ 160, 162, 60, 793, 463, 54, 147, 565, 566, 568, - /* 480 */ 569, 29, 27, 456, 465, 4, 56, 66, 78, 55, - /* 490 */ 52, 791, 54, 463, 7, 538, 473, 50, 51, 131, - /* 500 */ 476, 747, 79, 465, 32, 16, 164, 62, 739, 740, - /* 510 */ 707, 744, 190, 1, 692, 682, 180, 181, 131, 127, - /* 520 */ 48, 693, 714, 696, 732, 464, 466, 469, 21, 729, - /* 530 */ 808, 190, 179, 790, 176, 86, 29, 27, 30, 28, - /* 540 */ 26, 25, 24, 472, 464, 466, 469, 185, 463, 707, - /* 550 */ 99, 602, 189, 692, 682, 180, 181, 186, 465, 107, - /* 560 */ 693, 91, 696, 187, 41, 192, 94, 140, 7, 182, - /* 570 */ 707, 101, 97, 131, 692, 682, 180, 181, 102, 113, - /* 580 */ 111, 693, 125, 696, 114, 3, 190, 31, 70, 14, - /* 590 */ 561, 72, 158, 35, 153, 563, 793, 59, 707, 464, - /* 600 */ 466, 469, 692, 682, 180, 181, 626, 75, 58, 693, - /* 610 */ 66, 696, 707, 557, 791, 37, 692, 682, 180, 181, - /* 620 */ 154, 556, 106, 693, 687, 696, 707, 38, 18, 15, - /* 630 */ 692, 682, 180, 181, 535, 534, 108, 693, 218, 696, - /* 640 */ 8, 81, 686, 217, 33, 34, 65, 499, 807, 707, - /* 650 */ 481, 17, 590, 692, 682, 180, 181, 12, 219, 103, - /* 660 */ 693, 585, 696, 707, 39, 584, 128, 692, 682, 180, - /* 670 */ 181, 589, 588, 109, 693, 707, 696, 216, 129, 692, - /* 680 */ 682, 180, 181, 88, 13, 104, 693, 707, 696, 676, - /* 690 */ 675, 692, 682, 180, 181, 674, 625, 110, 693, 707, - /* 700 */ 696, 421, 40, 692, 682, 180, 181, 467, 448, 704, - /* 710 */ 693, 95, 696, 707, 36, 188, 191, 692, 682, 180, - /* 720 */ 181, 193, 136, 703, 693, 707, 696, 195, 197, 692, - /* 730 */ 682, 180, 181, 445, 200, 702, 693, 707, 696, 442, - /* 740 */ 203, 692, 682, 180, 181, 198, 201, 119, 693, 204, - /* 750 */ 696, 707, 436, 434, 206, 692, 682, 180, 181, 207, - /* 760 */ 425, 118, 693, 440, 696, 707, 213, 439, 42, 692, - /* 770 */ 682, 180, 181, 438, 455, 120, 693, 437, 696, 43, - /* 780 */ 454, 453, 162, 391, 220, 403, 410, 707, 409, 408, - /* 790 */ 407, 692, 682, 180, 181, 406, 405, 117, 693, 707, - /* 800 */ 696, 52, 404, 692, 682, 180, 181, 402, 50, 112, - /* 810 */ 693, 401, 696, 400, 399, 398, 397, 396, 64, 739, - /* 820 */ 740, 395, 744, 394, + /* 0 */ 135, 147, 23, 93, 761, 711, 759, 240, 148, 771, + /* 10 */ 769, 146, 30, 28, 26, 25, 24, 771, 769, 192, + /* 20 */ 175, 795, 94, 724, 65, 30, 28, 26, 25, 24, + /* 30 */ 682, 164, 192, 215, 795, 59, 719, 130, 780, 769, + /* 40 */ 193, 202, 215, 53, 781, 212, 784, 820, 722, 57, + /* 50 */ 130, 137, 816, 893, 19, 772, 769, 722, 548, 71, + /* 60 */ 827, 828, 854, 832, 30, 28, 26, 25, 24, 264, + /* 70 */ 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, + /* 80 */ 253, 252, 251, 250, 249, 248, 26, 25, 24, 22, + /* 90 */ 139, 202, 566, 567, 568, 569, 570, 571, 572, 574, + /* 100 */ 575, 576, 22, 139, 150, 566, 567, 568, 569, 570, + /* 110 */ 571, 572, 574, 575, 576, 169, 724, 65, 491, 238, + /* 120 */ 237, 236, 495, 235, 497, 498, 234, 500, 231, 529, + /* 130 */ 506, 228, 508, 509, 225, 222, 192, 527, 795, 881, + /* 140 */ 75, 182, 780, 769, 193, 214, 214, 52, 781, 247, + /* 150 */ 784, 820, 192, 880, 795, 129, 816, 879, 780, 769, + /* 160 */ 193, 709, 40, 66, 781, 152, 784, 881, 178, 60, + /* 170 */ 795, 10, 10, 717, 780, 769, 193, 724, 65, 53, + /* 180 */ 781, 74, 784, 820, 216, 879, 540, 137, 816, 69, + /* 190 */ 170, 165, 163, 214, 528, 530, 533, 247, 192, 538, + /* 200 */ 795, 92, 183, 894, 780, 769, 193, 154, 847, 123, + /* 210 */ 781, 143, 784, 178, 192, 795, 795, 268, 267, 780, + /* 220 */ 769, 193, 75, 629, 53, 781, 168, 784, 820, 192, + /* 230 */ 55, 795, 137, 816, 69, 780, 769, 193, 29, 27, + /* 240 */ 53, 781, 111, 784, 820, 752, 834, 529, 137, 816, + /* 250 */ 893, 725, 65, 848, 192, 527, 795, 144, 91, 877, + /* 260 */ 780, 769, 193, 11, 831, 53, 781, 834, 784, 820, + /* 270 */ 29, 27, 608, 137, 816, 893, 761, 151, 760, 529, + /* 280 */ 761, 834, 759, 1, 838, 830, 192, 527, 795, 144, + /* 290 */ 40, 182, 780, 769, 193, 11, 607, 116, 781, 829, + /* 300 */ 784, 718, 216, 215, 6, 603, 213, 29, 27, 44, + /* 310 */ 29, 27, 528, 530, 533, 1, 529, 881, 722, 529, + /* 320 */ 715, 839, 101, 603, 527, 541, 144, 527, 241, 144, + /* 330 */ 76, 74, 11, 75, 216, 879, 100, 30, 28, 26, + /* 340 */ 25, 24, 9, 8, 528, 530, 533, 30, 28, 26, + /* 350 */ 25, 24, 1, 161, 185, 7, 192, 86, 795, 41, + /* 360 */ 9, 8, 780, 769, 193, 21, 83, 123, 781, 155, + /* 370 */ 784, 216, 186, 80, 216, 30, 28, 26, 25, 24, + /* 380 */ 850, 528, 530, 533, 528, 530, 533, 192, 215, 795, + /* 390 */ 176, 106, 180, 780, 769, 193, 175, 77, 54, 781, + /* 400 */ 606, 784, 820, 722, 615, 75, 819, 816, 192, 175, + /* 410 */ 795, 59, 664, 665, 780, 769, 193, 584, 442, 54, + /* 420 */ 781, 538, 784, 820, 59, 57, 205, 179, 816, 182, + /* 430 */ 442, 189, 796, 187, 177, 70, 827, 828, 57, 832, + /* 440 */ 443, 444, 29, 27, 181, 96, 563, 578, 89, 827, + /* 450 */ 174, 529, 173, 215, 31, 881, 153, 29, 27, 527, + /* 460 */ 545, 144, 29, 27, 661, 662, 529, 31, 722, 74, + /* 470 */ 2, 529, 204, 879, 527, 184, 144, 50, 541, 527, + /* 480 */ 851, 144, 776, 667, 192, 61, 795, 7, 714, 774, + /* 490 */ 780, 769, 193, 201, 190, 54, 781, 200, 784, 820, + /* 500 */ 210, 199, 1, 208, 817, 127, 216, 7, 194, 211, + /* 510 */ 49, 128, 117, 861, 162, 46, 528, 530, 533, 159, + /* 520 */ 196, 216, 98, 103, 78, 533, 216, 198, 197, 157, + /* 530 */ 62, 528, 530, 533, 881, 484, 528, 530, 533, 192, + /* 540 */ 158, 795, 63, 860, 136, 780, 769, 193, 74, 82, + /* 550 */ 119, 781, 879, 784, 192, 5, 795, 479, 172, 841, + /* 560 */ 780, 769, 193, 85, 55, 123, 781, 138, 784, 156, + /* 570 */ 192, 68, 795, 4, 87, 603, 780, 769, 193, 512, + /* 580 */ 20, 66, 781, 171, 784, 537, 220, 58, 540, 573, + /* 590 */ 835, 516, 577, 192, 75, 795, 521, 32, 62, 780, + /* 600 */ 769, 193, 88, 63, 118, 781, 192, 784, 795, 64, + /* 610 */ 16, 191, 780, 769, 193, 802, 62, 120, 781, 140, + /* 620 */ 784, 895, 896, 878, 192, 710, 795, 188, 536, 95, + /* 630 */ 780, 769, 193, 195, 99, 114, 781, 203, 784, 192, + /* 640 */ 542, 795, 206, 145, 110, 780, 769, 193, 43, 45, + /* 650 */ 121, 781, 112, 784, 192, 708, 795, 723, 107, 218, + /* 660 */ 780, 769, 193, 271, 125, 115, 781, 126, 784, 113, + /* 670 */ 3, 192, 244, 795, 14, 31, 243, 780, 769, 193, + /* 680 */ 35, 79, 122, 781, 626, 784, 192, 81, 795, 628, + /* 690 */ 67, 245, 780, 769, 193, 84, 37, 792, 781, 622, + /* 700 */ 784, 192, 244, 795, 621, 166, 243, 780, 769, 193, + /* 710 */ 242, 774, 791, 781, 167, 784, 192, 38, 795, 18, + /* 720 */ 600, 245, 780, 769, 193, 15, 599, 790, 781, 90, + /* 730 */ 784, 192, 33, 795, 34, 73, 8, 780, 769, 193, + /* 740 */ 242, 564, 133, 781, 546, 784, 655, 17, 192, 39, + /* 750 */ 795, 12, 650, 649, 780, 769, 193, 141, 654, 132, + /* 760 */ 781, 192, 784, 795, 653, 142, 97, 780, 769, 193, + /* 770 */ 13, 175, 134, 781, 763, 784, 192, 685, 795, 762, + /* 780 */ 713, 712, 780, 769, 193, 684, 59, 131, 781, 632, + /* 790 */ 784, 192, 678, 795, 673, 451, 683, 780, 769, 193, + /* 800 */ 57, 102, 124, 781, 677, 784, 676, 672, 671, 207, + /* 810 */ 72, 827, 828, 670, 832, 160, 630, 631, 633, 634, + /* 820 */ 109, 209, 42, 30, 28, 26, 25, 24, 56, 46, + /* 830 */ 773, 531, 105, 36, 108, 217, 513, 505, 219, 504, + /* 840 */ 221, 149, 510, 223, 224, 226, 229, 507, 227, 232, + /* 850 */ 490, 501, 230, 503, 520, 499, 233, 51, 518, 519, + /* 860 */ 104, 449, 47, 246, 502, 470, 675, 469, 239, 548, + /* 870 */ 468, 467, 48, 466, 465, 464, 463, 462, 461, 460, + /* 880 */ 459, 458, 457, 456, 674, 455, 454, 265, 266, 669, + /* 890 */ 269, 270, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 135, 139, 135, 153, 154, 168, 146, 142, 143, 142, - /* 10 */ 143, 138, 12, 13, 14, 15, 16, 144, 138, 182, - /* 20 */ 140, 21, 149, 186, 164, 12, 13, 14, 15, 16, - /* 30 */ 0, 20, 128, 138, 21, 142, 143, 142, 143, 144, - /* 40 */ 145, 137, 138, 148, 149, 45, 151, 152, 44, 1, - /* 50 */ 2, 156, 157, 23, 50, 25, 26, 27, 28, 29, - /* 60 */ 30, 31, 32, 33, 49, 35, 36, 37, 38, 39, - /* 70 */ 40, 41, 12, 13, 14, 15, 16, 129, 78, 79, - /* 80 */ 132, 81, 82, 83, 84, 85, 86, 87, 88, 89, - /* 90 */ 90, 78, 79, 45, 81, 82, 83, 84, 85, 86, - /* 100 */ 87, 88, 89, 90, 101, 102, 103, 53, 54, 55, - /* 110 */ 56, 57, 58, 59, 60, 61, 62, 63, 124, 65, - /* 120 */ 66, 67, 68, 69, 70, 138, 49, 133, 141, 142, - /* 130 */ 143, 144, 145, 124, 49, 148, 149, 21, 151, 152, - /* 140 */ 131, 78, 133, 156, 157, 12, 13, 14, 15, 16, - /* 150 */ 87, 128, 138, 90, 0, 168, 142, 143, 144, 145, - /* 160 */ 137, 138, 148, 149, 18, 151, 152, 49, 19, 182, - /* 170 */ 156, 157, 158, 186, 20, 146, 138, 92, 118, 119, - /* 180 */ 142, 143, 144, 145, 170, 146, 148, 149, 42, 151, - /* 190 */ 176, 177, 43, 164, 138, 46, 80, 44, 142, 143, - /* 200 */ 144, 145, 49, 164, 148, 149, 44, 151, 152, 138, - /* 210 */ 92, 49, 156, 157, 158, 144, 44, 138, 72, 47, - /* 220 */ 149, 142, 143, 144, 145, 187, 188, 148, 149, 48, - /* 230 */ 151, 152, 189, 177, 138, 156, 157, 158, 142, 143, - /* 240 */ 144, 145, 96, 3, 148, 149, 167, 151, 152, 96, - /* 250 */ 128, 138, 156, 157, 158, 142, 143, 144, 145, 137, - /* 260 */ 138, 148, 149, 167, 151, 152, 12, 13, 180, 156, - /* 270 */ 157, 158, 136, 96, 138, 21, 140, 93, 24, 95, - /* 280 */ 167, 45, 12, 13, 14, 4, 24, 51, 34, 0, - /* 290 */ 14, 21, 137, 138, 24, 138, 34, 51, 44, 142, - /* 300 */ 143, 144, 145, 49, 34, 148, 149, 150, 151, 12, - /* 310 */ 13, 14, 15, 16, 44, 51, 62, 45, 136, 49, - /* 320 */ 138, 32, 140, 51, 62, 49, 37, 1, 2, 75, - /* 330 */ 76, 77, 62, 14, 15, 16, 173, 75, 76, 77, - /* 340 */ 147, 52, 45, 94, 95, 75, 76, 77, 125, 166, - /* 350 */ 96, 138, 138, 113, 141, 142, 143, 144, 145, 45, - /* 360 */ 71, 148, 149, 117, 151, 51, 169, 144, 12, 13, - /* 370 */ 45, 12, 13, 183, 151, 147, 51, 21, 97, 115, - /* 380 */ 24, 168, 49, 24, 161, 162, 163, 105, 165, 179, - /* 390 */ 34, 73, 74, 34, 104, 182, 121, 122, 178, 186, - /* 400 */ 44, 77, 143, 44, 143, 49, 138, 178, 49, 45, - /* 410 */ 142, 143, 144, 145, 179, 51, 148, 149, 62, 151, - /* 420 */ 152, 62, 45, 45, 156, 157, 143, 2, 51, 51, - /* 430 */ 125, 75, 76, 77, 75, 76, 77, 12, 13, 14, - /* 440 */ 15, 16, 45, 112, 175, 111, 141, 138, 51, 144, - /* 450 */ 80, 142, 143, 144, 145, 96, 151, 148, 149, 150, - /* 460 */ 151, 174, 12, 13, 14, 99, 161, 162, 163, 45, - /* 470 */ 165, 125, 172, 168, 24, 51, 106, 107, 108, 109, - /* 480 */ 110, 12, 13, 45, 34, 98, 45, 182, 171, 51, - /* 490 */ 144, 186, 51, 24, 44, 95, 49, 151, 144, 49, - /* 500 */ 49, 146, 159, 34, 91, 44, 160, 161, 162, 163, - /* 510 */ 138, 165, 62, 44, 142, 143, 144, 145, 49, 120, - /* 520 */ 148, 149, 155, 151, 152, 75, 76, 77, 2, 157, - /* 530 */ 190, 62, 116, 185, 114, 184, 12, 13, 12, 13, - /* 540 */ 14, 15, 16, 49, 75, 76, 77, 125, 24, 138, - /* 550 */ 132, 123, 49, 142, 143, 144, 145, 127, 34, 148, - /* 560 */ 149, 124, 151, 127, 44, 134, 127, 127, 44, 141, - /* 570 */ 138, 125, 124, 49, 142, 143, 144, 145, 126, 130, - /* 580 */ 148, 149, 150, 151, 130, 51, 62, 51, 45, 100, - /* 590 */ 45, 44, 181, 51, 24, 45, 168, 44, 138, 75, - /* 600 */ 76, 77, 142, 143, 144, 145, 0, 44, 148, 149, - /* 610 */ 182, 151, 138, 45, 186, 44, 142, 143, 144, 145, - /* 620 */ 51, 45, 148, 149, 50, 151, 138, 44, 51, 100, - /* 630 */ 142, 143, 144, 145, 45, 45, 148, 149, 32, 151, - /* 640 */ 2, 50, 50, 37, 93, 51, 50, 80, 188, 138, - /* 650 */ 45, 51, 45, 142, 143, 144, 145, 100, 52, 148, - /* 660 */ 149, 24, 151, 138, 4, 24, 24, 142, 143, 144, - /* 670 */ 145, 24, 24, 148, 149, 138, 151, 71, 24, 142, - /* 680 */ 143, 144, 145, 50, 44, 148, 149, 138, 151, 0, - /* 690 */ 0, 142, 143, 144, 145, 0, 0, 148, 149, 138, - /* 700 */ 151, 49, 44, 142, 143, 144, 145, 34, 45, 148, - /* 710 */ 149, 47, 151, 138, 44, 50, 48, 142, 143, 144, - /* 720 */ 145, 24, 24, 148, 149, 138, 151, 44, 24, 142, - /* 730 */ 143, 144, 145, 45, 24, 148, 149, 138, 151, 45, - /* 740 */ 24, 142, 143, 144, 145, 44, 44, 148, 149, 44, - /* 750 */ 151, 138, 45, 45, 24, 142, 143, 144, 145, 44, - /* 760 */ 34, 148, 149, 64, 151, 138, 52, 64, 44, 142, - /* 770 */ 143, 144, 145, 64, 24, 148, 149, 64, 151, 44, - /* 780 */ 24, 34, 125, 22, 21, 34, 24, 138, 24, 24, - /* 790 */ 24, 142, 143, 144, 145, 24, 24, 148, 149, 138, - /* 800 */ 151, 144, 24, 142, 143, 144, 145, 24, 151, 148, - /* 810 */ 149, 24, 151, 24, 24, 24, 24, 24, 161, 162, - /* 820 */ 163, 24, 165, 24, 191, 191, 191, 191, 191, 191, - /* 830 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 840 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 850 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 860 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 870 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 880 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 890 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 900 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 910 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 920 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 930 */ 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, - /* 940 */ 191, 191, 191, 191, 191, 191, 191, + /* 0 */ 151, 153, 170, 171, 156, 0, 158, 157, 151, 160, + /* 10 */ 161, 143, 12, 13, 14, 15, 16, 160, 161, 154, + /* 20 */ 139, 156, 206, 155, 156, 12, 13, 14, 15, 16, + /* 30 */ 0, 166, 154, 139, 156, 154, 142, 37, 160, 161, + /* 40 */ 162, 36, 139, 165, 166, 142, 168, 169, 154, 168, + /* 50 */ 37, 173, 174, 175, 2, 160, 161, 154, 58, 178, + /* 60 */ 179, 180, 184, 182, 12, 13, 14, 15, 16, 39, + /* 70 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + /* 80 */ 50, 51, 52, 53, 54, 55, 14, 15, 16, 89, + /* 90 */ 90, 36, 92, 93, 94, 95, 96, 97, 98, 99, + /* 100 */ 100, 101, 89, 90, 143, 92, 93, 94, 95, 96, + /* 110 */ 97, 98, 99, 100, 101, 31, 155, 156, 67, 68, + /* 120 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 21, + /* 130 */ 79, 80, 81, 82, 83, 84, 154, 29, 156, 185, + /* 140 */ 107, 159, 160, 161, 162, 31, 31, 165, 166, 36, + /* 150 */ 168, 169, 154, 199, 156, 173, 174, 203, 160, 161, + /* 160 */ 162, 0, 141, 165, 166, 143, 168, 185, 154, 148, + /* 170 */ 156, 57, 57, 152, 160, 161, 162, 155, 156, 165, + /* 180 */ 166, 199, 168, 169, 76, 203, 31, 173, 174, 175, + /* 190 */ 112, 113, 114, 31, 86, 87, 88, 36, 154, 31, + /* 200 */ 156, 187, 204, 205, 160, 161, 162, 193, 194, 165, + /* 210 */ 166, 167, 168, 154, 154, 156, 156, 136, 137, 160, + /* 220 */ 161, 162, 107, 58, 165, 166, 166, 168, 169, 154, + /* 230 */ 65, 156, 173, 174, 175, 160, 161, 162, 12, 13, + /* 240 */ 165, 166, 144, 168, 169, 147, 163, 21, 173, 174, + /* 250 */ 175, 155, 156, 194, 154, 29, 156, 31, 103, 184, + /* 260 */ 160, 161, 162, 37, 181, 165, 166, 163, 168, 169, + /* 270 */ 12, 13, 14, 173, 174, 175, 156, 153, 158, 21, + /* 280 */ 156, 163, 158, 57, 184, 181, 154, 29, 156, 31, + /* 290 */ 141, 159, 160, 161, 162, 37, 4, 165, 166, 181, + /* 300 */ 168, 152, 76, 139, 105, 106, 142, 12, 13, 138, + /* 310 */ 12, 13, 86, 87, 88, 57, 21, 185, 154, 21, + /* 320 */ 149, 104, 19, 106, 29, 31, 31, 29, 63, 31, + /* 330 */ 27, 199, 37, 107, 76, 203, 33, 12, 13, 14, + /* 340 */ 15, 16, 1, 2, 86, 87, 88, 12, 13, 14, + /* 350 */ 15, 16, 57, 197, 3, 57, 154, 190, 156, 56, + /* 360 */ 1, 2, 160, 161, 162, 2, 58, 165, 166, 167, + /* 370 */ 168, 76, 65, 65, 76, 12, 13, 14, 15, 16, + /* 380 */ 164, 86, 87, 88, 86, 87, 88, 154, 139, 156, + /* 390 */ 183, 142, 37, 160, 161, 162, 139, 103, 165, 166, + /* 400 */ 108, 168, 169, 154, 14, 107, 173, 174, 154, 139, + /* 410 */ 156, 154, 132, 133, 160, 161, 162, 58, 21, 165, + /* 420 */ 166, 31, 168, 169, 154, 168, 29, 173, 174, 159, + /* 430 */ 21, 65, 156, 126, 177, 178, 179, 180, 168, 182, + /* 440 */ 31, 32, 12, 13, 14, 200, 91, 58, 178, 179, + /* 450 */ 180, 21, 182, 139, 65, 185, 142, 12, 13, 29, + /* 460 */ 58, 31, 12, 13, 129, 130, 21, 65, 154, 199, + /* 470 */ 186, 21, 136, 203, 29, 124, 31, 138, 31, 29, + /* 480 */ 164, 31, 57, 134, 154, 146, 156, 57, 149, 64, + /* 490 */ 160, 161, 162, 26, 128, 165, 166, 30, 168, 169, + /* 500 */ 20, 34, 57, 23, 174, 18, 76, 57, 159, 22, + /* 510 */ 57, 24, 25, 196, 116, 62, 86, 87, 88, 115, + /* 520 */ 53, 76, 35, 58, 195, 88, 76, 60, 61, 161, + /* 530 */ 65, 86, 87, 88, 185, 58, 86, 87, 88, 154, + /* 540 */ 161, 156, 65, 196, 161, 160, 161, 162, 199, 195, + /* 550 */ 165, 166, 203, 168, 154, 123, 156, 58, 122, 192, + /* 560 */ 160, 161, 162, 191, 65, 165, 166, 167, 168, 110, + /* 570 */ 154, 189, 156, 109, 188, 106, 160, 161, 162, 58, + /* 580 */ 89, 165, 166, 198, 168, 31, 65, 154, 31, 98, + /* 590 */ 163, 58, 101, 154, 107, 156, 58, 102, 65, 160, + /* 600 */ 161, 162, 176, 65, 165, 166, 154, 168, 156, 58, + /* 610 */ 57, 127, 160, 161, 162, 172, 65, 165, 166, 131, + /* 620 */ 168, 205, 207, 202, 154, 0, 156, 125, 31, 201, + /* 630 */ 160, 161, 162, 139, 141, 165, 166, 139, 168, 154, + /* 640 */ 31, 156, 135, 135, 147, 160, 161, 162, 138, 57, + /* 650 */ 165, 166, 139, 168, 154, 0, 156, 154, 138, 150, + /* 660 */ 160, 161, 162, 135, 145, 165, 166, 145, 168, 140, + /* 670 */ 65, 154, 47, 156, 111, 65, 51, 160, 161, 162, + /* 680 */ 65, 58, 165, 166, 58, 168, 154, 57, 156, 58, + /* 690 */ 57, 66, 160, 161, 162, 57, 57, 165, 166, 58, + /* 700 */ 168, 154, 47, 156, 58, 29, 51, 160, 161, 162, + /* 710 */ 85, 64, 165, 166, 65, 168, 154, 57, 156, 65, + /* 720 */ 58, 66, 160, 161, 162, 111, 58, 165, 166, 64, + /* 730 */ 168, 154, 104, 156, 65, 64, 2, 160, 161, 162, + /* 740 */ 85, 91, 165, 166, 58, 168, 58, 65, 154, 4, + /* 750 */ 156, 111, 29, 29, 160, 161, 162, 29, 29, 165, + /* 760 */ 166, 154, 168, 156, 29, 29, 64, 160, 161, 162, + /* 770 */ 57, 139, 165, 166, 0, 168, 154, 0, 156, 0, + /* 780 */ 0, 0, 160, 161, 162, 0, 154, 165, 166, 91, + /* 790 */ 168, 154, 0, 156, 0, 38, 0, 160, 161, 162, + /* 800 */ 168, 19, 165, 166, 0, 168, 0, 0, 0, 21, + /* 810 */ 178, 179, 180, 0, 182, 117, 118, 119, 120, 121, + /* 820 */ 19, 21, 57, 12, 13, 14, 15, 16, 27, 62, + /* 830 */ 64, 21, 64, 57, 33, 63, 58, 78, 29, 78, + /* 840 */ 57, 29, 58, 29, 57, 29, 29, 58, 57, 29, + /* 850 */ 21, 58, 57, 78, 29, 58, 57, 56, 21, 29, + /* 860 */ 59, 38, 57, 37, 78, 29, 0, 29, 66, 58, + /* 870 */ 29, 29, 57, 29, 29, 29, 21, 29, 29, 29, + /* 880 */ 29, 29, 29, 29, 0, 29, 29, 29, 28, 0, + /* 890 */ 21, 20, 208, 208, 208, 208, 208, 208, 208, 208, + /* 900 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 910 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 920 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 930 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 940 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 950 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 960 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 970 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 980 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 990 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 1000 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 1010 */ 208, 208, 208, 208, 208, 208, 208, 208, 208, 208, + /* 1020 */ 208, 208, 208, 208, 208, 208, }; -#define YY_SHIFT_COUNT (238) +#define YY_SHIFT_COUNT (271) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (799) +#define YY_SHIFT_MAX (889) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 146, 254, 270, 356, 356, 356, 356, 359, 356, 356, - /* 10 */ 153, 469, 524, 450, 524, 524, 524, 524, 524, 524, - /* 20 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, - /* 30 */ 524, 524, 162, 162, 162, 262, 262, 15, 15, 177, - /* 40 */ 77, 77, 77, 77, 77, 11, 0, 13, 13, 262, - /* 50 */ 85, 85, 85, 154, 77, 77, 181, 54, 60, 370, - /* 60 */ 3, 118, 184, 249, 184, 276, 240, 281, 333, 282, - /* 70 */ 290, 324, 324, 282, 290, 324, 331, 334, 366, 387, - /* 80 */ 400, 447, 451, 413, 461, 399, 416, 420, 77, 494, - /* 90 */ 181, 503, 11, 503, 520, 503, 503, 494, 11, 824, - /* 100 */ 824, 824, 30, 425, 526, 297, 133, 133, 133, 133, - /* 110 */ 133, 133, 133, 289, 606, 48, 63, 319, 319, 319, - /* 120 */ 319, 149, 236, 272, 326, 314, 116, 275, 264, 246, - /* 130 */ 325, 4, 318, 364, 377, 378, 397, 424, 438, 441, - /* 140 */ 172, 534, 536, 489, 543, 545, 547, 542, 550, 553, - /* 150 */ 563, 568, 571, 576, 570, 569, 574, 583, 577, 529, - /* 160 */ 589, 590, 591, 551, 594, 592, 596, 638, 567, 605, - /* 170 */ 607, 600, 557, 660, 637, 641, 642, 647, 648, 654, - /* 180 */ 633, 640, 689, 690, 695, 696, 658, 664, 652, 665, - /* 190 */ 673, 670, 668, 663, 697, 698, 683, 688, 704, 701, - /* 200 */ 694, 710, 702, 707, 716, 705, 708, 730, 715, 699, - /* 210 */ 703, 709, 713, 726, 714, 724, 735, 750, 756, 747, - /* 220 */ 761, 763, 762, 764, 765, 766, 771, 772, 778, 751, - /* 230 */ 783, 787, 789, 790, 791, 792, 793, 797, 799, + /* 0 */ 487, 226, 258, 295, 295, 295, 295, 298, 295, 295, + /* 10 */ 115, 445, 450, 430, 450, 450, 450, 450, 450, 450, + /* 20 */ 450, 450, 450, 450, 450, 450, 450, 450, 450, 450, + /* 30 */ 450, 450, 114, 114, 114, 108, 108, 84, 84, 33, + /* 40 */ 162, 55, 168, 162, 162, 168, 162, 168, 168, 168, + /* 50 */ 162, 113, 0, 13, 13, 108, 409, 155, 155, 155, + /* 60 */ 5, 161, 168, 168, 265, 51, 335, 698, 78, 294, + /* 70 */ 217, 199, 217, 390, 351, 292, 397, 447, 398, 404, + /* 80 */ 437, 437, 398, 404, 437, 432, 436, 459, 464, 469, + /* 90 */ 554, 557, 495, 553, 488, 484, 502, 168, 597, 597, + /* 100 */ 55, 609, 609, 265, 113, 554, 592, 597, 113, 609, + /* 110 */ 892, 892, 892, 30, 52, 363, 811, 467, 325, 325, + /* 120 */ 325, 325, 325, 325, 325, 625, 655, 801, 303, 359, + /* 130 */ 491, 72, 72, 72, 72, 165, 308, 341, 389, 355, + /* 140 */ 280, 307, 366, 402, 425, 480, 465, 477, 499, 521, + /* 150 */ 533, 538, 551, 453, 605, 610, 563, 623, 626, 630, + /* 160 */ 615, 631, 633, 638, 641, 639, 646, 676, 649, 647, + /* 170 */ 660, 654, 614, 662, 668, 665, 628, 669, 671, 734, + /* 180 */ 650, 686, 688, 682, 640, 745, 723, 724, 728, 729, + /* 190 */ 735, 736, 702, 713, 774, 777, 779, 780, 781, 785, + /* 200 */ 792, 794, 757, 796, 804, 806, 807, 808, 788, 813, + /* 210 */ 800, 782, 765, 767, 766, 768, 810, 776, 772, 778, + /* 220 */ 809, 812, 783, 784, 814, 787, 789, 816, 791, 793, + /* 230 */ 817, 795, 797, 820, 799, 759, 761, 775, 786, 829, + /* 240 */ 802, 805, 815, 825, 830, 837, 823, 826, 836, 838, + /* 250 */ 841, 842, 844, 845, 846, 855, 848, 849, 850, 851, + /* 260 */ 852, 853, 854, 856, 857, 866, 858, 860, 884, 889, + /* 270 */ 869, 871, }; -#define YY_REDUCE_COUNT (101) -#define YY_REDUCE_MIN (-163) -#define YY_REDUCE_MAX (661) +#define YY_REDUCE_COUNT (112) +#define YY_REDUCE_MIN (-184) +#define YY_REDUCE_MAX (637) static const short yy_reduce_ofst[] = { - /* 0 */ 428, -13, 14, 56, 79, 96, 113, 213, -105, 268, - /* 10 */ 305, 372, 38, 157, 309, 411, 432, 460, 474, 488, - /* 20 */ 511, 525, 537, 549, 561, 575, 587, 599, 613, 627, - /* 30 */ 649, 661, 346, 223, 657, -135, -133, -127, 71, -163, - /* 40 */ -96, 136, 23, 182, 122, 9, -150, -150, -150, -107, - /* 50 */ -140, 29, 39, -6, 155, -120, -52, -138, 43, 88, - /* 60 */ 163, 193, 183, 183, 183, 214, 190, 197, 228, 210, - /* 70 */ 220, 259, 261, 235, 229, 283, 269, 287, 300, 317, - /* 80 */ 183, 354, 355, 343, 367, 340, 348, 351, 214, 422, - /* 90 */ 418, 430, 437, 436, 431, 439, 440, 446, 448, 449, - /* 100 */ 454, 452, + /* 0 */ 349, -18, 14, 59, -122, 75, 100, 132, 233, 254, + /* 10 */ 270, 330, -2, 44, 202, 385, 400, 416, 439, 452, + /* 20 */ 470, 485, 500, 517, 532, 547, 562, 577, 594, 607, + /* 30 */ 622, 637, 257, -119, 632, -151, -143, -135, 60, -46, + /* 40 */ -106, 21, -132, -97, 164, -152, 249, -39, 124, 22, + /* 50 */ 314, 339, -168, -168, -168, -105, 81, 83, 104, 118, + /* 60 */ 149, 171, 96, 120, 98, -150, -184, 156, 167, 216, + /* 70 */ 207, 207, 207, 276, 245, 284, 336, 316, 317, 329, + /* 80 */ 368, 379, 347, 354, 383, 367, 372, 382, 386, 207, + /* 90 */ 433, 427, 426, 443, 415, 421, 428, 276, 494, 498, + /* 100 */ 493, 507, 508, 497, 510, 503, 509, 513, 520, 528, + /* 110 */ 519, 522, 529, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - /* 10 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - /* 20 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - /* 30 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - /* 40 */ 601, 601, 601, 601, 601, 606, 601, 734, 601, 601, - /* 50 */ 745, 745, 745, 606, 601, 601, 663, 601, 809, 601, - /* 60 */ 769, 761, 737, 751, 738, 601, 794, 754, 601, 776, - /* 70 */ 774, 601, 601, 776, 774, 601, 788, 784, 767, 765, - /* 80 */ 751, 601, 601, 601, 601, 812, 800, 796, 601, 601, - /* 90 */ 601, 601, 606, 601, 632, 601, 601, 601, 606, 666, - /* 100 */ 666, 607, 601, 601, 601, 601, 787, 786, 711, 710, - /* 110 */ 709, 705, 706, 601, 601, 601, 601, 700, 701, 699, - /* 120 */ 698, 601, 601, 601, 735, 601, 601, 601, 797, 801, - /* 130 */ 601, 688, 601, 601, 601, 601, 601, 601, 601, 601, - /* 140 */ 601, 758, 768, 601, 601, 601, 601, 601, 601, 601, - /* 150 */ 601, 601, 601, 601, 601, 601, 688, 601, 785, 601, - /* 160 */ 744, 740, 601, 601, 736, 687, 601, 730, 601, 601, - /* 170 */ 601, 795, 601, 601, 601, 601, 601, 601, 601, 601, - /* 180 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 634, - /* 190 */ 601, 601, 601, 601, 601, 601, 660, 601, 601, 601, - /* 200 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 645, - /* 210 */ 643, 642, 641, 601, 638, 601, 601, 601, 601, 601, - /* 220 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - /* 230 */ 601, 601, 601, 601, 601, 601, 601, 601, 601, + /* 0 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 10 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 20 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 30 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 40 */ 666, 689, 666, 666, 666, 666, 666, 666, 666, 666, + /* 50 */ 666, 687, 666, 822, 666, 666, 666, 833, 833, 833, + /* 60 */ 689, 687, 666, 666, 751, 666, 897, 666, 857, 849, + /* 70 */ 825, 839, 826, 666, 882, 842, 666, 666, 864, 862, + /* 80 */ 666, 666, 864, 862, 666, 876, 872, 855, 853, 839, + /* 90 */ 666, 666, 666, 666, 900, 888, 884, 666, 666, 666, + /* 100 */ 689, 666, 666, 666, 687, 666, 720, 666, 687, 666, + /* 110 */ 754, 754, 690, 666, 666, 666, 666, 666, 875, 874, + /* 120 */ 799, 798, 797, 793, 794, 666, 666, 666, 666, 666, + /* 130 */ 666, 788, 789, 787, 786, 666, 666, 823, 666, 666, + /* 140 */ 666, 885, 889, 666, 775, 666, 666, 666, 666, 666, + /* 150 */ 666, 666, 666, 666, 846, 856, 666, 666, 666, 666, + /* 160 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 775, + /* 170 */ 666, 873, 666, 832, 828, 666, 666, 824, 666, 818, + /* 180 */ 666, 666, 666, 883, 666, 666, 666, 666, 666, 666, + /* 190 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 200 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 210 */ 666, 666, 666, 666, 774, 666, 666, 666, 666, 666, + /* 220 */ 666, 666, 748, 666, 666, 666, 666, 666, 666, 666, + /* 230 */ 666, 666, 666, 666, 666, 733, 731, 730, 729, 666, + /* 240 */ 726, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 250 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 260 */ 666, 666, 666, 666, 666, 666, 666, 666, 666, 666, + /* 270 */ 666, 666, }; /********** End of lemon-generated parsing tables *****************************/ @@ -587,178 +610,195 @@ static const char *const yyTokenName[] = { /* 16 */ "NK_REM", /* 17 */ "NK_CONCAT", /* 18 */ "CREATE", - /* 19 */ "DATABASE", - /* 20 */ "IF", - /* 21 */ "NOT", - /* 22 */ "EXISTS", - /* 23 */ "BLOCKS", - /* 24 */ "NK_INTEGER", - /* 25 */ "CACHE", - /* 26 */ "CACHELAST", - /* 27 */ "COMP", - /* 28 */ "DAYS", - /* 29 */ "FSYNC", - /* 30 */ "MAXROWS", - /* 31 */ "MINROWS", - /* 32 */ "KEEP", - /* 33 */ "PRECISION", - /* 34 */ "NK_STRING", - /* 35 */ "QUORUM", - /* 36 */ "REPLICA", - /* 37 */ "TTL", - /* 38 */ "WAL", - /* 39 */ "VGROUPS", - /* 40 */ "SINGLE_STABLE", - /* 41 */ "STREAM_MODE", - /* 42 */ "USE", - /* 43 */ "TABLE", - /* 44 */ "NK_LP", - /* 45 */ "NK_RP", - /* 46 */ "STABLE", - /* 47 */ "USING", - /* 48 */ "TAGS", - /* 49 */ "NK_ID", - /* 50 */ "NK_DOT", - /* 51 */ "NK_COMMA", - /* 52 */ "COMMENT", - /* 53 */ "BOOL", - /* 54 */ "TINYINT", - /* 55 */ "SMALLINT", - /* 56 */ "INT", - /* 57 */ "INTEGER", - /* 58 */ "BIGINT", - /* 59 */ "FLOAT", - /* 60 */ "DOUBLE", - /* 61 */ "BINARY", - /* 62 */ "TIMESTAMP", - /* 63 */ "NCHAR", - /* 64 */ "UNSIGNED", - /* 65 */ "JSON", - /* 66 */ "VARCHAR", - /* 67 */ "MEDIUMBLOB", - /* 68 */ "BLOB", - /* 69 */ "VARBINARY", - /* 70 */ "DECIMAL", - /* 71 */ "SMA", - /* 72 */ "SHOW", - /* 73 */ "DATABASES", - /* 74 */ "TABLES", - /* 75 */ "NK_FLOAT", - /* 76 */ "NK_BOOL", - /* 77 */ "NK_VARIABLE", - /* 78 */ "BETWEEN", - /* 79 */ "IS", - /* 80 */ "NULL", - /* 81 */ "NK_LT", - /* 82 */ "NK_GT", - /* 83 */ "NK_LE", - /* 84 */ "NK_GE", - /* 85 */ "NK_NE", - /* 86 */ "NK_EQ", - /* 87 */ "LIKE", - /* 88 */ "MATCH", - /* 89 */ "NMATCH", - /* 90 */ "IN", - /* 91 */ "FROM", - /* 92 */ "AS", - /* 93 */ "JOIN", - /* 94 */ "ON", - /* 95 */ "INNER", - /* 96 */ "SELECT", - /* 97 */ "DISTINCT", - /* 98 */ "WHERE", - /* 99 */ "PARTITION", - /* 100 */ "BY", - /* 101 */ "SESSION", - /* 102 */ "STATE_WINDOW", - /* 103 */ "INTERVAL", - /* 104 */ "SLIDING", - /* 105 */ "FILL", - /* 106 */ "VALUE", - /* 107 */ "NONE", - /* 108 */ "PREV", - /* 109 */ "LINEAR", - /* 110 */ "NEXT", - /* 111 */ "GROUP", - /* 112 */ "HAVING", - /* 113 */ "ORDER", - /* 114 */ "SLIMIT", - /* 115 */ "SOFFSET", - /* 116 */ "LIMIT", - /* 117 */ "OFFSET", - /* 118 */ "ASC", - /* 119 */ "DESC", - /* 120 */ "NULLS", - /* 121 */ "FIRST", - /* 122 */ "LAST", - /* 123 */ "cmd", - /* 124 */ "exists_opt", - /* 125 */ "db_name", - /* 126 */ "db_options", - /* 127 */ "full_table_name", - /* 128 */ "column_def_list", - /* 129 */ "tags_def_opt", - /* 130 */ "table_options", - /* 131 */ "multi_create_clause", - /* 132 */ "tags_def", - /* 133 */ "create_subtable_clause", - /* 134 */ "specific_tags_opt", - /* 135 */ "literal_list", - /* 136 */ "col_name_list", - /* 137 */ "column_def", - /* 138 */ "column_name", - /* 139 */ "type_name", - /* 140 */ "col_name", - /* 141 */ "query_expression", - /* 142 */ "literal", - /* 143 */ "duration_literal", - /* 144 */ "table_name", - /* 145 */ "function_name", - /* 146 */ "table_alias", - /* 147 */ "column_alias", - /* 148 */ "expression", - /* 149 */ "column_reference", - /* 150 */ "expression_list", - /* 151 */ "subquery", - /* 152 */ "predicate", - /* 153 */ "compare_op", - /* 154 */ "in_op", - /* 155 */ "in_predicate_value", - /* 156 */ "boolean_value_expression", - /* 157 */ "boolean_primary", - /* 158 */ "common_expression", - /* 159 */ "from_clause", - /* 160 */ "table_reference_list", - /* 161 */ "table_reference", - /* 162 */ "table_primary", - /* 163 */ "joined_table", - /* 164 */ "alias_opt", - /* 165 */ "parenthesized_joined_table", - /* 166 */ "join_type", - /* 167 */ "search_condition", - /* 168 */ "query_specification", - /* 169 */ "set_quantifier_opt", - /* 170 */ "select_list", - /* 171 */ "where_clause_opt", - /* 172 */ "partition_by_clause_opt", - /* 173 */ "twindow_clause_opt", - /* 174 */ "group_by_clause_opt", - /* 175 */ "having_clause_opt", - /* 176 */ "select_sublist", - /* 177 */ "select_item", - /* 178 */ "sliding_opt", - /* 179 */ "fill_opt", - /* 180 */ "fill_mode", - /* 181 */ "group_by_list", - /* 182 */ "query_expression_body", - /* 183 */ "order_by_clause_opt", - /* 184 */ "slimit_clause_opt", - /* 185 */ "limit_clause_opt", - /* 186 */ "query_primary", - /* 187 */ "sort_specification_list", - /* 188 */ "sort_specification", - /* 189 */ "ordering_specification_opt", - /* 190 */ "null_ordering_opt", + /* 19 */ "USER", + /* 20 */ "PASS", + /* 21 */ "NK_STRING", + /* 22 */ "ALTER", + /* 23 */ "PRIVILEGE", + /* 24 */ "DROP", + /* 25 */ "SHOW", + /* 26 */ "USERS", + /* 27 */ "DNODE", + /* 28 */ "PORT", + /* 29 */ "NK_INTEGER", + /* 30 */ "DNODES", + /* 31 */ "NK_ID", + /* 32 */ "NK_IPTOKEN", + /* 33 */ "DATABASE", + /* 34 */ "DATABASES", + /* 35 */ "USE", + /* 36 */ "IF", + /* 37 */ "NOT", + /* 38 */ "EXISTS", + /* 39 */ "BLOCKS", + /* 40 */ "CACHE", + /* 41 */ "CACHELAST", + /* 42 */ "COMP", + /* 43 */ "DAYS", + /* 44 */ "FSYNC", + /* 45 */ "MAXROWS", + /* 46 */ "MINROWS", + /* 47 */ "KEEP", + /* 48 */ "PRECISION", + /* 49 */ "QUORUM", + /* 50 */ "REPLICA", + /* 51 */ "TTL", + /* 52 */ "WAL", + /* 53 */ "VGROUPS", + /* 54 */ "SINGLE_STABLE", + /* 55 */ "STREAM_MODE", + /* 56 */ "TABLE", + /* 57 */ "NK_LP", + /* 58 */ "NK_RP", + /* 59 */ "STABLE", + /* 60 */ "TABLES", + /* 61 */ "STABLES", + /* 62 */ "USING", + /* 63 */ "TAGS", + /* 64 */ "NK_DOT", + /* 65 */ "NK_COMMA", + /* 66 */ "COMMENT", + /* 67 */ "BOOL", + /* 68 */ "TINYINT", + /* 69 */ "SMALLINT", + /* 70 */ "INT", + /* 71 */ "INTEGER", + /* 72 */ "BIGINT", + /* 73 */ "FLOAT", + /* 74 */ "DOUBLE", + /* 75 */ "BINARY", + /* 76 */ "TIMESTAMP", + /* 77 */ "NCHAR", + /* 78 */ "UNSIGNED", + /* 79 */ "JSON", + /* 80 */ "VARCHAR", + /* 81 */ "MEDIUMBLOB", + /* 82 */ "BLOB", + /* 83 */ "VARBINARY", + /* 84 */ "DECIMAL", + /* 85 */ "SMA", + /* 86 */ "NK_FLOAT", + /* 87 */ "NK_BOOL", + /* 88 */ "NK_VARIABLE", + /* 89 */ "BETWEEN", + /* 90 */ "IS", + /* 91 */ "NULL", + /* 92 */ "NK_LT", + /* 93 */ "NK_GT", + /* 94 */ "NK_LE", + /* 95 */ "NK_GE", + /* 96 */ "NK_NE", + /* 97 */ "NK_EQ", + /* 98 */ "LIKE", + /* 99 */ "MATCH", + /* 100 */ "NMATCH", + /* 101 */ "IN", + /* 102 */ "FROM", + /* 103 */ "AS", + /* 104 */ "JOIN", + /* 105 */ "ON", + /* 106 */ "INNER", + /* 107 */ "SELECT", + /* 108 */ "DISTINCT", + /* 109 */ "WHERE", + /* 110 */ "PARTITION", + /* 111 */ "BY", + /* 112 */ "SESSION", + /* 113 */ "STATE_WINDOW", + /* 114 */ "INTERVAL", + /* 115 */ "SLIDING", + /* 116 */ "FILL", + /* 117 */ "VALUE", + /* 118 */ "NONE", + /* 119 */ "PREV", + /* 120 */ "LINEAR", + /* 121 */ "NEXT", + /* 122 */ "GROUP", + /* 123 */ "HAVING", + /* 124 */ "ORDER", + /* 125 */ "SLIMIT", + /* 126 */ "SOFFSET", + /* 127 */ "LIMIT", + /* 128 */ "OFFSET", + /* 129 */ "ASC", + /* 130 */ "DESC", + /* 131 */ "NULLS", + /* 132 */ "FIRST", + /* 133 */ "LAST", + /* 134 */ "cmd", + /* 135 */ "user_name", + /* 136 */ "dnode_endpoint", + /* 137 */ "dnode_host_name", + /* 138 */ "not_exists_opt", + /* 139 */ "db_name", + /* 140 */ "db_options", + /* 141 */ "exists_opt", + /* 142 */ "full_table_name", + /* 143 */ "column_def_list", + /* 144 */ "tags_def_opt", + /* 145 */ "table_options", + /* 146 */ "multi_create_clause", + /* 147 */ "tags_def", + /* 148 */ "multi_drop_clause", + /* 149 */ "create_subtable_clause", + /* 150 */ "specific_tags_opt", + /* 151 */ "literal_list", + /* 152 */ "drop_table_clause", + /* 153 */ "col_name_list", + /* 154 */ "table_name", + /* 155 */ "column_def", + /* 156 */ "column_name", + /* 157 */ "type_name", + /* 158 */ "col_name", + /* 159 */ "query_expression", + /* 160 */ "literal", + /* 161 */ "duration_literal", + /* 162 */ "function_name", + /* 163 */ "table_alias", + /* 164 */ "column_alias", + /* 165 */ "expression", + /* 166 */ "column_reference", + /* 167 */ "expression_list", + /* 168 */ "subquery", + /* 169 */ "predicate", + /* 170 */ "compare_op", + /* 171 */ "in_op", + /* 172 */ "in_predicate_value", + /* 173 */ "boolean_value_expression", + /* 174 */ "boolean_primary", + /* 175 */ "common_expression", + /* 176 */ "from_clause", + /* 177 */ "table_reference_list", + /* 178 */ "table_reference", + /* 179 */ "table_primary", + /* 180 */ "joined_table", + /* 181 */ "alias_opt", + /* 182 */ "parenthesized_joined_table", + /* 183 */ "join_type", + /* 184 */ "search_condition", + /* 185 */ "query_specification", + /* 186 */ "set_quantifier_opt", + /* 187 */ "select_list", + /* 188 */ "where_clause_opt", + /* 189 */ "partition_by_clause_opt", + /* 190 */ "twindow_clause_opt", + /* 191 */ "group_by_clause_opt", + /* 192 */ "having_clause_opt", + /* 193 */ "select_sublist", + /* 194 */ "select_item", + /* 195 */ "sliding_opt", + /* 196 */ "fill_opt", + /* 197 */ "fill_mode", + /* 198 */ "group_by_list", + /* 199 */ "query_expression_body", + /* 200 */ "order_by_clause_opt", + /* 201 */ "slimit_clause_opt", + /* 202 */ "limit_clause_opt", + /* 203 */ "query_primary", + /* 204 */ "sort_specification_list", + /* 205 */ "sort_specification", + /* 206 */ "ordering_specification_opt", + /* 207 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -766,217 +806,240 @@ static const char *const yyTokenName[] = { /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { - /* 0 */ "cmd ::= CREATE DATABASE exists_opt db_name db_options", - /* 1 */ "exists_opt ::= IF NOT EXISTS", - /* 2 */ "exists_opt ::=", - /* 3 */ "db_options ::=", - /* 4 */ "db_options ::= db_options BLOCKS NK_INTEGER", - /* 5 */ "db_options ::= db_options CACHE NK_INTEGER", - /* 6 */ "db_options ::= db_options CACHELAST NK_INTEGER", - /* 7 */ "db_options ::= db_options COMP NK_INTEGER", - /* 8 */ "db_options ::= db_options DAYS NK_INTEGER", - /* 9 */ "db_options ::= db_options FSYNC NK_INTEGER", - /* 10 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 11 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 12 */ "db_options ::= db_options KEEP NK_INTEGER", - /* 13 */ "db_options ::= db_options PRECISION NK_STRING", - /* 14 */ "db_options ::= db_options QUORUM NK_INTEGER", - /* 15 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 16 */ "db_options ::= db_options TTL NK_INTEGER", - /* 17 */ "db_options ::= db_options WAL NK_INTEGER", - /* 18 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 19 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 20 */ "db_options ::= db_options STREAM_MODE NK_INTEGER", - /* 21 */ "cmd ::= USE db_name", - /* 22 */ "cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", - /* 23 */ "cmd ::= CREATE TABLE multi_create_clause", - /* 24 */ "cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", - /* 25 */ "multi_create_clause ::= create_subtable_clause", - /* 26 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", - /* 27 */ "create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", - /* 28 */ "specific_tags_opt ::=", - /* 29 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", - /* 30 */ "full_table_name ::= NK_ID", - /* 31 */ "full_table_name ::= NK_ID NK_DOT NK_ID", - /* 32 */ "column_def_list ::= column_def", - /* 33 */ "column_def_list ::= column_def_list NK_COMMA column_def", - /* 34 */ "column_def ::= column_name type_name", - /* 35 */ "column_def ::= column_name type_name COMMENT NK_STRING", - /* 36 */ "type_name ::= BOOL", - /* 37 */ "type_name ::= TINYINT", - /* 38 */ "type_name ::= SMALLINT", - /* 39 */ "type_name ::= INT", - /* 40 */ "type_name ::= INTEGER", - /* 41 */ "type_name ::= BIGINT", - /* 42 */ "type_name ::= FLOAT", - /* 43 */ "type_name ::= DOUBLE", - /* 44 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", - /* 45 */ "type_name ::= TIMESTAMP", - /* 46 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", - /* 47 */ "type_name ::= TINYINT UNSIGNED", - /* 48 */ "type_name ::= SMALLINT UNSIGNED", - /* 49 */ "type_name ::= INT UNSIGNED", - /* 50 */ "type_name ::= BIGINT UNSIGNED", - /* 51 */ "type_name ::= JSON", - /* 52 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", - /* 53 */ "type_name ::= MEDIUMBLOB", - /* 54 */ "type_name ::= BLOB", - /* 55 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", - /* 56 */ "type_name ::= DECIMAL", - /* 57 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", - /* 58 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", - /* 59 */ "tags_def_opt ::=", - /* 60 */ "tags_def_opt ::= tags_def", - /* 61 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", - /* 62 */ "table_options ::=", - /* 63 */ "table_options ::= table_options COMMENT NK_STRING", - /* 64 */ "table_options ::= table_options KEEP NK_INTEGER", - /* 65 */ "table_options ::= table_options TTL NK_INTEGER", - /* 66 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", - /* 67 */ "col_name_list ::= col_name", - /* 68 */ "col_name_list ::= col_name_list NK_COMMA col_name", - /* 69 */ "col_name ::= column_name", - /* 70 */ "cmd ::= SHOW DATABASES", - /* 71 */ "cmd ::= SHOW TABLES", - /* 72 */ "cmd ::= query_expression", - /* 73 */ "literal ::= NK_INTEGER", - /* 74 */ "literal ::= NK_FLOAT", - /* 75 */ "literal ::= NK_STRING", - /* 76 */ "literal ::= NK_BOOL", - /* 77 */ "literal ::= TIMESTAMP NK_STRING", - /* 78 */ "literal ::= duration_literal", - /* 79 */ "duration_literal ::= NK_VARIABLE", - /* 80 */ "literal_list ::= literal", - /* 81 */ "literal_list ::= literal_list NK_COMMA literal", - /* 82 */ "db_name ::= NK_ID", - /* 83 */ "table_name ::= NK_ID", - /* 84 */ "column_name ::= NK_ID", - /* 85 */ "function_name ::= NK_ID", - /* 86 */ "table_alias ::= NK_ID", - /* 87 */ "column_alias ::= NK_ID", - /* 88 */ "expression ::= literal", - /* 89 */ "expression ::= column_reference", - /* 90 */ "expression ::= function_name NK_LP expression_list NK_RP", - /* 91 */ "expression ::= function_name NK_LP NK_STAR NK_RP", - /* 92 */ "expression ::= subquery", - /* 93 */ "expression ::= NK_LP expression NK_RP", - /* 94 */ "expression ::= NK_PLUS expression", - /* 95 */ "expression ::= NK_MINUS expression", - /* 96 */ "expression ::= expression NK_PLUS expression", - /* 97 */ "expression ::= expression NK_MINUS expression", - /* 98 */ "expression ::= expression NK_STAR expression", - /* 99 */ "expression ::= expression NK_SLASH expression", - /* 100 */ "expression ::= expression NK_REM expression", - /* 101 */ "expression_list ::= expression", - /* 102 */ "expression_list ::= expression_list NK_COMMA expression", - /* 103 */ "column_reference ::= column_name", - /* 104 */ "column_reference ::= table_name NK_DOT column_name", - /* 105 */ "predicate ::= expression compare_op expression", - /* 106 */ "predicate ::= expression BETWEEN expression AND expression", - /* 107 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 108 */ "predicate ::= expression IS NULL", - /* 109 */ "predicate ::= expression IS NOT NULL", - /* 110 */ "predicate ::= expression in_op in_predicate_value", - /* 111 */ "compare_op ::= NK_LT", - /* 112 */ "compare_op ::= NK_GT", - /* 113 */ "compare_op ::= NK_LE", - /* 114 */ "compare_op ::= NK_GE", - /* 115 */ "compare_op ::= NK_NE", - /* 116 */ "compare_op ::= NK_EQ", - /* 117 */ "compare_op ::= LIKE", - /* 118 */ "compare_op ::= NOT LIKE", - /* 119 */ "compare_op ::= MATCH", - /* 120 */ "compare_op ::= NMATCH", - /* 121 */ "in_op ::= IN", - /* 122 */ "in_op ::= NOT IN", - /* 123 */ "in_predicate_value ::= NK_LP expression_list NK_RP", - /* 124 */ "boolean_value_expression ::= boolean_primary", - /* 125 */ "boolean_value_expression ::= NOT boolean_primary", - /* 126 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 127 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 128 */ "boolean_primary ::= predicate", - /* 129 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 130 */ "common_expression ::= expression", - /* 131 */ "common_expression ::= boolean_value_expression", - /* 132 */ "from_clause ::= FROM table_reference_list", - /* 133 */ "table_reference_list ::= table_reference", - /* 134 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 135 */ "table_reference ::= table_primary", - /* 136 */ "table_reference ::= joined_table", - /* 137 */ "table_primary ::= table_name alias_opt", - /* 138 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 139 */ "table_primary ::= subquery alias_opt", - /* 140 */ "table_primary ::= parenthesized_joined_table", - /* 141 */ "alias_opt ::=", - /* 142 */ "alias_opt ::= table_alias", - /* 143 */ "alias_opt ::= AS table_alias", - /* 144 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 145 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 146 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 147 */ "join_type ::=", - /* 148 */ "join_type ::= INNER", - /* 149 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 150 */ "set_quantifier_opt ::=", - /* 151 */ "set_quantifier_opt ::= DISTINCT", - /* 152 */ "set_quantifier_opt ::= ALL", - /* 153 */ "select_list ::= NK_STAR", - /* 154 */ "select_list ::= select_sublist", - /* 155 */ "select_sublist ::= select_item", - /* 156 */ "select_sublist ::= select_sublist NK_COMMA select_item", - /* 157 */ "select_item ::= common_expression", - /* 158 */ "select_item ::= common_expression column_alias", - /* 159 */ "select_item ::= common_expression AS column_alias", - /* 160 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 161 */ "where_clause_opt ::=", - /* 162 */ "where_clause_opt ::= WHERE search_condition", - /* 163 */ "partition_by_clause_opt ::=", - /* 164 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 165 */ "twindow_clause_opt ::=", - /* 166 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP", - /* 167 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", - /* 168 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 169 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 170 */ "sliding_opt ::=", - /* 171 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 172 */ "fill_opt ::=", - /* 173 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 174 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 175 */ "fill_mode ::= NONE", - /* 176 */ "fill_mode ::= PREV", - /* 177 */ "fill_mode ::= NULL", - /* 178 */ "fill_mode ::= LINEAR", - /* 179 */ "fill_mode ::= NEXT", - /* 180 */ "group_by_clause_opt ::=", - /* 181 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 182 */ "group_by_list ::= expression", - /* 183 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 184 */ "having_clause_opt ::=", - /* 185 */ "having_clause_opt ::= HAVING search_condition", - /* 186 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 187 */ "query_expression_body ::= query_primary", - /* 188 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 189 */ "query_primary ::= query_specification", - /* 190 */ "order_by_clause_opt ::=", - /* 191 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 192 */ "slimit_clause_opt ::=", - /* 193 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 194 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 195 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 196 */ "limit_clause_opt ::=", - /* 197 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 198 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 199 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 200 */ "subquery ::= NK_LP query_expression NK_RP", - /* 201 */ "search_condition ::= common_expression", - /* 202 */ "sort_specification_list ::= sort_specification", - /* 203 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 204 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 205 */ "ordering_specification_opt ::=", - /* 206 */ "ordering_specification_opt ::= ASC", - /* 207 */ "ordering_specification_opt ::= DESC", - /* 208 */ "null_ordering_opt ::=", - /* 209 */ "null_ordering_opt ::= NULLS FIRST", - /* 210 */ "null_ordering_opt ::= NULLS LAST", + /* 0 */ "cmd ::= CREATE USER user_name PASS NK_STRING", + /* 1 */ "cmd ::= ALTER USER user_name PASS NK_STRING", + /* 2 */ "cmd ::= ALTER USER user_name PRIVILEGE NK_STRING", + /* 3 */ "cmd ::= DROP USER user_name", + /* 4 */ "cmd ::= SHOW USERS", + /* 5 */ "cmd ::= CREATE DNODE dnode_endpoint", + /* 6 */ "cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER", + /* 7 */ "cmd ::= DROP DNODE NK_INTEGER", + /* 8 */ "cmd ::= DROP DNODE dnode_endpoint", + /* 9 */ "cmd ::= SHOW DNODES", + /* 10 */ "dnode_endpoint ::= NK_STRING", + /* 11 */ "dnode_host_name ::= NK_ID", + /* 12 */ "dnode_host_name ::= NK_IPTOKEN", + /* 13 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options", + /* 14 */ "cmd ::= DROP DATABASE exists_opt db_name", + /* 15 */ "cmd ::= SHOW DATABASES", + /* 16 */ "cmd ::= USE db_name", + /* 17 */ "not_exists_opt ::= IF NOT EXISTS", + /* 18 */ "not_exists_opt ::=", + /* 19 */ "exists_opt ::= IF EXISTS", + /* 20 */ "exists_opt ::=", + /* 21 */ "db_options ::=", + /* 22 */ "db_options ::= db_options BLOCKS NK_INTEGER", + /* 23 */ "db_options ::= db_options CACHE NK_INTEGER", + /* 24 */ "db_options ::= db_options CACHELAST NK_INTEGER", + /* 25 */ "db_options ::= db_options COMP NK_INTEGER", + /* 26 */ "db_options ::= db_options DAYS NK_INTEGER", + /* 27 */ "db_options ::= db_options FSYNC NK_INTEGER", + /* 28 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 29 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 30 */ "db_options ::= db_options KEEP NK_INTEGER", + /* 31 */ "db_options ::= db_options PRECISION NK_STRING", + /* 32 */ "db_options ::= db_options QUORUM NK_INTEGER", + /* 33 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 34 */ "db_options ::= db_options TTL NK_INTEGER", + /* 35 */ "db_options ::= db_options WAL NK_INTEGER", + /* 36 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 37 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 38 */ "db_options ::= db_options STREAM_MODE NK_INTEGER", + /* 39 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options", + /* 40 */ "cmd ::= CREATE TABLE multi_create_clause", + /* 41 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options", + /* 42 */ "cmd ::= DROP TABLE multi_drop_clause", + /* 43 */ "cmd ::= SHOW TABLES", + /* 44 */ "cmd ::= SHOW STABLES", + /* 45 */ "multi_create_clause ::= create_subtable_clause", + /* 46 */ "multi_create_clause ::= multi_create_clause create_subtable_clause", + /* 47 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP", + /* 48 */ "multi_drop_clause ::= drop_table_clause", + /* 49 */ "multi_drop_clause ::= multi_drop_clause drop_table_clause", + /* 50 */ "drop_table_clause ::= exists_opt full_table_name", + /* 51 */ "specific_tags_opt ::=", + /* 52 */ "specific_tags_opt ::= NK_LP col_name_list NK_RP", + /* 53 */ "full_table_name ::= table_name", + /* 54 */ "full_table_name ::= db_name NK_DOT table_name", + /* 55 */ "column_def_list ::= column_def", + /* 56 */ "column_def_list ::= column_def_list NK_COMMA column_def", + /* 57 */ "column_def ::= column_name type_name", + /* 58 */ "column_def ::= column_name type_name COMMENT NK_STRING", + /* 59 */ "type_name ::= BOOL", + /* 60 */ "type_name ::= TINYINT", + /* 61 */ "type_name ::= SMALLINT", + /* 62 */ "type_name ::= INT", + /* 63 */ "type_name ::= INTEGER", + /* 64 */ "type_name ::= BIGINT", + /* 65 */ "type_name ::= FLOAT", + /* 66 */ "type_name ::= DOUBLE", + /* 67 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP", + /* 68 */ "type_name ::= TIMESTAMP", + /* 69 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP", + /* 70 */ "type_name ::= TINYINT UNSIGNED", + /* 71 */ "type_name ::= SMALLINT UNSIGNED", + /* 72 */ "type_name ::= INT UNSIGNED", + /* 73 */ "type_name ::= BIGINT UNSIGNED", + /* 74 */ "type_name ::= JSON", + /* 75 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP", + /* 76 */ "type_name ::= MEDIUMBLOB", + /* 77 */ "type_name ::= BLOB", + /* 78 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP", + /* 79 */ "type_name ::= DECIMAL", + /* 80 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP", + /* 81 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP", + /* 82 */ "tags_def_opt ::=", + /* 83 */ "tags_def_opt ::= tags_def", + /* 84 */ "tags_def ::= TAGS NK_LP column_def_list NK_RP", + /* 85 */ "table_options ::=", + /* 86 */ "table_options ::= table_options COMMENT NK_STRING", + /* 87 */ "table_options ::= table_options KEEP NK_INTEGER", + /* 88 */ "table_options ::= table_options TTL NK_INTEGER", + /* 89 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP", + /* 90 */ "col_name_list ::= col_name", + /* 91 */ "col_name_list ::= col_name_list NK_COMMA col_name", + /* 92 */ "col_name ::= column_name", + /* 93 */ "cmd ::= SHOW VGROUPS", + /* 94 */ "cmd ::= query_expression", + /* 95 */ "literal ::= NK_INTEGER", + /* 96 */ "literal ::= NK_FLOAT", + /* 97 */ "literal ::= NK_STRING", + /* 98 */ "literal ::= NK_BOOL", + /* 99 */ "literal ::= TIMESTAMP NK_STRING", + /* 100 */ "literal ::= duration_literal", + /* 101 */ "duration_literal ::= NK_VARIABLE", + /* 102 */ "literal_list ::= literal", + /* 103 */ "literal_list ::= literal_list NK_COMMA literal", + /* 104 */ "db_name ::= NK_ID", + /* 105 */ "table_name ::= NK_ID", + /* 106 */ "column_name ::= NK_ID", + /* 107 */ "function_name ::= NK_ID", + /* 108 */ "table_alias ::= NK_ID", + /* 109 */ "column_alias ::= NK_ID", + /* 110 */ "user_name ::= NK_ID", + /* 111 */ "expression ::= literal", + /* 112 */ "expression ::= column_reference", + /* 113 */ "expression ::= function_name NK_LP expression_list NK_RP", + /* 114 */ "expression ::= function_name NK_LP NK_STAR NK_RP", + /* 115 */ "expression ::= subquery", + /* 116 */ "expression ::= NK_LP expression NK_RP", + /* 117 */ "expression ::= NK_PLUS expression", + /* 118 */ "expression ::= NK_MINUS expression", + /* 119 */ "expression ::= expression NK_PLUS expression", + /* 120 */ "expression ::= expression NK_MINUS expression", + /* 121 */ "expression ::= expression NK_STAR expression", + /* 122 */ "expression ::= expression NK_SLASH expression", + /* 123 */ "expression ::= expression NK_REM expression", + /* 124 */ "expression_list ::= expression", + /* 125 */ "expression_list ::= expression_list NK_COMMA expression", + /* 126 */ "column_reference ::= column_name", + /* 127 */ "column_reference ::= table_name NK_DOT column_name", + /* 128 */ "predicate ::= expression compare_op expression", + /* 129 */ "predicate ::= expression BETWEEN expression AND expression", + /* 130 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 131 */ "predicate ::= expression IS NULL", + /* 132 */ "predicate ::= expression IS NOT NULL", + /* 133 */ "predicate ::= expression in_op in_predicate_value", + /* 134 */ "compare_op ::= NK_LT", + /* 135 */ "compare_op ::= NK_GT", + /* 136 */ "compare_op ::= NK_LE", + /* 137 */ "compare_op ::= NK_GE", + /* 138 */ "compare_op ::= NK_NE", + /* 139 */ "compare_op ::= NK_EQ", + /* 140 */ "compare_op ::= LIKE", + /* 141 */ "compare_op ::= NOT LIKE", + /* 142 */ "compare_op ::= MATCH", + /* 143 */ "compare_op ::= NMATCH", + /* 144 */ "in_op ::= IN", + /* 145 */ "in_op ::= NOT IN", + /* 146 */ "in_predicate_value ::= NK_LP expression_list NK_RP", + /* 147 */ "boolean_value_expression ::= boolean_primary", + /* 148 */ "boolean_value_expression ::= NOT boolean_primary", + /* 149 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 150 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 151 */ "boolean_primary ::= predicate", + /* 152 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 153 */ "common_expression ::= expression", + /* 154 */ "common_expression ::= boolean_value_expression", + /* 155 */ "from_clause ::= FROM table_reference_list", + /* 156 */ "table_reference_list ::= table_reference", + /* 157 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 158 */ "table_reference ::= table_primary", + /* 159 */ "table_reference ::= joined_table", + /* 160 */ "table_primary ::= table_name alias_opt", + /* 161 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 162 */ "table_primary ::= subquery alias_opt", + /* 163 */ "table_primary ::= parenthesized_joined_table", + /* 164 */ "alias_opt ::=", + /* 165 */ "alias_opt ::= table_alias", + /* 166 */ "alias_opt ::= AS table_alias", + /* 167 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 168 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 169 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 170 */ "join_type ::=", + /* 171 */ "join_type ::= INNER", + /* 172 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 173 */ "set_quantifier_opt ::=", + /* 174 */ "set_quantifier_opt ::= DISTINCT", + /* 175 */ "set_quantifier_opt ::= ALL", + /* 176 */ "select_list ::= NK_STAR", + /* 177 */ "select_list ::= select_sublist", + /* 178 */ "select_sublist ::= select_item", + /* 179 */ "select_sublist ::= select_sublist NK_COMMA select_item", + /* 180 */ "select_item ::= common_expression", + /* 181 */ "select_item ::= common_expression column_alias", + /* 182 */ "select_item ::= common_expression AS column_alias", + /* 183 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 184 */ "where_clause_opt ::=", + /* 185 */ "where_clause_opt ::= WHERE search_condition", + /* 186 */ "partition_by_clause_opt ::=", + /* 187 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 188 */ "twindow_clause_opt ::=", + /* 189 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP", + /* 190 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP", + /* 191 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 192 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 193 */ "sliding_opt ::=", + /* 194 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 195 */ "fill_opt ::=", + /* 196 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 197 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 198 */ "fill_mode ::= NONE", + /* 199 */ "fill_mode ::= PREV", + /* 200 */ "fill_mode ::= NULL", + /* 201 */ "fill_mode ::= LINEAR", + /* 202 */ "fill_mode ::= NEXT", + /* 203 */ "group_by_clause_opt ::=", + /* 204 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 205 */ "group_by_list ::= expression", + /* 206 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 207 */ "having_clause_opt ::=", + /* 208 */ "having_clause_opt ::= HAVING search_condition", + /* 209 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 210 */ "query_expression_body ::= query_primary", + /* 211 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 212 */ "query_primary ::= query_specification", + /* 213 */ "order_by_clause_opt ::=", + /* 214 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 215 */ "slimit_clause_opt ::=", + /* 216 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 217 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 218 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 219 */ "limit_clause_opt ::=", + /* 220 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 221 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 222 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 223 */ "subquery ::= NK_LP query_expression NK_RP", + /* 224 */ "search_condition ::= common_expression", + /* 225 */ "sort_specification_list ::= sort_specification", + /* 226 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 227 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 228 */ "ordering_specification_opt ::=", + /* 229 */ "ordering_specification_opt ::= ASC", + /* 230 */ "ordering_specification_opt ::= DESC", + /* 231 */ "null_ordering_opt ::=", + /* 232 */ "null_ordering_opt ::= NULLS FIRST", + /* 233 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -1103,122 +1166,124 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 123: /* cmd */ - case 133: /* create_subtable_clause */ - case 137: /* column_def */ - case 140: /* col_name */ - case 141: /* query_expression */ - case 142: /* literal */ - case 143: /* duration_literal */ - case 148: /* expression */ - case 149: /* column_reference */ - case 151: /* subquery */ - case 152: /* predicate */ - case 155: /* in_predicate_value */ - case 156: /* boolean_value_expression */ - case 157: /* boolean_primary */ - case 158: /* common_expression */ - case 159: /* from_clause */ - case 160: /* table_reference_list */ - case 161: /* table_reference */ - case 162: /* table_primary */ - case 163: /* joined_table */ - case 165: /* parenthesized_joined_table */ - case 167: /* search_condition */ - case 168: /* query_specification */ - case 171: /* where_clause_opt */ - case 173: /* twindow_clause_opt */ - case 175: /* having_clause_opt */ - case 177: /* select_item */ - case 178: /* sliding_opt */ - case 179: /* fill_opt */ - case 182: /* query_expression_body */ - case 184: /* slimit_clause_opt */ - case 185: /* limit_clause_opt */ - case 186: /* query_primary */ - case 188: /* sort_specification */ + case 134: /* cmd */ + case 142: /* full_table_name */ + case 149: /* create_subtable_clause */ + case 152: /* drop_table_clause */ + case 155: /* column_def */ + case 158: /* col_name */ + case 159: /* query_expression */ + case 160: /* literal */ + case 161: /* duration_literal */ + case 165: /* expression */ + case 166: /* column_reference */ + case 168: /* subquery */ + case 169: /* predicate */ + case 172: /* in_predicate_value */ + case 173: /* boolean_value_expression */ + case 174: /* boolean_primary */ + case 175: /* common_expression */ + case 176: /* from_clause */ + case 177: /* table_reference_list */ + case 178: /* table_reference */ + case 179: /* table_primary */ + case 180: /* joined_table */ + case 182: /* parenthesized_joined_table */ + case 184: /* search_condition */ + case 185: /* query_specification */ + case 188: /* where_clause_opt */ + case 190: /* twindow_clause_opt */ + case 192: /* having_clause_opt */ + case 194: /* select_item */ + case 195: /* sliding_opt */ + case 196: /* fill_opt */ + case 199: /* query_expression_body */ + case 201: /* slimit_clause_opt */ + case 202: /* limit_clause_opt */ + case 203: /* query_primary */ + case 205: /* sort_specification */ { - nodesDestroyNode((yypminor->yy210)); + nodesDestroyNode((yypminor->yy392)); } break; - case 124: /* exists_opt */ - case 169: /* set_quantifier_opt */ + case 135: /* user_name */ + case 136: /* dnode_endpoint */ + case 137: /* dnode_host_name */ + case 139: /* db_name */ + case 154: /* table_name */ + case 156: /* column_name */ + case 162: /* function_name */ + case 163: /* table_alias */ + case 164: /* column_alias */ + case 181: /* alias_opt */ { } break; - case 125: /* db_name */ - case 138: /* column_name */ - case 144: /* table_name */ - case 145: /* function_name */ - case 146: /* table_alias */ - case 147: /* column_alias */ - case 164: /* alias_opt */ + case 138: /* not_exists_opt */ + case 141: /* exists_opt */ + case 186: /* set_quantifier_opt */ { } break; - case 126: /* db_options */ + case 140: /* db_options */ { - tfree((yypminor->yy211)); + tfree((yypminor->yy103)); } break; - case 127: /* full_table_name */ + case 143: /* column_def_list */ + case 144: /* tags_def_opt */ + case 146: /* multi_create_clause */ + case 147: /* tags_def */ + case 148: /* multi_drop_clause */ + case 150: /* specific_tags_opt */ + case 151: /* literal_list */ + case 153: /* col_name_list */ + case 167: /* expression_list */ + case 187: /* select_list */ + case 189: /* partition_by_clause_opt */ + case 191: /* group_by_clause_opt */ + case 193: /* select_sublist */ + case 198: /* group_by_list */ + case 200: /* order_by_clause_opt */ + case 204: /* sort_specification_list */ { - + nodesDestroyList((yypminor->yy184)); } break; - case 128: /* column_def_list */ - case 129: /* tags_def_opt */ - case 131: /* multi_create_clause */ - case 132: /* tags_def */ - case 134: /* specific_tags_opt */ - case 135: /* literal_list */ - case 136: /* col_name_list */ - case 150: /* expression_list */ - case 170: /* select_list */ - case 172: /* partition_by_clause_opt */ - case 174: /* group_by_clause_opt */ - case 176: /* select_sublist */ - case 181: /* group_by_list */ - case 183: /* order_by_clause_opt */ - case 187: /* sort_specification_list */ + case 145: /* table_options */ { - nodesDestroyList((yypminor->yy182)); + tfree((yypminor->yy334)); } break; - case 130: /* table_options */ -{ - tfree((yypminor->yy286)); -} - break; - case 139: /* type_name */ + case 157: /* type_name */ { } break; - case 153: /* compare_op */ - case 154: /* in_op */ + case 170: /* compare_op */ + case 171: /* in_op */ { } break; - case 166: /* join_type */ + case 183: /* join_type */ { } break; - case 180: /* fill_mode */ + case 197: /* fill_mode */ { } break; - case 189: /* ordering_specification_opt */ + case 206: /* ordering_specification_opt */ { } break; - case 190: /* null_ordering_opt */ + case 207: /* null_ordering_opt */ { } @@ -1517,217 +1582,240 @@ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { - { 123, -5 }, /* (0) cmd ::= CREATE DATABASE exists_opt db_name db_options */ - { 124, -3 }, /* (1) exists_opt ::= IF NOT EXISTS */ - { 124, 0 }, /* (2) exists_opt ::= */ - { 126, 0 }, /* (3) db_options ::= */ - { 126, -3 }, /* (4) db_options ::= db_options BLOCKS NK_INTEGER */ - { 126, -3 }, /* (5) db_options ::= db_options CACHE NK_INTEGER */ - { 126, -3 }, /* (6) db_options ::= db_options CACHELAST NK_INTEGER */ - { 126, -3 }, /* (7) db_options ::= db_options COMP NK_INTEGER */ - { 126, -3 }, /* (8) db_options ::= db_options DAYS NK_INTEGER */ - { 126, -3 }, /* (9) db_options ::= db_options FSYNC NK_INTEGER */ - { 126, -3 }, /* (10) db_options ::= db_options MAXROWS NK_INTEGER */ - { 126, -3 }, /* (11) db_options ::= db_options MINROWS NK_INTEGER */ - { 126, -3 }, /* (12) db_options ::= db_options KEEP NK_INTEGER */ - { 126, -3 }, /* (13) db_options ::= db_options PRECISION NK_STRING */ - { 126, -3 }, /* (14) db_options ::= db_options QUORUM NK_INTEGER */ - { 126, -3 }, /* (15) db_options ::= db_options REPLICA NK_INTEGER */ - { 126, -3 }, /* (16) db_options ::= db_options TTL NK_INTEGER */ - { 126, -3 }, /* (17) db_options ::= db_options WAL NK_INTEGER */ - { 126, -3 }, /* (18) db_options ::= db_options VGROUPS NK_INTEGER */ - { 126, -3 }, /* (19) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 126, -3 }, /* (20) db_options ::= db_options STREAM_MODE NK_INTEGER */ - { 123, -2 }, /* (21) cmd ::= USE db_name */ - { 123, -9 }, /* (22) cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 123, -3 }, /* (23) cmd ::= CREATE TABLE multi_create_clause */ - { 123, -9 }, /* (24) cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 131, -1 }, /* (25) multi_create_clause ::= create_subtable_clause */ - { 131, -2 }, /* (26) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 133, -9 }, /* (27) create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ - { 134, 0 }, /* (28) specific_tags_opt ::= */ - { 134, -3 }, /* (29) specific_tags_opt ::= NK_LP col_name_list NK_RP */ - { 127, -1 }, /* (30) full_table_name ::= NK_ID */ - { 127, -3 }, /* (31) full_table_name ::= NK_ID NK_DOT NK_ID */ - { 128, -1 }, /* (32) column_def_list ::= column_def */ - { 128, -3 }, /* (33) column_def_list ::= column_def_list NK_COMMA column_def */ - { 137, -2 }, /* (34) column_def ::= column_name type_name */ - { 137, -4 }, /* (35) column_def ::= column_name type_name COMMENT NK_STRING */ - { 139, -1 }, /* (36) type_name ::= BOOL */ - { 139, -1 }, /* (37) type_name ::= TINYINT */ - { 139, -1 }, /* (38) type_name ::= SMALLINT */ - { 139, -1 }, /* (39) type_name ::= INT */ - { 139, -1 }, /* (40) type_name ::= INTEGER */ - { 139, -1 }, /* (41) type_name ::= BIGINT */ - { 139, -1 }, /* (42) type_name ::= FLOAT */ - { 139, -1 }, /* (43) type_name ::= DOUBLE */ - { 139, -4 }, /* (44) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 139, -1 }, /* (45) type_name ::= TIMESTAMP */ - { 139, -4 }, /* (46) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 139, -2 }, /* (47) type_name ::= TINYINT UNSIGNED */ - { 139, -2 }, /* (48) type_name ::= SMALLINT UNSIGNED */ - { 139, -2 }, /* (49) type_name ::= INT UNSIGNED */ - { 139, -2 }, /* (50) type_name ::= BIGINT UNSIGNED */ - { 139, -1 }, /* (51) type_name ::= JSON */ - { 139, -4 }, /* (52) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 139, -1 }, /* (53) type_name ::= MEDIUMBLOB */ - { 139, -1 }, /* (54) type_name ::= BLOB */ - { 139, -4 }, /* (55) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 139, -1 }, /* (56) type_name ::= DECIMAL */ - { 139, -4 }, /* (57) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 139, -6 }, /* (58) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 129, 0 }, /* (59) tags_def_opt ::= */ - { 129, -1 }, /* (60) tags_def_opt ::= tags_def */ - { 132, -4 }, /* (61) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 130, 0 }, /* (62) table_options ::= */ - { 130, -3 }, /* (63) table_options ::= table_options COMMENT NK_STRING */ - { 130, -3 }, /* (64) table_options ::= table_options KEEP NK_INTEGER */ - { 130, -3 }, /* (65) table_options ::= table_options TTL NK_INTEGER */ - { 130, -5 }, /* (66) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 136, -1 }, /* (67) col_name_list ::= col_name */ - { 136, -3 }, /* (68) col_name_list ::= col_name_list NK_COMMA col_name */ - { 140, -1 }, /* (69) col_name ::= column_name */ - { 123, -2 }, /* (70) cmd ::= SHOW DATABASES */ - { 123, -2 }, /* (71) cmd ::= SHOW TABLES */ - { 123, -1 }, /* (72) cmd ::= query_expression */ - { 142, -1 }, /* (73) literal ::= NK_INTEGER */ - { 142, -1 }, /* (74) literal ::= NK_FLOAT */ - { 142, -1 }, /* (75) literal ::= NK_STRING */ - { 142, -1 }, /* (76) literal ::= NK_BOOL */ - { 142, -2 }, /* (77) literal ::= TIMESTAMP NK_STRING */ - { 142, -1 }, /* (78) literal ::= duration_literal */ - { 143, -1 }, /* (79) duration_literal ::= NK_VARIABLE */ - { 135, -1 }, /* (80) literal_list ::= literal */ - { 135, -3 }, /* (81) literal_list ::= literal_list NK_COMMA literal */ - { 125, -1 }, /* (82) db_name ::= NK_ID */ - { 144, -1 }, /* (83) table_name ::= NK_ID */ - { 138, -1 }, /* (84) column_name ::= NK_ID */ - { 145, -1 }, /* (85) function_name ::= NK_ID */ - { 146, -1 }, /* (86) table_alias ::= NK_ID */ - { 147, -1 }, /* (87) column_alias ::= NK_ID */ - { 148, -1 }, /* (88) expression ::= literal */ - { 148, -1 }, /* (89) expression ::= column_reference */ - { 148, -4 }, /* (90) expression ::= function_name NK_LP expression_list NK_RP */ - { 148, -4 }, /* (91) expression ::= function_name NK_LP NK_STAR NK_RP */ - { 148, -1 }, /* (92) expression ::= subquery */ - { 148, -3 }, /* (93) expression ::= NK_LP expression NK_RP */ - { 148, -2 }, /* (94) expression ::= NK_PLUS expression */ - { 148, -2 }, /* (95) expression ::= NK_MINUS expression */ - { 148, -3 }, /* (96) expression ::= expression NK_PLUS expression */ - { 148, -3 }, /* (97) expression ::= expression NK_MINUS expression */ - { 148, -3 }, /* (98) expression ::= expression NK_STAR expression */ - { 148, -3 }, /* (99) expression ::= expression NK_SLASH expression */ - { 148, -3 }, /* (100) expression ::= expression NK_REM expression */ - { 150, -1 }, /* (101) expression_list ::= expression */ - { 150, -3 }, /* (102) expression_list ::= expression_list NK_COMMA expression */ - { 149, -1 }, /* (103) column_reference ::= column_name */ - { 149, -3 }, /* (104) column_reference ::= table_name NK_DOT column_name */ - { 152, -3 }, /* (105) predicate ::= expression compare_op expression */ - { 152, -5 }, /* (106) predicate ::= expression BETWEEN expression AND expression */ - { 152, -6 }, /* (107) predicate ::= expression NOT BETWEEN expression AND expression */ - { 152, -3 }, /* (108) predicate ::= expression IS NULL */ - { 152, -4 }, /* (109) predicate ::= expression IS NOT NULL */ - { 152, -3 }, /* (110) predicate ::= expression in_op in_predicate_value */ - { 153, -1 }, /* (111) compare_op ::= NK_LT */ - { 153, -1 }, /* (112) compare_op ::= NK_GT */ - { 153, -1 }, /* (113) compare_op ::= NK_LE */ - { 153, -1 }, /* (114) compare_op ::= NK_GE */ - { 153, -1 }, /* (115) compare_op ::= NK_NE */ - { 153, -1 }, /* (116) compare_op ::= NK_EQ */ - { 153, -1 }, /* (117) compare_op ::= LIKE */ - { 153, -2 }, /* (118) compare_op ::= NOT LIKE */ - { 153, -1 }, /* (119) compare_op ::= MATCH */ - { 153, -1 }, /* (120) compare_op ::= NMATCH */ - { 154, -1 }, /* (121) in_op ::= IN */ - { 154, -2 }, /* (122) in_op ::= NOT IN */ - { 155, -3 }, /* (123) in_predicate_value ::= NK_LP expression_list NK_RP */ - { 156, -1 }, /* (124) boolean_value_expression ::= boolean_primary */ - { 156, -2 }, /* (125) boolean_value_expression ::= NOT boolean_primary */ - { 156, -3 }, /* (126) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 156, -3 }, /* (127) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 157, -1 }, /* (128) boolean_primary ::= predicate */ - { 157, -3 }, /* (129) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 158, -1 }, /* (130) common_expression ::= expression */ - { 158, -1 }, /* (131) common_expression ::= boolean_value_expression */ - { 159, -2 }, /* (132) from_clause ::= FROM table_reference_list */ - { 160, -1 }, /* (133) table_reference_list ::= table_reference */ - { 160, -3 }, /* (134) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 161, -1 }, /* (135) table_reference ::= table_primary */ - { 161, -1 }, /* (136) table_reference ::= joined_table */ - { 162, -2 }, /* (137) table_primary ::= table_name alias_opt */ - { 162, -4 }, /* (138) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 162, -2 }, /* (139) table_primary ::= subquery alias_opt */ - { 162, -1 }, /* (140) table_primary ::= parenthesized_joined_table */ - { 164, 0 }, /* (141) alias_opt ::= */ - { 164, -1 }, /* (142) alias_opt ::= table_alias */ - { 164, -2 }, /* (143) alias_opt ::= AS table_alias */ - { 165, -3 }, /* (144) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 165, -3 }, /* (145) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 163, -6 }, /* (146) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 166, 0 }, /* (147) join_type ::= */ - { 166, -1 }, /* (148) join_type ::= INNER */ - { 168, -9 }, /* (149) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 169, 0 }, /* (150) set_quantifier_opt ::= */ - { 169, -1 }, /* (151) set_quantifier_opt ::= DISTINCT */ - { 169, -1 }, /* (152) set_quantifier_opt ::= ALL */ - { 170, -1 }, /* (153) select_list ::= NK_STAR */ - { 170, -1 }, /* (154) select_list ::= select_sublist */ - { 176, -1 }, /* (155) select_sublist ::= select_item */ - { 176, -3 }, /* (156) select_sublist ::= select_sublist NK_COMMA select_item */ - { 177, -1 }, /* (157) select_item ::= common_expression */ - { 177, -2 }, /* (158) select_item ::= common_expression column_alias */ - { 177, -3 }, /* (159) select_item ::= common_expression AS column_alias */ - { 177, -3 }, /* (160) select_item ::= table_name NK_DOT NK_STAR */ - { 171, 0 }, /* (161) where_clause_opt ::= */ - { 171, -2 }, /* (162) where_clause_opt ::= WHERE search_condition */ - { 172, 0 }, /* (163) partition_by_clause_opt ::= */ - { 172, -3 }, /* (164) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 173, 0 }, /* (165) twindow_clause_opt ::= */ - { 173, -6 }, /* (166) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ - { 173, -4 }, /* (167) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ - { 173, -6 }, /* (168) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 173, -8 }, /* (169) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 178, 0 }, /* (170) sliding_opt ::= */ - { 178, -4 }, /* (171) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 179, 0 }, /* (172) fill_opt ::= */ - { 179, -4 }, /* (173) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 179, -6 }, /* (174) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 180, -1 }, /* (175) fill_mode ::= NONE */ - { 180, -1 }, /* (176) fill_mode ::= PREV */ - { 180, -1 }, /* (177) fill_mode ::= NULL */ - { 180, -1 }, /* (178) fill_mode ::= LINEAR */ - { 180, -1 }, /* (179) fill_mode ::= NEXT */ - { 174, 0 }, /* (180) group_by_clause_opt ::= */ - { 174, -3 }, /* (181) group_by_clause_opt ::= GROUP BY group_by_list */ - { 181, -1 }, /* (182) group_by_list ::= expression */ - { 181, -3 }, /* (183) group_by_list ::= group_by_list NK_COMMA expression */ - { 175, 0 }, /* (184) having_clause_opt ::= */ - { 175, -2 }, /* (185) having_clause_opt ::= HAVING search_condition */ - { 141, -4 }, /* (186) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 182, -1 }, /* (187) query_expression_body ::= query_primary */ - { 182, -4 }, /* (188) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 186, -1 }, /* (189) query_primary ::= query_specification */ - { 183, 0 }, /* (190) order_by_clause_opt ::= */ - { 183, -3 }, /* (191) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 184, 0 }, /* (192) slimit_clause_opt ::= */ - { 184, -2 }, /* (193) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 184, -4 }, /* (194) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 184, -4 }, /* (195) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 185, 0 }, /* (196) limit_clause_opt ::= */ - { 185, -2 }, /* (197) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 185, -4 }, /* (198) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 185, -4 }, /* (199) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 151, -3 }, /* (200) subquery ::= NK_LP query_expression NK_RP */ - { 167, -1 }, /* (201) search_condition ::= common_expression */ - { 187, -1 }, /* (202) sort_specification_list ::= sort_specification */ - { 187, -3 }, /* (203) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 188, -3 }, /* (204) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 189, 0 }, /* (205) ordering_specification_opt ::= */ - { 189, -1 }, /* (206) ordering_specification_opt ::= ASC */ - { 189, -1 }, /* (207) ordering_specification_opt ::= DESC */ - { 190, 0 }, /* (208) null_ordering_opt ::= */ - { 190, -2 }, /* (209) null_ordering_opt ::= NULLS FIRST */ - { 190, -2 }, /* (210) null_ordering_opt ::= NULLS LAST */ + { 134, -5 }, /* (0) cmd ::= CREATE USER user_name PASS NK_STRING */ + { 134, -5 }, /* (1) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 134, -5 }, /* (2) cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ + { 134, -3 }, /* (3) cmd ::= DROP USER user_name */ + { 134, -2 }, /* (4) cmd ::= SHOW USERS */ + { 134, -3 }, /* (5) cmd ::= CREATE DNODE dnode_endpoint */ + { 134, -5 }, /* (6) cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ + { 134, -3 }, /* (7) cmd ::= DROP DNODE NK_INTEGER */ + { 134, -3 }, /* (8) cmd ::= DROP DNODE dnode_endpoint */ + { 134, -2 }, /* (9) cmd ::= SHOW DNODES */ + { 136, -1 }, /* (10) dnode_endpoint ::= NK_STRING */ + { 137, -1 }, /* (11) dnode_host_name ::= NK_ID */ + { 137, -1 }, /* (12) dnode_host_name ::= NK_IPTOKEN */ + { 134, -5 }, /* (13) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 134, -4 }, /* (14) cmd ::= DROP DATABASE exists_opt db_name */ + { 134, -2 }, /* (15) cmd ::= SHOW DATABASES */ + { 134, -2 }, /* (16) cmd ::= USE db_name */ + { 138, -3 }, /* (17) not_exists_opt ::= IF NOT EXISTS */ + { 138, 0 }, /* (18) not_exists_opt ::= */ + { 141, -2 }, /* (19) exists_opt ::= IF EXISTS */ + { 141, 0 }, /* (20) exists_opt ::= */ + { 140, 0 }, /* (21) db_options ::= */ + { 140, -3 }, /* (22) db_options ::= db_options BLOCKS NK_INTEGER */ + { 140, -3 }, /* (23) db_options ::= db_options CACHE NK_INTEGER */ + { 140, -3 }, /* (24) db_options ::= db_options CACHELAST NK_INTEGER */ + { 140, -3 }, /* (25) db_options ::= db_options COMP NK_INTEGER */ + { 140, -3 }, /* (26) db_options ::= db_options DAYS NK_INTEGER */ + { 140, -3 }, /* (27) db_options ::= db_options FSYNC NK_INTEGER */ + { 140, -3 }, /* (28) db_options ::= db_options MAXROWS NK_INTEGER */ + { 140, -3 }, /* (29) db_options ::= db_options MINROWS NK_INTEGER */ + { 140, -3 }, /* (30) db_options ::= db_options KEEP NK_INTEGER */ + { 140, -3 }, /* (31) db_options ::= db_options PRECISION NK_STRING */ + { 140, -3 }, /* (32) db_options ::= db_options QUORUM NK_INTEGER */ + { 140, -3 }, /* (33) db_options ::= db_options REPLICA NK_INTEGER */ + { 140, -3 }, /* (34) db_options ::= db_options TTL NK_INTEGER */ + { 140, -3 }, /* (35) db_options ::= db_options WAL NK_INTEGER */ + { 140, -3 }, /* (36) db_options ::= db_options VGROUPS NK_INTEGER */ + { 140, -3 }, /* (37) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 140, -3 }, /* (38) db_options ::= db_options STREAM_MODE NK_INTEGER */ + { 134, -9 }, /* (39) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 134, -3 }, /* (40) cmd ::= CREATE TABLE multi_create_clause */ + { 134, -9 }, /* (41) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 134, -3 }, /* (42) cmd ::= DROP TABLE multi_drop_clause */ + { 134, -2 }, /* (43) cmd ::= SHOW TABLES */ + { 134, -2 }, /* (44) cmd ::= SHOW STABLES */ + { 146, -1 }, /* (45) multi_create_clause ::= create_subtable_clause */ + { 146, -2 }, /* (46) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 149, -9 }, /* (47) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ + { 148, -1 }, /* (48) multi_drop_clause ::= drop_table_clause */ + { 148, -2 }, /* (49) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 152, -2 }, /* (50) drop_table_clause ::= exists_opt full_table_name */ + { 150, 0 }, /* (51) specific_tags_opt ::= */ + { 150, -3 }, /* (52) specific_tags_opt ::= NK_LP col_name_list NK_RP */ + { 142, -1 }, /* (53) full_table_name ::= table_name */ + { 142, -3 }, /* (54) full_table_name ::= db_name NK_DOT table_name */ + { 143, -1 }, /* (55) column_def_list ::= column_def */ + { 143, -3 }, /* (56) column_def_list ::= column_def_list NK_COMMA column_def */ + { 155, -2 }, /* (57) column_def ::= column_name type_name */ + { 155, -4 }, /* (58) column_def ::= column_name type_name COMMENT NK_STRING */ + { 157, -1 }, /* (59) type_name ::= BOOL */ + { 157, -1 }, /* (60) type_name ::= TINYINT */ + { 157, -1 }, /* (61) type_name ::= SMALLINT */ + { 157, -1 }, /* (62) type_name ::= INT */ + { 157, -1 }, /* (63) type_name ::= INTEGER */ + { 157, -1 }, /* (64) type_name ::= BIGINT */ + { 157, -1 }, /* (65) type_name ::= FLOAT */ + { 157, -1 }, /* (66) type_name ::= DOUBLE */ + { 157, -4 }, /* (67) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 157, -1 }, /* (68) type_name ::= TIMESTAMP */ + { 157, -4 }, /* (69) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 157, -2 }, /* (70) type_name ::= TINYINT UNSIGNED */ + { 157, -2 }, /* (71) type_name ::= SMALLINT UNSIGNED */ + { 157, -2 }, /* (72) type_name ::= INT UNSIGNED */ + { 157, -2 }, /* (73) type_name ::= BIGINT UNSIGNED */ + { 157, -1 }, /* (74) type_name ::= JSON */ + { 157, -4 }, /* (75) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 157, -1 }, /* (76) type_name ::= MEDIUMBLOB */ + { 157, -1 }, /* (77) type_name ::= BLOB */ + { 157, -4 }, /* (78) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 157, -1 }, /* (79) type_name ::= DECIMAL */ + { 157, -4 }, /* (80) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 157, -6 }, /* (81) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 144, 0 }, /* (82) tags_def_opt ::= */ + { 144, -1 }, /* (83) tags_def_opt ::= tags_def */ + { 147, -4 }, /* (84) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 145, 0 }, /* (85) table_options ::= */ + { 145, -3 }, /* (86) table_options ::= table_options COMMENT NK_STRING */ + { 145, -3 }, /* (87) table_options ::= table_options KEEP NK_INTEGER */ + { 145, -3 }, /* (88) table_options ::= table_options TTL NK_INTEGER */ + { 145, -5 }, /* (89) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 153, -1 }, /* (90) col_name_list ::= col_name */ + { 153, -3 }, /* (91) col_name_list ::= col_name_list NK_COMMA col_name */ + { 158, -1 }, /* (92) col_name ::= column_name */ + { 134, -2 }, /* (93) cmd ::= SHOW VGROUPS */ + { 134, -1 }, /* (94) cmd ::= query_expression */ + { 160, -1 }, /* (95) literal ::= NK_INTEGER */ + { 160, -1 }, /* (96) literal ::= NK_FLOAT */ + { 160, -1 }, /* (97) literal ::= NK_STRING */ + { 160, -1 }, /* (98) literal ::= NK_BOOL */ + { 160, -2 }, /* (99) literal ::= TIMESTAMP NK_STRING */ + { 160, -1 }, /* (100) literal ::= duration_literal */ + { 161, -1 }, /* (101) duration_literal ::= NK_VARIABLE */ + { 151, -1 }, /* (102) literal_list ::= literal */ + { 151, -3 }, /* (103) literal_list ::= literal_list NK_COMMA literal */ + { 139, -1 }, /* (104) db_name ::= NK_ID */ + { 154, -1 }, /* (105) table_name ::= NK_ID */ + { 156, -1 }, /* (106) column_name ::= NK_ID */ + { 162, -1 }, /* (107) function_name ::= NK_ID */ + { 163, -1 }, /* (108) table_alias ::= NK_ID */ + { 164, -1 }, /* (109) column_alias ::= NK_ID */ + { 135, -1 }, /* (110) user_name ::= NK_ID */ + { 165, -1 }, /* (111) expression ::= literal */ + { 165, -1 }, /* (112) expression ::= column_reference */ + { 165, -4 }, /* (113) expression ::= function_name NK_LP expression_list NK_RP */ + { 165, -4 }, /* (114) expression ::= function_name NK_LP NK_STAR NK_RP */ + { 165, -1 }, /* (115) expression ::= subquery */ + { 165, -3 }, /* (116) expression ::= NK_LP expression NK_RP */ + { 165, -2 }, /* (117) expression ::= NK_PLUS expression */ + { 165, -2 }, /* (118) expression ::= NK_MINUS expression */ + { 165, -3 }, /* (119) expression ::= expression NK_PLUS expression */ + { 165, -3 }, /* (120) expression ::= expression NK_MINUS expression */ + { 165, -3 }, /* (121) expression ::= expression NK_STAR expression */ + { 165, -3 }, /* (122) expression ::= expression NK_SLASH expression */ + { 165, -3 }, /* (123) expression ::= expression NK_REM expression */ + { 167, -1 }, /* (124) expression_list ::= expression */ + { 167, -3 }, /* (125) expression_list ::= expression_list NK_COMMA expression */ + { 166, -1 }, /* (126) column_reference ::= column_name */ + { 166, -3 }, /* (127) column_reference ::= table_name NK_DOT column_name */ + { 169, -3 }, /* (128) predicate ::= expression compare_op expression */ + { 169, -5 }, /* (129) predicate ::= expression BETWEEN expression AND expression */ + { 169, -6 }, /* (130) predicate ::= expression NOT BETWEEN expression AND expression */ + { 169, -3 }, /* (131) predicate ::= expression IS NULL */ + { 169, -4 }, /* (132) predicate ::= expression IS NOT NULL */ + { 169, -3 }, /* (133) predicate ::= expression in_op in_predicate_value */ + { 170, -1 }, /* (134) compare_op ::= NK_LT */ + { 170, -1 }, /* (135) compare_op ::= NK_GT */ + { 170, -1 }, /* (136) compare_op ::= NK_LE */ + { 170, -1 }, /* (137) compare_op ::= NK_GE */ + { 170, -1 }, /* (138) compare_op ::= NK_NE */ + { 170, -1 }, /* (139) compare_op ::= NK_EQ */ + { 170, -1 }, /* (140) compare_op ::= LIKE */ + { 170, -2 }, /* (141) compare_op ::= NOT LIKE */ + { 170, -1 }, /* (142) compare_op ::= MATCH */ + { 170, -1 }, /* (143) compare_op ::= NMATCH */ + { 171, -1 }, /* (144) in_op ::= IN */ + { 171, -2 }, /* (145) in_op ::= NOT IN */ + { 172, -3 }, /* (146) in_predicate_value ::= NK_LP expression_list NK_RP */ + { 173, -1 }, /* (147) boolean_value_expression ::= boolean_primary */ + { 173, -2 }, /* (148) boolean_value_expression ::= NOT boolean_primary */ + { 173, -3 }, /* (149) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 173, -3 }, /* (150) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 174, -1 }, /* (151) boolean_primary ::= predicate */ + { 174, -3 }, /* (152) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 175, -1 }, /* (153) common_expression ::= expression */ + { 175, -1 }, /* (154) common_expression ::= boolean_value_expression */ + { 176, -2 }, /* (155) from_clause ::= FROM table_reference_list */ + { 177, -1 }, /* (156) table_reference_list ::= table_reference */ + { 177, -3 }, /* (157) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 178, -1 }, /* (158) table_reference ::= table_primary */ + { 178, -1 }, /* (159) table_reference ::= joined_table */ + { 179, -2 }, /* (160) table_primary ::= table_name alias_opt */ + { 179, -4 }, /* (161) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 179, -2 }, /* (162) table_primary ::= subquery alias_opt */ + { 179, -1 }, /* (163) table_primary ::= parenthesized_joined_table */ + { 181, 0 }, /* (164) alias_opt ::= */ + { 181, -1 }, /* (165) alias_opt ::= table_alias */ + { 181, -2 }, /* (166) alias_opt ::= AS table_alias */ + { 182, -3 }, /* (167) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 182, -3 }, /* (168) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 180, -6 }, /* (169) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 183, 0 }, /* (170) join_type ::= */ + { 183, -1 }, /* (171) join_type ::= INNER */ + { 185, -9 }, /* (172) query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 186, 0 }, /* (173) set_quantifier_opt ::= */ + { 186, -1 }, /* (174) set_quantifier_opt ::= DISTINCT */ + { 186, -1 }, /* (175) set_quantifier_opt ::= ALL */ + { 187, -1 }, /* (176) select_list ::= NK_STAR */ + { 187, -1 }, /* (177) select_list ::= select_sublist */ + { 193, -1 }, /* (178) select_sublist ::= select_item */ + { 193, -3 }, /* (179) select_sublist ::= select_sublist NK_COMMA select_item */ + { 194, -1 }, /* (180) select_item ::= common_expression */ + { 194, -2 }, /* (181) select_item ::= common_expression column_alias */ + { 194, -3 }, /* (182) select_item ::= common_expression AS column_alias */ + { 194, -3 }, /* (183) select_item ::= table_name NK_DOT NK_STAR */ + { 188, 0 }, /* (184) where_clause_opt ::= */ + { 188, -2 }, /* (185) where_clause_opt ::= WHERE search_condition */ + { 189, 0 }, /* (186) partition_by_clause_opt ::= */ + { 189, -3 }, /* (187) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 190, 0 }, /* (188) twindow_clause_opt ::= */ + { 190, -6 }, /* (189) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ + { 190, -4 }, /* (190) twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ + { 190, -6 }, /* (191) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 190, -8 }, /* (192) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 195, 0 }, /* (193) sliding_opt ::= */ + { 195, -4 }, /* (194) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 196, 0 }, /* (195) fill_opt ::= */ + { 196, -4 }, /* (196) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 196, -6 }, /* (197) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 197, -1 }, /* (198) fill_mode ::= NONE */ + { 197, -1 }, /* (199) fill_mode ::= PREV */ + { 197, -1 }, /* (200) fill_mode ::= NULL */ + { 197, -1 }, /* (201) fill_mode ::= LINEAR */ + { 197, -1 }, /* (202) fill_mode ::= NEXT */ + { 191, 0 }, /* (203) group_by_clause_opt ::= */ + { 191, -3 }, /* (204) group_by_clause_opt ::= GROUP BY group_by_list */ + { 198, -1 }, /* (205) group_by_list ::= expression */ + { 198, -3 }, /* (206) group_by_list ::= group_by_list NK_COMMA expression */ + { 192, 0 }, /* (207) having_clause_opt ::= */ + { 192, -2 }, /* (208) having_clause_opt ::= HAVING search_condition */ + { 159, -4 }, /* (209) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 199, -1 }, /* (210) query_expression_body ::= query_primary */ + { 199, -4 }, /* (211) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 203, -1 }, /* (212) query_primary ::= query_specification */ + { 200, 0 }, /* (213) order_by_clause_opt ::= */ + { 200, -3 }, /* (214) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 201, 0 }, /* (215) slimit_clause_opt ::= */ + { 201, -2 }, /* (216) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 201, -4 }, /* (217) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 201, -4 }, /* (218) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 202, 0 }, /* (219) limit_clause_opt ::= */ + { 202, -2 }, /* (220) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 202, -4 }, /* (221) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 202, -4 }, /* (222) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 168, -3 }, /* (223) subquery ::= NK_LP query_expression NK_RP */ + { 184, -1 }, /* (224) search_condition ::= common_expression */ + { 204, -1 }, /* (225) sort_specification_list ::= sort_specification */ + { 204, -3 }, /* (226) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 205, -3 }, /* (227) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 206, 0 }, /* (228) ordering_specification_opt ::= */ + { 206, -1 }, /* (229) ordering_specification_opt ::= ASC */ + { 206, -1 }, /* (230) ordering_specification_opt ::= DESC */ + { 207, 0 }, /* (231) null_ordering_opt ::= */ + { 207, -2 }, /* (232) null_ordering_opt ::= NULLS FIRST */ + { 207, -2 }, /* (233) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -1814,684 +1902,740 @@ static YYACTIONTYPE yy_reduce( */ /********** Begin reduce actions **********************************************/ YYMINORTYPE yylhsminor; - case 0: /* cmd ::= CREATE DATABASE exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy187, &yymsp[-1].minor.yy175, yymsp[0].minor.yy211);} + case 0: /* cmd ::= CREATE USER user_name PASS NK_STRING */ +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy0);} + break; + case 1: /* cmd ::= ALTER USER user_name PASS NK_STRING */ +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy161, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0);} break; - case 1: /* exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy187 = true; } + case 2: /* cmd ::= ALTER USER user_name PRIVILEGE NK_STRING */ +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy161, TSDB_ALTER_USER_PRIVILEGES, &yymsp[0].minor.yy0);} break; - case 2: /* exists_opt ::= */ - case 150: /* set_quantifier_opt ::= */ yytestcase(yyruleno==150); -{ yymsp[1].minor.yy187 = false; } + case 3: /* cmd ::= DROP USER user_name */ +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy161); } break; - case 3: /* db_options ::= */ -{ yymsp[1].minor.yy211 = createDefaultDatabaseOptions(pCxt); } - break; - case 4: /* db_options ::= db_options BLOCKS NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 4: /* cmd ::= SHOW USERS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); } break; - case 5: /* db_options ::= db_options CACHE NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 5: /* cmd ::= CREATE DNODE dnode_endpoint */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy161, NULL);} break; - case 6: /* db_options ::= db_options CACHELAST NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 6: /* cmd ::= CREATE DNODE dnode_host_name PORT NK_INTEGER */ +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy0);} break; - case 7: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; - break; - case 8: /* db_options ::= db_options DAYS NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; - break; - case 9: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; - break; - case 10: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; - break; - case 11: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; - break; - case 12: /* db_options ::= db_options KEEP NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 7: /* cmd ::= DROP DNODE NK_INTEGER */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0);} break; - case 13: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 8: /* cmd ::= DROP DNODE dnode_endpoint */ +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy161);} break; - case 14: /* db_options ::= db_options QUORUM NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 9: /* cmd ::= SHOW DNODES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } break; - case 15: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 10: /* dnode_endpoint ::= NK_STRING */ + case 11: /* dnode_host_name ::= NK_ID */ yytestcase(yyruleno==11); + case 12: /* dnode_host_name ::= NK_IPTOKEN */ yytestcase(yyruleno==12); + case 104: /* db_name ::= NK_ID */ yytestcase(yyruleno==104); + case 105: /* table_name ::= NK_ID */ yytestcase(yyruleno==105); + case 106: /* column_name ::= NK_ID */ yytestcase(yyruleno==106); + case 107: /* function_name ::= NK_ID */ yytestcase(yyruleno==107); + case 108: /* table_alias ::= NK_ID */ yytestcase(yyruleno==108); + case 109: /* column_alias ::= NK_ID */ yytestcase(yyruleno==109); + case 110: /* user_name ::= NK_ID */ yytestcase(yyruleno==110); +{ yylhsminor.yy161 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy161 = yylhsminor.yy161; break; - case 16: /* db_options ::= db_options TTL NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 13: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy377, &yymsp[-1].minor.yy161, yymsp[0].minor.yy103);} break; - case 17: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 14: /* cmd ::= DROP DATABASE exists_opt db_name */ +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy377, &yymsp[0].minor.yy161); } break; - case 18: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 15: /* cmd ::= SHOW DATABASES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; - case 19: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 16: /* cmd ::= USE db_name */ +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy161);} break; - case 20: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ -{ yylhsminor.yy211 = setDatabaseOption(pCxt, yymsp[-2].minor.yy211, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy211 = yylhsminor.yy211; + case 17: /* not_exists_opt ::= IF NOT EXISTS */ +{ yymsp[-2].minor.yy377 = true; } break; - case 21: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy175);} + case 18: /* not_exists_opt ::= */ + case 20: /* exists_opt ::= */ yytestcase(yyruleno==20); + case 173: /* set_quantifier_opt ::= */ yytestcase(yyruleno==173); +{ yymsp[1].minor.yy377 = false; } break; - case 22: /* cmd ::= CREATE TABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - case 24: /* cmd ::= CREATE STABLE exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==24); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy187, &yymsp[-5].minor.yy341, yymsp[-3].minor.yy182, yymsp[-1].minor.yy182, yymsp[0].minor.yy286);} + case 19: /* exists_opt ::= IF EXISTS */ +{ yymsp[-1].minor.yy377 = true; } break; - case 23: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy182);} + case 21: /* db_options ::= */ +{ yymsp[1].minor.yy103 = createDefaultDatabaseOptions(pCxt); } break; - case 25: /* multi_create_clause ::= create_subtable_clause */ - case 32: /* column_def_list ::= column_def */ yytestcase(yyruleno==32); - case 67: /* col_name_list ::= col_name */ yytestcase(yyruleno==67); - case 155: /* select_sublist ::= select_item */ yytestcase(yyruleno==155); - case 202: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==202); -{ yylhsminor.yy182 = createNodeList(pCxt, yymsp[0].minor.yy210); } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 22: /* db_options ::= db_options BLOCKS NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_BLOCKS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 26: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ -{ yylhsminor.yy182 = addNodeToList(pCxt, yymsp[-1].minor.yy182, yymsp[0].minor.yy210); } - yymsp[-1].minor.yy182 = yylhsminor.yy182; + case 23: /* db_options ::= db_options CACHE NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_CACHE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 27: /* create_subtable_clause ::= exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ -{ yylhsminor.yy210 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy187, &yymsp[-7].minor.yy341, &yymsp[-5].minor.yy341, yymsp[-4].minor.yy182, yymsp[-1].minor.yy182); } - yymsp[-8].minor.yy210 = yylhsminor.yy210; + case 24: /* db_options ::= db_options CACHELAST NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_CACHELAST, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 28: /* specific_tags_opt ::= */ - case 59: /* tags_def_opt ::= */ yytestcase(yyruleno==59); - case 163: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==163); - case 180: /* group_by_clause_opt ::= */ yytestcase(yyruleno==180); - case 190: /* order_by_clause_opt ::= */ yytestcase(yyruleno==190); -{ yymsp[1].minor.yy182 = NULL; } + case 25: /* db_options ::= db_options COMP NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 29: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182; } + case 26: /* db_options ::= db_options DAYS NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 30: /* full_table_name ::= NK_ID */ -{ STokenPair t = { .first = nil_token, .second = yymsp[0].minor.yy0 }; yylhsminor.yy341 = t; } - yymsp[0].minor.yy341 = yylhsminor.yy341; + case 27: /* db_options ::= db_options FSYNC NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 31: /* full_table_name ::= NK_ID NK_DOT NK_ID */ -{ STokenPair t = { .first = yymsp[-2].minor.yy0, .second = yymsp[0].minor.yy0 }; yylhsminor.yy341 = t; } - yymsp[-2].minor.yy341 = yylhsminor.yy341; + case 28: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 33: /* column_def_list ::= column_def_list NK_COMMA column_def */ - case 68: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==68); - case 156: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==156); - case 203: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==203); -{ yylhsminor.yy182 = addNodeToList(pCxt, yymsp[-2].minor.yy182, yymsp[0].minor.yy210); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 29: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 34: /* column_def ::= column_name type_name */ -{ yylhsminor.yy210 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy175, yymsp[0].minor.yy42, NULL); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + case 30: /* db_options ::= db_options KEEP NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 35: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy210 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy175, yymsp[-2].minor.yy42, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; + case 31: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 36: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_BOOL); } + case 32: /* db_options ::= db_options QUORUM NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_QUORUM, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 37: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_TINYINT); } + case 33: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 38: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_SMALLINT); } + case 34: /* db_options ::= db_options TTL NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 39: /* type_name ::= INT */ - case 40: /* type_name ::= INTEGER */ yytestcase(yyruleno==40); -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_INT); } + case 35: /* db_options ::= db_options WAL NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 41: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_BIGINT); } + case 36: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 42: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_FLOAT); } + case 37: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_SINGLESTABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 43: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_DOUBLE); } + case 38: /* db_options ::= db_options STREAM_MODE NK_INTEGER */ +{ yylhsminor.yy103 = setDatabaseOption(pCxt, yymsp[-2].minor.yy103, DB_OPTION_STREAMMODE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy103 = yylhsminor.yy103; break; - case 44: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy42 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } + case 39: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + case 41: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==41); +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy377, yymsp[-5].minor.yy392, yymsp[-3].minor.yy184, yymsp[-1].minor.yy184, yymsp[0].minor.yy334);} break; - case 45: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + case 40: /* cmd ::= CREATE TABLE multi_create_clause */ +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy184);} break; - case 46: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy42 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + case 42: /* cmd ::= DROP TABLE multi_drop_clause */ +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy184); } break; - case 47: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy42 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + case 43: /* cmd ::= SHOW TABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); } break; - case 48: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy42 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + case 44: /* cmd ::= SHOW STABLES */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STABLES_STMT); } break; - case 49: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy42 = createDataType(TSDB_DATA_TYPE_UINT); } + case 45: /* multi_create_clause ::= create_subtable_clause */ + case 48: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==48); + case 55: /* column_def_list ::= column_def */ yytestcase(yyruleno==55); + case 90: /* col_name_list ::= col_name */ yytestcase(yyruleno==90); + case 178: /* select_sublist ::= select_item */ yytestcase(yyruleno==178); + case 225: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==225); +{ yylhsminor.yy184 = createNodeList(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 50: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy42 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + case 46: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ + case 49: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==49); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-1].minor.yy184, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy184 = yylhsminor.yy184; break; - case 51: /* type_name ::= JSON */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_JSON); } + case 47: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_tags_opt TAGS NK_LP literal_list NK_RP */ +{ yylhsminor.yy392 = createCreateSubTableClause(pCxt, yymsp[-8].minor.yy377, yymsp[-7].minor.yy392, yymsp[-5].minor.yy392, yymsp[-4].minor.yy184, yymsp[-1].minor.yy184); } + yymsp[-8].minor.yy392 = yylhsminor.yy392; break; - case 52: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy42 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + case 50: /* drop_table_clause ::= exists_opt full_table_name */ +{ yylhsminor.yy392 = createDropTableClause(pCxt, yymsp[-1].minor.yy377, yymsp[0].minor.yy392); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 53: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + case 51: /* specific_tags_opt ::= */ + case 82: /* tags_def_opt ::= */ yytestcase(yyruleno==82); + case 186: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==186); + case 203: /* group_by_clause_opt ::= */ yytestcase(yyruleno==203); + case 213: /* order_by_clause_opt ::= */ yytestcase(yyruleno==213); +{ yymsp[1].minor.yy184 = NULL; } break; - case 54: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_BLOB); } + case 52: /* specific_tags_opt ::= NK_LP col_name_list NK_RP */ +{ yymsp[-2].minor.yy184 = yymsp[-1].minor.yy184; } break; - case 55: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy42 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + case 53: /* full_table_name ::= table_name */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy161, NULL); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 56: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy42 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 54: /* full_table_name ::= db_name NK_DOT table_name */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy161, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 57: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy42 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 56: /* column_def_list ::= column_def_list NK_COMMA column_def */ + case 91: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==91); + case 179: /* select_sublist ::= select_sublist NK_COMMA select_item */ yytestcase(yyruleno==179); + case 226: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==226); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, yymsp[0].minor.yy392); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 58: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy42 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + case 57: /* column_def ::= column_name type_name */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy161, yymsp[0].minor.yy240, NULL); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 60: /* tags_def_opt ::= tags_def */ - case 154: /* select_list ::= select_sublist */ yytestcase(yyruleno==154); -{ yylhsminor.yy182 = yymsp[0].minor.yy182; } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 58: /* column_def ::= column_name type_name COMMENT NK_STRING */ +{ yylhsminor.yy392 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy161, yymsp[-2].minor.yy240, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 61: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy182 = yymsp[-1].minor.yy182; } + case 59: /* type_name ::= BOOL */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_BOOL); } break; - case 62: /* table_options ::= */ -{ yymsp[1].minor.yy286 = createDefaultTableOptions(pCxt);} + case 60: /* type_name ::= TINYINT */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; - case 63: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy286 = setTableOption(pCxt, yymsp[-2].minor.yy286, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy286 = yylhsminor.yy286; + case 61: /* type_name ::= SMALLINT */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; - case 64: /* table_options ::= table_options KEEP NK_INTEGER */ -{ yylhsminor.yy286 = setTableOption(pCxt, yymsp[-2].minor.yy286, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy286 = yylhsminor.yy286; + case 62: /* type_name ::= INT */ + case 63: /* type_name ::= INTEGER */ yytestcase(yyruleno==63); +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_INT); } break; - case 65: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy286 = setTableOption(pCxt, yymsp[-2].minor.yy286, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy286 = yylhsminor.yy286; + case 64: /* type_name ::= BIGINT */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; - case 66: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy286 = setTableSmaOption(pCxt, yymsp[-4].minor.yy286, yymsp[-1].minor.yy182); } - yymsp[-4].minor.yy286 = yylhsminor.yy286; + case 65: /* type_name ::= FLOAT */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; - case 69: /* col_name ::= column_name */ -{ yylhsminor.yy210 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy175); } - yymsp[0].minor.yy210 = yylhsminor.yy210; + case 66: /* type_name ::= DOUBLE */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; - case 70: /* cmd ::= SHOW DATABASES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } + case 67: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy240 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; - case 71: /* cmd ::= SHOW TABLES */ -{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TABLES_STMT); } + case 68: /* type_name ::= TIMESTAMP */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } + break; + case 69: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy240 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } + break; + case 70: /* type_name ::= TINYINT UNSIGNED */ +{ yymsp[-1].minor.yy240 = createDataType(TSDB_DATA_TYPE_UTINYINT); } + break; + case 71: /* type_name ::= SMALLINT UNSIGNED */ +{ yymsp[-1].minor.yy240 = createDataType(TSDB_DATA_TYPE_USMALLINT); } + break; + case 72: /* type_name ::= INT UNSIGNED */ +{ yymsp[-1].minor.yy240 = createDataType(TSDB_DATA_TYPE_UINT); } + break; + case 73: /* type_name ::= BIGINT UNSIGNED */ +{ yymsp[-1].minor.yy240 = createDataType(TSDB_DATA_TYPE_UBIGINT); } + break; + case 74: /* type_name ::= JSON */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_JSON); } + break; + case 75: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy240 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } + break; + case 76: /* type_name ::= MEDIUMBLOB */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } + break; + case 77: /* type_name ::= BLOB */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_BLOB); } + break; + case 78: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy240 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } + break; + case 79: /* type_name ::= DECIMAL */ +{ yymsp[0].minor.yy240 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; - case 72: /* cmd ::= query_expression */ -{ pCxt->pRootNode = yymsp[0].minor.yy210; } - break; - case 73: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 74: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 75: /* literal ::= NK_STRING */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 76: /* literal ::= NK_BOOL */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 77: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; - break; - case 78: /* literal ::= duration_literal */ - case 88: /* expression ::= literal */ yytestcase(yyruleno==88); - case 89: /* expression ::= column_reference */ yytestcase(yyruleno==89); - case 92: /* expression ::= subquery */ yytestcase(yyruleno==92); - case 124: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==124); - case 128: /* boolean_primary ::= predicate */ yytestcase(yyruleno==128); - case 130: /* common_expression ::= expression */ yytestcase(yyruleno==130); - case 131: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==131); - case 133: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==133); - case 135: /* table_reference ::= table_primary */ yytestcase(yyruleno==135); - case 136: /* table_reference ::= joined_table */ yytestcase(yyruleno==136); - case 140: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==140); - case 187: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==187); - case 189: /* query_primary ::= query_specification */ yytestcase(yyruleno==189); -{ yylhsminor.yy210 = yymsp[0].minor.yy210; } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 79: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; - break; - case 80: /* literal_list ::= literal */ - case 101: /* expression_list ::= expression */ yytestcase(yyruleno==101); -{ yylhsminor.yy182 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy210)); } - yymsp[0].minor.yy182 = yylhsminor.yy182; - break; - case 81: /* literal_list ::= literal_list NK_COMMA literal */ - case 102: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==102); -{ yylhsminor.yy182 = addNodeToList(pCxt, yymsp[-2].minor.yy182, releaseRawExprNode(pCxt, yymsp[0].minor.yy210)); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; - break; - case 82: /* db_name ::= NK_ID */ - case 83: /* table_name ::= NK_ID */ yytestcase(yyruleno==83); - case 84: /* column_name ::= NK_ID */ yytestcase(yyruleno==84); - case 85: /* function_name ::= NK_ID */ yytestcase(yyruleno==85); - case 86: /* table_alias ::= NK_ID */ yytestcase(yyruleno==86); - case 87: /* column_alias ::= NK_ID */ yytestcase(yyruleno==87); -{ yylhsminor.yy175 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy175 = yylhsminor.yy175; - break; - case 90: /* expression ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy175, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy175, yymsp[-1].minor.yy182)); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; - break; - case 91: /* expression ::= function_name NK_LP NK_STAR NK_RP */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy175, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy175, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; - break; - case 93: /* expression ::= NK_LP expression NK_RP */ - case 129: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==129); -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy210)); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; - break; - case 94: /* expression ::= NK_PLUS expression */ + case 80: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ +{ yymsp[-3].minor.yy240 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 81: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy240 = createDataType(TSDB_DATA_TYPE_DECIMAL); } + break; + case 83: /* tags_def_opt ::= tags_def */ + case 177: /* select_list ::= select_sublist */ yytestcase(yyruleno==177); +{ yylhsminor.yy184 = yymsp[0].minor.yy184; } + yymsp[0].minor.yy184 = yylhsminor.yy184; + break; + case 84: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ +{ yymsp[-3].minor.yy184 = yymsp[-1].minor.yy184; } + break; + case 85: /* table_options ::= */ +{ yymsp[1].minor.yy334 = createDefaultTableOptions(pCxt);} + break; + case 86: /* table_options ::= table_options COMMENT NK_STRING */ +{ yylhsminor.yy334 = setTableOption(pCxt, yymsp[-2].minor.yy334, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; + break; + case 87: /* table_options ::= table_options KEEP NK_INTEGER */ +{ yylhsminor.yy334 = setTableOption(pCxt, yymsp[-2].minor.yy334, TABLE_OPTION_KEEP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; + break; + case 88: /* table_options ::= table_options TTL NK_INTEGER */ +{ yylhsminor.yy334 = setTableOption(pCxt, yymsp[-2].minor.yy334, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy334 = yylhsminor.yy334; + break; + case 89: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ +{ yylhsminor.yy334 = setTableSmaOption(pCxt, yymsp[-4].minor.yy334, yymsp[-1].minor.yy184); } + yymsp[-4].minor.yy334 = yylhsminor.yy334; + break; + case 92: /* col_name ::= column_name */ +{ yylhsminor.yy392 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy161); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 93: /* cmd ::= SHOW VGROUPS */ +{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT); } + break; + case 94: /* cmd ::= query_expression */ +{ pCxt->pRootNode = yymsp[0].minor.yy392; } + break; + case 95: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 96: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 97: /* literal ::= NK_STRING */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 98: /* literal ::= NK_BOOL */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 99: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; + break; + case 100: /* literal ::= duration_literal */ + case 111: /* expression ::= literal */ yytestcase(yyruleno==111); + case 112: /* expression ::= column_reference */ yytestcase(yyruleno==112); + case 115: /* expression ::= subquery */ yytestcase(yyruleno==115); + case 147: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==147); + case 151: /* boolean_primary ::= predicate */ yytestcase(yyruleno==151); + case 153: /* common_expression ::= expression */ yytestcase(yyruleno==153); + case 154: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==154); + case 156: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==156); + case 158: /* table_reference ::= table_primary */ yytestcase(yyruleno==158); + case 159: /* table_reference ::= joined_table */ yytestcase(yyruleno==159); + case 163: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==163); + case 210: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==210); + case 212: /* query_primary ::= query_specification */ yytestcase(yyruleno==212); +{ yylhsminor.yy392 = yymsp[0].minor.yy392; } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 101: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; + break; + case 102: /* literal_list ::= literal */ + case 124: /* expression_list ::= expression */ yytestcase(yyruleno==124); +{ yylhsminor.yy184 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[0].minor.yy184 = yylhsminor.yy184; + break; + case 103: /* literal_list ::= literal_list NK_COMMA literal */ + case 125: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==125); +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; + break; + case 113: /* expression ::= function_name NK_LP expression_list NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy161, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy161, yymsp[-1].minor.yy184)); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; + break; + case 114: /* expression ::= function_name NK_LP NK_STAR NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy161, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy161, createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy0)))); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; + break; + case 116: /* expression ::= NK_LP expression NK_RP */ + case 152: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==152); +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; + break; + case 117: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy210)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy392)); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 95: /* expression ::= NK_MINUS expression */ + case 118: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy210), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 96: /* expression ::= expression NK_PLUS expression */ + case 119: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 97: /* expression ::= expression NK_MINUS expression */ + case 120: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 98: /* expression ::= expression NK_STAR expression */ + case 121: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 99: /* expression ::= expression NK_SLASH expression */ + case 122: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 100: /* expression ::= expression NK_REM expression */ + case 123: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MOD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 103: /* column_reference ::= column_name */ -{ yylhsminor.yy210 = createRawExprNode(pCxt, &yymsp[0].minor.yy175, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy175)); } - yymsp[0].minor.yy210 = yylhsminor.yy210; + case 126: /* column_reference ::= column_name */ +{ yylhsminor.yy392 = createRawExprNode(pCxt, &yymsp[0].minor.yy161, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy161)); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 104: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy175, &yymsp[0].minor.yy175, createColumnNode(pCxt, &yymsp[-2].minor.yy175, &yymsp[0].minor.yy175)); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 127: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy161, createColumnNode(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy161)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 105: /* predicate ::= expression compare_op expression */ - case 110: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==110); + case 128: /* predicate ::= expression compare_op expression */ + case 133: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==133); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy140, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy220, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 106: /* predicate ::= expression BETWEEN expression AND expression */ + case 129: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy210), releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy392), releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-4].minor.yy210 = yylhsminor.yy210; + yymsp[-4].minor.yy392 = yylhsminor.yy392; break; - case 107: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 130: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[-5].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[-5].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-5].minor.yy210 = yylhsminor.yy210; + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 108: /* predicate ::= expression IS NULL */ + case 131: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), NULL)); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 109: /* predicate ::= expression IS NOT NULL */ + case 132: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy210), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), NULL)); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 111: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_THAN; } + case 134: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy220 = OP_TYPE_LOWER_THAN; } break; - case 112: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_THAN; } + case 135: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy220 = OP_TYPE_GREATER_THAN; } break; - case 113: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_EQUAL; } + case 136: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy220 = OP_TYPE_LOWER_EQUAL; } break; - case 114: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_EQUAL; } + case 137: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy220 = OP_TYPE_GREATER_EQUAL; } break; - case 115: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy140 = OP_TYPE_NOT_EQUAL; } + case 138: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy220 = OP_TYPE_NOT_EQUAL; } break; - case 116: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy140 = OP_TYPE_EQUAL; } + case 139: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy220 = OP_TYPE_EQUAL; } break; - case 117: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy140 = OP_TYPE_LIKE; } + case 140: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy220 = OP_TYPE_LIKE; } break; - case 118: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_LIKE; } + case 141: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy220 = OP_TYPE_NOT_LIKE; } break; - case 119: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy140 = OP_TYPE_MATCH; } + case 142: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy220 = OP_TYPE_MATCH; } break; - case 120: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy140 = OP_TYPE_NMATCH; } + case 143: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy220 = OP_TYPE_NMATCH; } break; - case 121: /* in_op ::= IN */ -{ yymsp[0].minor.yy140 = OP_TYPE_IN; } + case 144: /* in_op ::= IN */ +{ yymsp[0].minor.yy220 = OP_TYPE_IN; } break; - case 122: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_IN; } + case 145: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy220 = OP_TYPE_NOT_IN; } break; - case 123: /* in_predicate_value ::= NK_LP expression_list NK_RP */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy182)); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 146: /* in_predicate_value ::= NK_LP expression_list NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy184)); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 125: /* boolean_value_expression ::= NOT boolean_primary */ + case 148: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy210), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), NULL)); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 126: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 149: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 127: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 150: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy210); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy392); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 132: /* from_clause ::= FROM table_reference_list */ - case 162: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==162); - case 185: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==185); -{ yymsp[-1].minor.yy210 = yymsp[0].minor.yy210; } + case 155: /* from_clause ::= FROM table_reference_list */ + case 185: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==185); + case 208: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==208); +{ yymsp[-1].minor.yy392 = yymsp[0].minor.yy392; } break; - case 134: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy210 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy210, yymsp[0].minor.yy210, NULL); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 157: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy392, yymsp[0].minor.yy392, NULL); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 137: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy210 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy175, &yymsp[0].minor.yy175); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + case 160: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy161, &yymsp[0].minor.yy161); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 138: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy210 = createRealTableNode(pCxt, &yymsp[-3].minor.yy175, &yymsp[-1].minor.yy175, &yymsp[0].minor.yy175); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; + case 161: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy392 = createRealTableNode(pCxt, &yymsp[-3].minor.yy161, &yymsp[-1].minor.yy161, &yymsp[0].minor.yy161); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 139: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy210 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy210), &yymsp[0].minor.yy175); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + case 162: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy392 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy161); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 141: /* alias_opt ::= */ -{ yymsp[1].minor.yy175 = nil_token; } + case 164: /* alias_opt ::= */ +{ yymsp[1].minor.yy161 = nil_token; } break; - case 142: /* alias_opt ::= table_alias */ -{ yylhsminor.yy175 = yymsp[0].minor.yy175; } - yymsp[0].minor.yy175 = yylhsminor.yy175; + case 165: /* alias_opt ::= table_alias */ +{ yylhsminor.yy161 = yymsp[0].minor.yy161; } + yymsp[0].minor.yy161 = yylhsminor.yy161; break; - case 143: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy175 = yymsp[0].minor.yy175; } + case 166: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy161 = yymsp[0].minor.yy161; } break; - case 144: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 145: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==145); -{ yymsp[-2].minor.yy210 = yymsp[-1].minor.yy210; } + case 167: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 168: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==168); +{ yymsp[-2].minor.yy392 = yymsp[-1].minor.yy392; } break; - case 146: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy210 = createJoinTableNode(pCxt, yymsp[-4].minor.yy28, yymsp[-5].minor.yy210, yymsp[-2].minor.yy210, yymsp[0].minor.yy210); } - yymsp[-5].minor.yy210 = yylhsminor.yy210; + case 169: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy392 = createJoinTableNode(pCxt, yymsp[-4].minor.yy308, yymsp[-5].minor.yy392, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-5].minor.yy392 = yylhsminor.yy392; break; - case 147: /* join_type ::= */ -{ yymsp[1].minor.yy28 = JOIN_TYPE_INNER; } + case 170: /* join_type ::= */ +{ yymsp[1].minor.yy308 = JOIN_TYPE_INNER; } break; - case 148: /* join_type ::= INNER */ -{ yymsp[0].minor.yy28 = JOIN_TYPE_INNER; } + case 171: /* join_type ::= INNER */ +{ yymsp[0].minor.yy308 = JOIN_TYPE_INNER; } break; - case 149: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 172: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause where_clause_opt partition_by_clause_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-8].minor.yy210 = createSelectStmt(pCxt, yymsp[-7].minor.yy187, yymsp[-6].minor.yy182, yymsp[-5].minor.yy210); - yymsp[-8].minor.yy210 = addWhereClause(pCxt, yymsp[-8].minor.yy210, yymsp[-4].minor.yy210); - yymsp[-8].minor.yy210 = addPartitionByClause(pCxt, yymsp[-8].minor.yy210, yymsp[-3].minor.yy182); - yymsp[-8].minor.yy210 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy210, yymsp[-2].minor.yy210); - yymsp[-8].minor.yy210 = addGroupByClause(pCxt, yymsp[-8].minor.yy210, yymsp[-1].minor.yy182); - yymsp[-8].minor.yy210 = addHavingClause(pCxt, yymsp[-8].minor.yy210, yymsp[0].minor.yy210); + yymsp[-8].minor.yy392 = createSelectStmt(pCxt, yymsp[-7].minor.yy377, yymsp[-6].minor.yy184, yymsp[-5].minor.yy392); + yymsp[-8].minor.yy392 = addWhereClause(pCxt, yymsp[-8].minor.yy392, yymsp[-4].minor.yy392); + yymsp[-8].minor.yy392 = addPartitionByClause(pCxt, yymsp[-8].minor.yy392, yymsp[-3].minor.yy184); + yymsp[-8].minor.yy392 = addWindowClauseClause(pCxt, yymsp[-8].minor.yy392, yymsp[-2].minor.yy392); + yymsp[-8].minor.yy392 = addGroupByClause(pCxt, yymsp[-8].minor.yy392, yymsp[-1].minor.yy184); + yymsp[-8].minor.yy392 = addHavingClause(pCxt, yymsp[-8].minor.yy392, yymsp[0].minor.yy392); } break; - case 151: /* set_quantifier_opt ::= DISTINCT */ -{ yymsp[0].minor.yy187 = true; } + case 174: /* set_quantifier_opt ::= DISTINCT */ +{ yymsp[0].minor.yy377 = true; } break; - case 152: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy187 = false; } + case 175: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy377 = false; } break; - case 153: /* select_list ::= NK_STAR */ -{ yymsp[0].minor.yy182 = NULL; } + case 176: /* select_list ::= NK_STAR */ +{ yymsp[0].minor.yy184 = NULL; } break; - case 157: /* select_item ::= common_expression */ + case 180: /* select_item ::= common_expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy210); - yylhsminor.yy210 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy210), &t); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy392); + yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392), &t); } - yymsp[0].minor.yy210 = yylhsminor.yy210; + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 158: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy210 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy210), &yymsp[0].minor.yy175); } - yymsp[-1].minor.yy210 = yylhsminor.yy210; + case 181: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392), &yymsp[0].minor.yy161); } + yymsp[-1].minor.yy392 = yylhsminor.yy392; break; - case 159: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy210 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), &yymsp[0].minor.yy175); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 182: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy392 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), &yymsp[0].minor.yy161); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 160: /* select_item ::= table_name NK_DOT NK_STAR */ -{ yylhsminor.yy210 = createColumnNode(pCxt, &yymsp[-2].minor.yy175, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 183: /* select_item ::= table_name NK_DOT NK_STAR */ +{ yylhsminor.yy392 = createColumnNode(pCxt, &yymsp[-2].minor.yy161, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 161: /* where_clause_opt ::= */ - case 165: /* twindow_clause_opt ::= */ yytestcase(yyruleno==165); - case 170: /* sliding_opt ::= */ yytestcase(yyruleno==170); - case 172: /* fill_opt ::= */ yytestcase(yyruleno==172); - case 184: /* having_clause_opt ::= */ yytestcase(yyruleno==184); - case 192: /* slimit_clause_opt ::= */ yytestcase(yyruleno==192); - case 196: /* limit_clause_opt ::= */ yytestcase(yyruleno==196); -{ yymsp[1].minor.yy210 = NULL; } + case 184: /* where_clause_opt ::= */ + case 188: /* twindow_clause_opt ::= */ yytestcase(yyruleno==188); + case 193: /* sliding_opt ::= */ yytestcase(yyruleno==193); + case 195: /* fill_opt ::= */ yytestcase(yyruleno==195); + case 207: /* having_clause_opt ::= */ yytestcase(yyruleno==207); + case 215: /* slimit_clause_opt ::= */ yytestcase(yyruleno==215); + case 219: /* limit_clause_opt ::= */ yytestcase(yyruleno==219); +{ yymsp[1].minor.yy392 = NULL; } break; - case 164: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 181: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==181); - case 191: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==191); -{ yymsp[-2].minor.yy182 = yymsp[0].minor.yy182; } + case 187: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 204: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==204); + case 214: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==214); +{ yymsp[-2].minor.yy184 = yymsp[0].minor.yy184; } break; - case 166: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy210 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy210), &yymsp[-1].minor.yy0); } + case 189: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA NK_INTEGER NK_RP */ +{ yymsp[-5].minor.yy392 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy392), &yymsp[-1].minor.yy0); } break; - case 167: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ -{ yymsp[-3].minor.yy210 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy210)); } + case 190: /* twindow_clause_opt ::= STATE_WINDOW NK_LP column_reference NK_RP */ +{ yymsp[-3].minor.yy392 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy392)); } break; - case 168: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy210 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy210, NULL, yymsp[-1].minor.yy210, yymsp[0].minor.yy210); } + case 191: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy392 = createIntervalWindowNode(pCxt, yymsp[-3].minor.yy392, NULL, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 169: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy210 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy210, yymsp[-3].minor.yy210, yymsp[-1].minor.yy210, yymsp[0].minor.yy210); } + case 192: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy392 = createIntervalWindowNode(pCxt, yymsp[-5].minor.yy392, yymsp[-3].minor.yy392, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); } break; - case 171: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ -{ yymsp[-3].minor.yy210 = yymsp[-1].minor.yy210; } + case 194: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ +{ yymsp[-3].minor.yy392 = yymsp[-1].minor.yy392; } break; - case 173: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy210 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); } + case 196: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy392 = createFillNode(pCxt, yymsp[-1].minor.yy166, NULL); } break; - case 174: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy210 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy182)); } + case 197: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy392 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy184)); } break; - case 175: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy102 = FILL_MODE_NONE; } + case 198: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy166 = FILL_MODE_NONE; } break; - case 176: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy102 = FILL_MODE_PREV; } + case 199: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy166 = FILL_MODE_PREV; } break; - case 177: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy102 = FILL_MODE_NULL; } + case 200: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy166 = FILL_MODE_NULL; } break; - case 178: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy102 = FILL_MODE_LINEAR; } + case 201: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy166 = FILL_MODE_LINEAR; } break; - case 179: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy102 = FILL_MODE_NEXT; } + case 202: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy166 = FILL_MODE_NEXT; } break; - case 182: /* group_by_list ::= expression */ -{ yylhsminor.yy182 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); } - yymsp[0].minor.yy182 = yylhsminor.yy182; + case 205: /* group_by_list ::= expression */ +{ yylhsminor.yy184 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[0].minor.yy184 = yylhsminor.yy184; break; - case 183: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy182 = addNodeToList(pCxt, yymsp[-2].minor.yy182, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy210))); } - yymsp[-2].minor.yy182 = yylhsminor.yy182; + case 206: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy184 = addNodeToList(pCxt, yymsp[-2].minor.yy184, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy392))); } + yymsp[-2].minor.yy184 = yylhsminor.yy184; break; - case 186: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 209: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy210 = addOrderByClause(pCxt, yymsp[-3].minor.yy210, yymsp[-2].minor.yy182); - yylhsminor.yy210 = addSlimitClause(pCxt, yylhsminor.yy210, yymsp[-1].minor.yy210); - yylhsminor.yy210 = addLimitClause(pCxt, yylhsminor.yy210, yymsp[0].minor.yy210); + yylhsminor.yy392 = addOrderByClause(pCxt, yymsp[-3].minor.yy392, yymsp[-2].minor.yy184); + yylhsminor.yy392 = addSlimitClause(pCxt, yylhsminor.yy392, yymsp[-1].minor.yy392); + yylhsminor.yy392 = addLimitClause(pCxt, yylhsminor.yy392, yymsp[0].minor.yy392); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 188: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy210 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy210, yymsp[0].minor.yy210); } - yymsp[-3].minor.yy210 = yylhsminor.yy210; + case 211: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy392 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy392, yymsp[0].minor.yy392); } + yymsp[-3].minor.yy392 = yylhsminor.yy392; break; - case 193: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 197: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==197); -{ yymsp[-1].minor.yy210 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 216: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 220: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==220); +{ yymsp[-1].minor.yy392 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 194: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 198: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==198); -{ yymsp[-3].minor.yy210 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 217: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 221: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==221); +{ yymsp[-3].minor.yy392 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 195: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 199: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==199); -{ yymsp[-3].minor.yy210 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 218: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 222: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==222); +{ yymsp[-3].minor.yy392 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 200: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy210 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy210); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 223: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy392 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy392); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 201: /* search_condition ::= common_expression */ -{ yylhsminor.yy210 = releaseRawExprNode(pCxt, yymsp[0].minor.yy210); } - yymsp[0].minor.yy210 = yylhsminor.yy210; + case 224: /* search_condition ::= common_expression */ +{ yylhsminor.yy392 = releaseRawExprNode(pCxt, yymsp[0].minor.yy392); } + yymsp[0].minor.yy392 = yylhsminor.yy392; break; - case 204: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy210 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy210), yymsp[-1].minor.yy29, yymsp[0].minor.yy307); } - yymsp[-2].minor.yy210 = yylhsminor.yy210; + case 227: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy392 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy392), yymsp[-1].minor.yy162, yymsp[0].minor.yy9); } + yymsp[-2].minor.yy392 = yylhsminor.yy392; break; - case 205: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy29 = ORDER_ASC; } + case 228: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy162 = ORDER_ASC; } break; - case 206: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy29 = ORDER_ASC; } + case 229: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy162 = ORDER_ASC; } break; - case 207: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy29 = ORDER_DESC; } + case 230: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy162 = ORDER_DESC; } break; - case 208: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy307 = NULL_ORDER_DEFAULT; } + case 231: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy9 = NULL_ORDER_DEFAULT; } break; - case 209: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy307 = NULL_ORDER_FIRST; } + case 232: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy9 = NULL_ORDER_FIRST; } break; - case 210: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy307 = NULL_ORDER_LAST; } + case 233: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy9 = NULL_ORDER_LAST; } break; default: break; @@ -2555,18 +2699,9 @@ static void yy_syntax_error( /************ Begin %syntax_error code ****************************************/ if(TOKEN.z) { - char msg[] = "syntax error near \"%s\""; - int32_t sqlLen = strlen(&TOKEN.z[0]); - - if (sqlLen + sizeof(msg)/sizeof(msg[0]) + 1 > pCxt->pQueryCxt->msgLen) { - char tmpstr[128] = {0}; - memcpy(tmpstr, &TOKEN.z[0], sizeof(tmpstr)/sizeof(tmpstr[0]) - 1); - sprintf(pCxt->pQueryCxt->pMsg, msg, tmpstr); - } else { - sprintf(pCxt->pQueryCxt->pMsg, msg, &TOKEN.z[0]); - } + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z); } else { - sprintf(pCxt->pQueryCxt->pMsg, "Incomplete SQL statement"); + generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL); } pCxt->valid = false; /************ End %syntax_error code ******************************************/ diff --git a/source/libs/parser/src/parserUtil.c b/source/libs/parser/src/parserUtil.c index 8a9d071a53e3e9dd9bf7b37b7a0c7114c6cd7319..73e62edc3c8f46c7cd3a707690e12e423e0fb0cd 100644 --- a/source/libs/parser/src/parserUtil.c +++ b/source/libs/parser/src/parserUtil.c @@ -15,6 +15,63 @@ #include "parserUtil.h" +static char* getSyntaxErrFormat(int32_t errCode) { + switch (errCode) { + case TSDB_CODE_PAR_SYNTAX_ERROR: + return "syntax error near \"%s\""; + case TSDB_CODE_PAR_INCOMPLETE_SQL: + return "Incomplete SQL statement"; + case TSDB_CODE_PAR_INVALID_COLUMN: + return "Invalid column name : %s"; + case TSDB_CODE_PAR_TABLE_NOT_EXIST: + return "Table does not exist : %s"; + case TSDB_CODE_PAR_AMBIGUOUS_COLUMN: + return "Column ambiguously defined : %s"; + case TSDB_CODE_PAR_WRONG_VALUE_TYPE: + return "Invalid value type : %s"; + case TSDB_CODE_PAR_INVALID_FUNTION: + return "Invalid function name : %s"; + case TSDB_CODE_PAR_FUNTION_PARA_NUM: + return "Invalid number of arguments : %s"; + case TSDB_CODE_PAR_FUNTION_PARA_TYPE: + return "Inconsistent datatypes : %s"; + case TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION: + return "There mustn't be aggregation"; + case TSDB_CODE_PAR_WRONG_NUMBER_OF_SELECT: + return "ORDER BY item must be the number of a SELECT-list expression"; + case TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION: + return "Not a GROUP BY expression"; + case TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION: + return "Not SELECTed expression"; + case TSDB_CODE_PAR_NOT_SINGLE_GROUP: + return "Not a single-group group function"; + case TSDB_CODE_PAR_TAGS_NOT_MATCHED: + return "tags number not matched"; + case TSDB_CODE_PAR_INVALID_TAG_NAME: + return "invalid tag name : %s"; + case TSDB_CODE_PAR_NAME_OR_PASSWD_TOO_LONG: + return "name or password too long"; + case TSDB_CODE_PAR_PASSWD_EMPTY: + return "password can not be empty"; + case TSDB_CODE_PAR_INVALID_PORT: + return "port should be an integer that is less than 65535 and greater than 0"; + case TSDB_CODE_PAR_INVALID_ENDPOINT: + return "endpoint should be in the format of 'fqdn:port'"; + case TSDB_CODE_OUT_OF_MEMORY: + return "Out of memory"; + default: + return "Unknown error"; + } +} + +int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...) { + va_list vArgList; + va_start(vArgList, errCode); + vsnprintf(pBuf->buf, pBuf->len, getSyntaxErrFormat(errCode), vArgList); + va_end(vArgList); + return errCode; +} + int32_t buildInvalidOperationMsg(SMsgBuf* pBuf, const char* msg) { strncpy(pBuf->buf, msg, pBuf->len); return TSDB_CODE_TSC_INVALID_OPERATION; diff --git a/source/libs/parser/src/ttokenizer.c b/source/libs/parser/src/ttokenizer.c index 097620a50b79f4dda529741220b31c0b98cfdb9e..b6435e95ad6d1a44bda78bf8fa98cc50cb88682a 100644 --- a/source/libs/parser/src/ttokenizer.c +++ b/source/libs/parser/src/ttokenizer.c @@ -30,6 +30,7 @@ typedef struct SKeyword { // keywords in sql string static SKeyword keywordTable[] = { {"ALL", TK_ALL}, + {"ALTER", TK_ALTER}, {"AND", TK_AND}, {"AS", TK_AS}, {"ASC", TK_ASC}, @@ -49,7 +50,10 @@ static SKeyword keywordTable[] = { {"DAYS", TK_DAYS}, {"DESC", TK_DESC}, {"DISTINCT", TK_DISTINCT}, + {"DNODE", TK_DNODE}, + {"DNODES", TK_DNODES}, {"DOUBLE", TK_DOUBLE}, + {"DROP", TK_DROP}, {"EXISTS", TK_EXISTS}, // {"FILE", TK_FILE}, {"FILL", TK_FILL}, @@ -85,11 +89,14 @@ static SKeyword keywordTable[] = { {"NOW", TK_NOW}, {"NULL", TK_NULL}, {"OFFSET", TK_OFFSET}, - {"PRECISION", TK_PRECISION}, - {"PREV", TK_PREV}, {"ON", TK_ON}, {"OR", TK_OR}, {"ORDER", TK_ORDER}, + {"PASS", TK_PASS}, + {"PORT", TK_PORT}, + {"PRECISION", TK_PRECISION}, + {"PRIVILEGE", TK_PRIVILEGE}, + {"PREV", TK_PREV}, {"QUORUM", TK_QUORUM}, {"REPLICA", TK_REPLICA}, {"SELECT", TK_SELECT}, @@ -102,6 +109,7 @@ static SKeyword keywordTable[] = { {"SMALLINT", TK_SMALLINT}, {"SOFFSET", TK_SOFFSET}, {"STABLE", TK_STABLE}, + {"STABLES", TK_STABLES}, {"STATE_WINDOW", TK_STATE_WINDOW}, {"STREAM_MODE", TK_STREAM_MODE}, {"TABLE", TK_TABLE}, @@ -113,6 +121,8 @@ static SKeyword keywordTable[] = { {"UNION", TK_UNION}, {"UNSIGNED", TK_UNSIGNED}, {"USE", TK_USE}, + {"USER", TK_USER}, + {"USERS", TK_USERS}, {"USING", TK_USING}, {"VALUES", TK_VALUES}, {"VARCHAR", TK_VARCHAR}, @@ -145,9 +155,7 @@ static SKeyword keywordTable[] = { // {"UPLUS", TK_UPLUS}, // {"BITNOT", TK_BITNOT}, // {"MNODES", TK_MNODES}, - // {"DNODES", TK_DNODES}, // {"ACCOUNTS", TK_ACCOUNTS}, - // {"USERS", TK_USERS}, // {"MODULES", TK_MODULES}, // {"QUERIES", TK_QUERIES}, // {"CONNECTIONS", TK_CONNECTIONS}, @@ -156,16 +164,9 @@ static SKeyword keywordTable[] = { // {"SCORES", TK_SCORES}, // {"GRANTS", TK_GRANTS}, // {"DOT", TK_DOT}, - // {"STABLES", TK_STABLES}, - // {"DROP", TK_DROP}, - // {"DNODE", TK_DNODE}, - // {"USER", TK_USER}, // {"ACCOUNT", TK_ACCOUNT}, // {"DESCRIBE", TK_DESCRIBE}, // {"SYNCDB", TK_SYNCDB}, - // {"ALTER", TK_ALTER}, - // {"PASS", TK_PASS}, - // {"PRIVILEGE", TK_PRIVILEGE}, // {"LOCAL", TK_LOCAL}, // {"PPS", TK_PPS}, // {"TSERIES", TK_TSERIES}, @@ -235,7 +236,6 @@ static SKeyword keywordTable[] = { // {"OUTPUTTYPE", TK_OUTPUTTYPE}, // {"AGGREGATE", TK_AGGREGATE}, // {"BUFSIZE", TK_BUFSIZE}, - // {"PORT", TK_PORT}, // {"MODE", TK_MODE}, }; @@ -330,7 +330,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { return 1; } case ';': { - *tokenId = TK_SEMI; + *tokenId = TK_NK_SEMI; return 1; } case '+': { @@ -537,7 +537,7 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) { } if (seg == 4) { // ip address - *tokenId = TK_IPTOKEN; + *tokenId = TK_NK_IPTOKEN; return i; } @@ -648,7 +648,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr) { #endif } - if (t0.type == TK_SEMI) { + if (t0.type == TK_NK_SEMI) { t0.n = 0; return t0; } diff --git a/source/libs/parser/test/mockCatalog.cpp b/source/libs/parser/test/mockCatalog.cpp index 8bf77bdaa98aef4d1e977044dc20ef1c08a9491e..88ce767eacaa5c4f02aecd2a52c42e24f4dee465 100644 --- a/source/libs/parser/test/mockCatalog.cpp +++ b/source/libs/parser/test/mockCatalog.cpp @@ -37,8 +37,8 @@ void generateTestT1(MockCatalogService* mcs) { void generateTestST1(MockCatalogService* mcs) { ITableBuilder& builder = mcs->createTableBuilder("test", "st1", TSDB_SUPER_TABLE, 3, 2) .setPrecision(TSDB_TIME_PRECISION_MILLI).addColumn("ts", TSDB_DATA_TYPE_TIMESTAMP) - .addTag("tag1", TSDB_DATA_TYPE_INT).addTag("tag2", TSDB_DATA_TYPE_BINARY, 20) - .addColumn("c1", TSDB_DATA_TYPE_INT).addColumn("c2", TSDB_DATA_TYPE_BINARY, 20); + .addColumn("c1", TSDB_DATA_TYPE_INT).addColumn("c2", TSDB_DATA_TYPE_BINARY, 20) + .addTag("tag1", TSDB_DATA_TYPE_INT).addTag("tag2", TSDB_DATA_TYPE_BINARY, 20); builder.done(); mcs->createSubTable("test", "st1", "st1s1", 1); mcs->createSubTable("test", "st1", "st1s2", 2); @@ -62,6 +62,10 @@ int32_t __catalogGetTableDistVgInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pM return mockCatalogService->catalogGetTableDistVgInfo(pTableName, pVgList); } +int32_t __catalogGetDBVgVersion(SCatalog* pCtg, const char* dbFName, int32_t* version, int64_t* dbId, int32_t *tableNum) { + return 0; +} + void initMetaDataEnv() { mockCatalogService.reset(new MockCatalogService()); @@ -102,6 +106,14 @@ void initMetaDataEnv() { stub.set(f.second, __catalogGetTableDistVgInfo); } } + { + AddrAny any("libcatalog.so"); + std::map result; + any.get_global_func_addr_dynsym("^catalogGetDBVgVersion$", result); + for (const auto& f : result) { + stub.set(f.second, __catalogGetDBVgVersion); + } + } } void generateMetaData() { diff --git a/source/libs/parser/test/mockCatalogService.cpp b/source/libs/parser/test/mockCatalogService.cpp index 40d8fbc672d25a5e7d4e2f7561f90c331bbb5d40..b025426c87bc994b510d1ecc13fcc5bb42bd9366 100644 --- a/source/libs/parser/test/mockCatalogService.cpp +++ b/source/libs/parser/test/mockCatalogService.cpp @@ -113,6 +113,7 @@ public: const char* tname = tNameGetTableName(pTableName); int32_t code = copyTableSchemaMeta(db, tname, &table); if (TSDB_CODE_SUCCESS != code) { + std::cout << "db : " << db << ", table :" << tname << std::endl; return code; } *pTableMeta = table.release(); diff --git a/source/libs/parser/test/parserTest.cpp b/source/libs/parser/test/parserTest.cpp index 6bf32bb93a04b65329e2acd689dffa3e727e839f..d154ed09a8dd07687f29454763a3d484fc572da4 100644 --- a/source/libs/parser/test/parserTest.cpp +++ b/source/libs/parser/test/parserTest.cpp @@ -281,7 +281,26 @@ TEST_F(ParserTest, selectSemanticError) { ASSERT_TRUE(run(TSDB_CODE_SUCCESS, TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION)); } +TEST_F(ParserTest, createUser) { + setDatabase("root", "test"); + + bind("create user wxy pass '123456'"); + ASSERT_TRUE(run()); +} + +TEST_F(ParserTest, createDnode) { + setDatabase("root", "test"); + + bind("create dnode abc1 port 7000"); + ASSERT_TRUE(run()); + + bind("create dnode 1.1.1.1 port 9000"); + ASSERT_TRUE(run()); +} + TEST_F(ParserTest, createDatabase) { + setDatabase("root", "test"); + bind("create database wxy_db"); ASSERT_TRUE(run()); @@ -308,16 +327,22 @@ TEST_F(ParserTest, createDatabase) { } TEST_F(ParserTest, showDatabase) { + setDatabase("root", "test"); + bind("show databases"); ASSERT_TRUE(run()); } TEST_F(ParserTest, useDatabase) { + setDatabase("root", "test"); + bind("use wxy_db"); ASSERT_TRUE(run()); } TEST_F(ParserTest, createTable) { + setDatabase("root", "test"); + bind("create table t1(ts timestamp, c1 int)"); ASSERT_TRUE(run()); @@ -337,13 +362,13 @@ TEST_F(ParserTest, createTable) { ); ASSERT_TRUE(run()); - bind("create table if not exists t1 using st1 tags(1)"); + bind("create table if not exists t1 using st1 tags(1, 'wxy')"); ASSERT_TRUE(run()); bind("create table " - "if not exists test.t1 using test.st1 (tc1, tc2, tc3) tags(1, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23') " - "if not exists test.t2 using test.st1 (tc1, tc2, tc3) tags(2, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23') " - "if not exists test.t3 using test.st1 (tc1, tc2, tc3) tags(3, 2.0, 'abc', TIMESTAMP '2022-3-6 11:20:23')" + "if not exists test.t1 using test.st1 (tag1, tag2) tags(1, 'abc') " + "if not exists test.t2 using test.st1 (tag1, tag2) tags(2, 'abc') " + "if not exists test.t3 using test.st1 (tag1, tag2) tags(3, 'abc')" ); ASSERT_TRUE(run());