提交 8305f7e4 编写于 作者: L Liu Jicong

Merge branch '3.0' into feature/tq

...@@ -14,3 +14,6 @@ ...@@ -14,3 +14,6 @@
path = tests path = tests
url = https://github.com/taosdata/tests url = https://github.com/taosdata/tests
branch = 3.0 branch = 3.0
[submodule "examples/rust"]
path = examples/rust
url = https://github.com/songtianyi/tdengine-rust-bindings.git
Subproject commit 1c8924dc668e6aa848214c2fc54e3ace3f5bf8df
...@@ -100,7 +100,7 @@ typedef enum _mgmt_table { ...@@ -100,7 +100,7 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_STREAMS, TSDB_MGMT_TABLE_STREAMS,
TSDB_MGMT_TABLE_VARIABLES, TSDB_MGMT_TABLE_VARIABLES,
TSDB_MGMT_TABLE_CONNS, TSDB_MGMT_TABLE_CONNS,
TSDB_MGMT_TABLE_SCORES, TSDB_MGMT_TABLE_TRANS,
TSDB_MGMT_TABLE_GRANTS, TSDB_MGMT_TABLE_GRANTS,
TSDB_MGMT_TABLE_VNODES, TSDB_MGMT_TABLE_VNODES,
TSDB_MGMT_TABLE_CLUSTER, TSDB_MGMT_TABLE_CLUSTER,
...@@ -524,6 +524,7 @@ typedef struct { ...@@ -524,6 +524,7 @@ typedef struct {
int8_t update; int8_t update;
int8_t cacheLastRow; int8_t cacheLastRow;
int8_t ignoreExist; int8_t ignoreExist;
int8_t streamMode;
} SCreateDbReq; } SCreateDbReq;
int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq); int32_t tSerializeSCreateDbReq(void* buf, int32_t bufLen, SCreateDbReq* pReq);
...@@ -977,6 +978,13 @@ typedef struct { ...@@ -977,6 +978,13 @@ typedef struct {
int32_t tSerializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq); int32_t tSerializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq);
int32_t tDeserializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq); int32_t tDeserializeSKillConnReq(void* buf, int32_t bufLen, SKillConnReq* pReq);
typedef struct {
int32_t transId;
} SKillTransReq;
int32_t tSerializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq);
int32_t tDeserializeSKillTransReq(void* buf, int32_t bufLen, SKillTransReq* pReq);
typedef struct { typedef struct {
char user[TSDB_USER_LEN]; char user[TSDB_USER_LEN];
char spi; char spi;
......
...@@ -136,6 +136,7 @@ enum { ...@@ -136,6 +136,7 @@ enum {
TD_DEF_MSG_TYPE(TDMT_MND_SHOW_RETRIEVE, "mnode-retrieve", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_SHOW_RETRIEVE, "mnode-retrieve", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_STATUS, "mnode-status", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_STATUS, "mnode-status", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_TRANS, "mnode-trans", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TRANS, "mnode-trans", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_KILL_TRANS, "mnode-kill-trans", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_GRANT, "mnode-grant", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GRANT, "mnode-grant", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_AUTH, "mnode-auth", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_AUTH, "mnode-auth", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_MND_CREATE_TOPIC, "mnode-create-topic", SMCreateTopicReq, SMCreateTopicRsp) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_TOPIC, "mnode-create-topic", SMCreateTopicReq, SMCreateTopicRsp)
......
...@@ -126,86 +126,87 @@ ...@@ -126,86 +126,87 @@
#define TK_PRECISION 108 #define TK_PRECISION 108
#define TK_UPDATE 109 #define TK_UPDATE 109
#define TK_CACHELAST 110 #define TK_CACHELAST 110
#define TK_UNSIGNED 111 #define TK_STREAM 111
#define TK_TAGS 112 #define TK_MODE 112
#define TK_USING 113 #define TK_UNSIGNED 113
#define TK_NULL 114 #define TK_TAGS 114
#define TK_NOW 115 #define TK_USING 115
#define TK_SELECT 116 #define TK_NULL 116
#define TK_UNION 117 #define TK_NOW 117
#define TK_ALL 118 #define TK_SELECT 118
#define TK_DISTINCT 119 #define TK_UNION 119
#define TK_FROM 120 #define TK_ALL 120
#define TK_VARIABLE 121 #define TK_DISTINCT 121
#define TK_INTERVAL 122 #define TK_FROM 122
#define TK_EVERY 123 #define TK_VARIABLE 123
#define TK_SESSION 124 #define TK_INTERVAL 124
#define TK_STATE_WINDOW 125 #define TK_EVERY 125
#define TK_FILL 126 #define TK_SESSION 126
#define TK_SLIDING 127 #define TK_STATE_WINDOW 127
#define TK_ORDER 128 #define TK_FILL 128
#define TK_BY 129 #define TK_SLIDING 129
#define TK_ASC 130 #define TK_ORDER 130
#define TK_GROUP 131 #define TK_BY 131
#define TK_HAVING 132 #define TK_ASC 132
#define TK_LIMIT 133 #define TK_GROUP 133
#define TK_OFFSET 134 #define TK_HAVING 134
#define TK_SLIMIT 135 #define TK_LIMIT 135
#define TK_SOFFSET 136 #define TK_OFFSET 136
#define TK_WHERE 137 #define TK_SLIMIT 137
#define TK_RESET 138 #define TK_SOFFSET 138
#define TK_QUERY 139 #define TK_WHERE 139
#define TK_SYNCDB 140 #define TK_RESET 140
#define TK_ADD 141 #define TK_QUERY 141
#define TK_COLUMN 142 #define TK_SYNCDB 142
#define TK_MODIFY 143 #define TK_ADD 143
#define TK_TAG 144 #define TK_COLUMN 144
#define TK_CHANGE 145 #define TK_MODIFY 145
#define TK_SET 146 #define TK_TAG 146
#define TK_KILL 147 #define TK_CHANGE 147
#define TK_CONNECTION 148 #define TK_SET 148
#define TK_STREAM 149 #define TK_KILL 149
#define TK_COLON 150 #define TK_CONNECTION 150
#define TK_ABORT 151 #define TK_COLON 151
#define TK_AFTER 152 #define TK_ABORT 152
#define TK_ATTACH 153 #define TK_AFTER 153
#define TK_BEFORE 154 #define TK_ATTACH 154
#define TK_BEGIN 155 #define TK_BEFORE 155
#define TK_CASCADE 156 #define TK_BEGIN 156
#define TK_CLUSTER 157 #define TK_CASCADE 157
#define TK_CONFLICT 158 #define TK_CLUSTER 158
#define TK_COPY 159 #define TK_CONFLICT 159
#define TK_DEFERRED 160 #define TK_COPY 160
#define TK_DELIMITERS 161 #define TK_DEFERRED 161
#define TK_DETACH 162 #define TK_DELIMITERS 162
#define TK_EACH 163 #define TK_DETACH 163
#define TK_END 164 #define TK_EACH 164
#define TK_EXPLAIN 165 #define TK_END 165
#define TK_FAIL 166 #define TK_EXPLAIN 166
#define TK_FOR 167 #define TK_FAIL 167
#define TK_IGNORE 168 #define TK_FOR 168
#define TK_IMMEDIATE 169 #define TK_IGNORE 169
#define TK_INITIALLY 170 #define TK_IMMEDIATE 170
#define TK_INSTEAD 171 #define TK_INITIALLY 171
#define TK_KEY 172 #define TK_INSTEAD 172
#define TK_OF 173 #define TK_KEY 173
#define TK_RAISE 174 #define TK_OF 174
#define TK_REPLACE 175 #define TK_RAISE 175
#define TK_RESTRICT 176 #define TK_REPLACE 176
#define TK_ROW 177 #define TK_RESTRICT 177
#define TK_STATEMENT 178 #define TK_ROW 178
#define TK_TRIGGER 179 #define TK_STATEMENT 179
#define TK_VIEW 180 #define TK_TRIGGER 180
#define TK_SEMI 181 #define TK_VIEW 181
#define TK_NONE 182 #define TK_SEMI 182
#define TK_PREV 183 #define TK_NONE 183
#define TK_LINEAR 184 #define TK_PREV 184
#define TK_IMPORT 185 #define TK_LINEAR 185
#define TK_TBNAME 186 #define TK_IMPORT 186
#define TK_JOIN 187 #define TK_TBNAME 187
#define TK_INSERT 188 #define TK_JOIN 188
#define TK_INTO 189 #define TK_INSERT 189
#define TK_VALUES 190 #define TK_INTO 190
#define TK_VALUES 191
#define NEW_TK_OR 1 #define NEW_TK_OR 1
#define NEW_TK_AND 2 #define NEW_TK_AND 2
......
...@@ -72,8 +72,10 @@ typedef enum ENodeType { ...@@ -72,8 +72,10 @@ typedef enum ENodeType {
QUERY_NODE_SHOW_STMT, QUERY_NODE_SHOW_STMT,
QUERY_NODE_LOGIC_PLAN_SCAN, QUERY_NODE_LOGIC_PLAN_SCAN,
QUERY_NODE_LOGIC_PLAN_JOIN,
QUERY_NODE_LOGIC_PLAN_FILTER, QUERY_NODE_LOGIC_PLAN_FILTER,
QUERY_NODE_LOGIC_PLAN_AGG QUERY_NODE_LOGIC_PLAN_AGG,
QUERY_NODE_LOGIC_PLAN_PROJECT
} ENodeType; } ENodeType;
/** /**
...@@ -100,7 +102,7 @@ SNode* nodesMakeNode(ENodeType type); ...@@ -100,7 +102,7 @@ SNode* nodesMakeNode(ENodeType type);
void nodesDestroyNode(SNode* pNode); void nodesDestroyNode(SNode* pNode);
SNodeList* nodesMakeList(); SNodeList* nodesMakeList();
SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode); int32_t nodesListAppend(SNodeList* pList, SNode* pNode);
SListCell* nodesListErase(SNodeList* pList, SListCell* pCell); SListCell* nodesListErase(SNodeList* pList, SListCell* pCell);
SNode* nodesListGetNode(SNodeList* pList, int32_t index); SNode* nodesListGetNode(SNodeList* pList, int32_t index);
void nodesDestroyList(SNodeList* pList); void nodesDestroyList(SNodeList* pList);
......
...@@ -50,6 +50,7 @@ typedef enum EColumnType { ...@@ -50,6 +50,7 @@ typedef enum EColumnType {
typedef struct SColumnNode { typedef struct SColumnNode {
SExprNode node; // QUERY_NODE_COLUMN SExprNode node; // QUERY_NODE_COLUMN
uint64_t tableId;
int16_t colId; int16_t colId;
EColumnType colType; // column or tag EColumnType colType; // column or tag
char dbName[TSDB_DB_NAME_LEN]; char dbName[TSDB_DB_NAME_LEN];
...@@ -59,10 +60,11 @@ typedef struct SColumnNode { ...@@ -59,10 +60,11 @@ typedef struct SColumnNode {
SNode* pProjectRef; SNode* pProjectRef;
} SColumnNode; } SColumnNode;
typedef struct SColumnRef { typedef struct SColumnRefNode {
ENodeType type; ENodeType type;
int32_t tupleId;
int32_t slotId; int32_t slotId;
} SColumnRef; } SColumnRefNode;
typedef struct SValueNode { typedef struct SValueNode {
SExprNode node; // QUERY_NODE_VALUE SExprNode node; // QUERY_NODE_VALUE
...@@ -269,6 +271,25 @@ typedef struct SSetOperator { ...@@ -269,6 +271,25 @@ typedef struct SSetOperator {
SNode* pLimit; SNode* pLimit;
} SSetOperator; } SSetOperator;
typedef enum ESqlClause {
SQL_CLAUSE_FROM = 1,
SQL_CLAUSE_WHERE,
SQL_CLAUSE_PARTITION_BY,
SQL_CLAUSE_WINDOW,
SQL_CLAUSE_GROUP_BY,
SQL_CLAUSE_HAVING,
SQL_CLAUSE_SELECT,
SQL_CLAUSE_ORDER_BY
} ESqlClause;
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext);
void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewriter rewriter, void* pContext);
int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, uint64_t tableId, bool realCol, SNodeList** pCols);
typedef bool (*FFuncClassifier)(int32_t funcId);
int32_t nodesCollectFuncs(SSelectStmt* pSelect, FFuncClassifier classifier, SNodeList** pFuncs);
bool nodesIsExprNode(const SNode* pNode); bool nodesIsExprNode(const SNode* pNode);
bool nodesIsArithmeticOp(const SOperatorNode* pOp); bool nodesIsArithmeticOp(const SOperatorNode* pOp);
......
...@@ -113,6 +113,7 @@ typedef struct STableMetaOutput { ...@@ -113,6 +113,7 @@ typedef struct STableMetaOutput {
typedef struct SDataBuf { typedef struct SDataBuf {
void *pData; void *pData;
uint32_t len; uint32_t len;
void *handle;
} SDataBuf; } SDataBuf;
typedef int32_t (*__async_send_cb_fn_t)(void* param, const SDataBuf* pMsg, int32_t code); typedef int32_t (*__async_send_cb_fn_t)(void* param, const SDataBuf* pMsg, int32_t code);
......
...@@ -246,6 +246,8 @@ int32_t* taosGetErrno(); ...@@ -246,6 +246,8 @@ int32_t* taosGetErrno();
// mnode-trans // mnode-trans
#define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0) #define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0)
#define TSDB_CODE_MND_TRANS_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D1) #define TSDB_CODE_MND_TRANS_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D1)
#define TSDB_CODE_MND_TRANS_INVALID_STAGE TAOS_DEF_ERROR_CODE(0, 0x03D2)
#define TSDB_CODE_MND_TRANS_CANT_PARALLEL TAOS_DEF_ERROR_CODE(0, 0x03D4)
// mnode-mq // mnode-mq
#define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E0) #define TSDB_CODE_MND_TOPIC_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03E0)
...@@ -459,7 +461,6 @@ int32_t* taosGetErrno(); ...@@ -459,7 +461,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) //Not a GROUP BY expression #define TSDB_CODE_PAR_GROUPBY_LACK_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260A) //Not a GROUP BY expression
#define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B) //Not SELECTed expression #define TSDB_CODE_PAR_NOT_SELECTED_EXPRESSION TAOS_DEF_ERROR_CODE(0, 0x260B) //Not SELECTed expression
#define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) //Not a single-group group function #define TSDB_CODE_PAR_NOT_SINGLE_GROUP TAOS_DEF_ERROR_CODE(0, 0x260C) //Not a single-group group function
#define TSDB_CODE_PAR_OUT_OF_MEMORY TAOS_DEF_ERROR_CODE(0, 0x260D) //Out of memory
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -214,6 +214,10 @@ do { \ ...@@ -214,6 +214,10 @@ do { \
#define TSDB_SHOW_SUBQUERY_LEN 1000 #define TSDB_SHOW_SUBQUERY_LEN 1000
#define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_SLOW_QUERY_SQL_LEN 512
#define TSDB_TRANS_STAGE_LEN 12
#define TSDB_TRANS_DESC_LEN 16
#define TSDB_TRANS_ERROR_LEN 128
#define TSDB_STEP_NAME_LEN 32 #define TSDB_STEP_NAME_LEN 32
#define TSDB_STEP_DESC_LEN 128 #define TSDB_STEP_DESC_LEN 128
......
...@@ -395,8 +395,10 @@ static void* hbThreadFunc(void* param) { ...@@ -395,8 +395,10 @@ static void* hbThreadFunc(void* param) {
hbClearReqInfo(pAppHbMgr); hbClearReqInfo(pAppHbMgr);
break; break;
} }
tSerializeSClientHbBatchReq(buf, tlen, pReq); tSerializeSClientHbBatchReq(buf, tlen, pReq);
SMsgSendInfo *pInfo = malloc(sizeof(SMsgSendInfo)); SMsgSendInfo *pInfo = calloc(1, sizeof(SMsgSendInfo));
if (pInfo == NULL) { if (pInfo == NULL) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
tFreeClientHbBatchReq(pReq, false); tFreeClientHbBatchReq(pReq, false);
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "tpagedbuf.h" #include "tpagedbuf.h"
#include "tref.h" #include "tref.h"
static int32_t initEpSetFromCfg(const char *firstEp, const char *secondEp, SCorEpSet *pEpSet); static int32_t initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet);
static SMsgSendInfo* buildConnectMsg(SRequestObj *pRequest); static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest);
static void destroySendMsgInfo(SMsgSendInfo* pMsgBody); static void destroySendMsgInfo(SMsgSendInfo* pMsgBody);
static void setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp); static void setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp);
static bool stringLengthCheck(const char* str, size_t maxsize) { static bool stringLengthCheck(const char* str, size_t maxsize) {
if (str == NULL) { if (str == NULL) {
...@@ -30,17 +30,11 @@ static bool stringLengthCheck(const char* str, size_t maxsize) { ...@@ -30,17 +30,11 @@ static bool stringLengthCheck(const char* str, size_t maxsize) {
return true; return true;
} }
static bool validateUserName(const char* user) { static bool validateUserName(const char* user) { return stringLengthCheck(user, TSDB_USER_LEN - 1); }
return stringLengthCheck(user, TSDB_USER_LEN - 1);
}
static bool validatePassword(const char* passwd) { static bool validatePassword(const char* passwd) { return stringLengthCheck(passwd, TSDB_PASSWORD_LEN - 1); }
return stringLengthCheck(passwd, TSDB_PASSWORD_LEN - 1);
}
static bool validateDbName(const char* db) { static bool validateDbName(const char* db) { return stringLengthCheck(db, TSDB_DB_NAME_LEN - 1); }
return stringLengthCheck(db, TSDB_DB_NAME_LEN - 1);
}
static char* getClusterKey(const char* user, const char* auth, const char* ip, int32_t port) { static char* getClusterKey(const char* user, const char* auth, const char* ip, int32_t port) {
char key[512] = {0}; char key[512] = {0};
...@@ -48,10 +42,12 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i ...@@ -48,10 +42,12 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
return strdup(key); return strdup(key);
} }
static STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __taos_async_fn_t fp, void *param, SAppInstInfo* pAppInfo); static STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param,
static void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols); SAppInstInfo* pAppInfo);
static void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t numOfCols);
TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, const char *auth, const char *db, uint16_t port) { TAOS* taos_connect_internal(const char* ip, const char* user, const char* pass, const char* auth, const char* db,
uint16_t port) {
if (taos_init() != TSDB_CODE_SUCCESS) { if (taos_init() != TSDB_CODE_SUCCESS) {
return NULL; return NULL;
} }
...@@ -63,7 +59,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -63,7 +59,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
char localDb[TSDB_DB_NAME_LEN] = {0}; char localDb[TSDB_DB_NAME_LEN] = {0};
if (db != NULL) { if (db != NULL) {
if(!validateDbName(db)) { if (!validateDbName(db)) {
terrno = TSDB_CODE_TSC_INVALID_DB_LENGTH; terrno = TSDB_CODE_TSC_INVALID_DB_LENGTH;
return NULL; return NULL;
} }
...@@ -79,7 +75,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -79,7 +75,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
return NULL; return NULL;
} }
taosEncryptPass_c((uint8_t *)pass, strlen(pass), secretEncrypt); taosEncryptPass_c((uint8_t*)pass, strlen(pass), secretEncrypt);
} else { } else {
tstrncpy(secretEncrypt, auth, tListLen(secretEncrypt)); tstrncpy(secretEncrypt, auth, tListLen(secretEncrypt));
} }
...@@ -99,7 +95,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -99,7 +95,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
} }
} }
char* key = getClusterKey(user, secretEncrypt, ip, port); char* key = getClusterKey(user, secretEncrypt, ip, port);
SAppInstInfo** pInst = NULL; SAppInstInfo** pInst = NULL;
pthread_mutex_lock(&appInfo.mutex); pthread_mutex_lock(&appInfo.mutex);
...@@ -108,7 +104,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -108,7 +104,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
SAppInstInfo* p = NULL; SAppInstInfo* p = NULL;
if (pInst == NULL) { if (pInst == NULL) {
p = calloc(1, sizeof(struct SAppInstInfo)); p = calloc(1, sizeof(struct SAppInstInfo));
p->mgmtEp = epSet; p->mgmtEp = epSet;
p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores); p->pTransporter = openTransporter(user, secretEncrypt, tsNumOfCores);
p->pAppHbMgr = appHbMgrInit(p, key); p->pAppHbMgr = appHbMgrInit(p, key);
taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES); taosHashPut(appInfo.pInstMap, key, strlen(key), &p, POINTER_BYTES);
...@@ -122,7 +118,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, ...@@ -122,7 +118,7 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass,
return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst); return taosConnectImpl(user, &secretEncrypt[0], localDb, NULL, NULL, *pInst);
} }
int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj** pRequest) { int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj** pRequest) {
*pRequest = createRequest(pTscObj, NULL, NULL, TSDB_SQL_SELECT); *pRequest = createRequest(pTscObj, NULL, NULL, TSDB_SQL_SELECT);
if (*pRequest == NULL) { if (*pRequest == NULL) {
tscError("failed to malloc sqlObj"); tscError("failed to malloc sqlObj");
...@@ -131,7 +127,7 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj* ...@@ -131,7 +127,7 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj*
(*pRequest)->sqlstr = malloc(sqlLen + 1); (*pRequest)->sqlstr = malloc(sqlLen + 1);
if ((*pRequest)->sqlstr == NULL) { if ((*pRequest)->sqlstr == NULL) {
tscError("0x%"PRIx64" failed to prepare sql string buffer", (*pRequest)->self); tscError("0x%" PRIx64 " failed to prepare sql string buffer", (*pRequest)->self);
(*pRequest)->msgBuf = strdup("failed to prepare sql string buffer"); (*pRequest)->msgBuf = strdup("failed to prepare sql string buffer");
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
...@@ -140,7 +136,7 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj* ...@@ -140,7 +136,7 @@ int32_t buildRequest(STscObj *pTscObj, const char *sql, int sqlLen, SRequestObj*
(*pRequest)->sqlstr[sqlLen] = 0; (*pRequest)->sqlstr[sqlLen] = 0;
(*pRequest)->sqlLen = sqlLen; (*pRequest)->sqlLen = sqlLen;
tscDebugL("0x%"PRIx64" SQL: %s, reqId:0x%"PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId); tscDebugL("0x%" PRIx64 " SQL: %s, reqId:0x%" PRIx64, (*pRequest)->self, (*pRequest)->sqlstr, (*pRequest)->requestId);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -148,14 +144,14 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) { ...@@ -148,14 +144,14 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) {
STscObj* pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
SParseContext cxt = { SParseContext cxt = {
.requestId = pRequest->requestId, .requestId = pRequest->requestId,
.acctId = pTscObj->acctId, .acctId = pTscObj->acctId,
.db = getDbOfConnection(pTscObj), .db = getDbOfConnection(pTscObj),
.pSql = pRequest->sqlstr, .pSql = pRequest->sqlstr,
.sqlLen = pRequest->sqlLen, .sqlLen = pRequest->sqlLen,
.pMsg = pRequest->msgBuf, .pMsg = pRequest->msgBuf,
.msgLen = ERROR_MSG_BUF_DEFAULT_SIZE, .msgLen = ERROR_MSG_BUF_DEFAULT_SIZE,
.pTransporter = pTscObj->pAppInfo->pTransporter, .pTransporter = pTscObj->pAppInfo->pTransporter,
}; };
cxt.mgmtEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp); cxt.mgmtEpSet = getEpSet_s(&pTscObj->pAppInfo->mgmtEp);
...@@ -174,9 +170,9 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) { ...@@ -174,9 +170,9 @@ int32_t parseSql(SRequestObj* pRequest, SQueryNode** pQuery) {
int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) { int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
SDclStmtInfo* pDcl = (SDclStmtInfo*)pQuery; SDclStmtInfo* pDcl = (SDclStmtInfo*)pQuery;
pRequest->type = pDcl->msgType; pRequest->type = pDcl->msgType;
pRequest->body.requestMsg = (SDataBuf){.pData = pDcl->pMsg, .len = pDcl->msgLen}; pRequest->body.requestMsg = (SDataBuf){.pData = pDcl->pMsg, .len = pDcl->msgLen, .handle = NULL};
STscObj* pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest); SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
int64_t transporterId = 0; int64_t transporterId = 0;
...@@ -202,7 +198,7 @@ int32_t getPlan(SRequestObj* pRequest, SQueryNode* pQueryNode, SQueryDag** pDag, ...@@ -202,7 +198,7 @@ int32_t getPlan(SRequestObj* pRequest, SQueryNode* pQueryNode, SQueryDag** pDag,
SSchema* pSchema = NULL; SSchema* pSchema = NULL;
int32_t numOfCols = 0; int32_t numOfCols = 0;
int32_t code = qCreateQueryDag(pQueryNode, pDag, &pSchema, &numOfCols, pNodeList, pRequest->requestId); int32_t code = qCreateQueryDag(pQueryNode, pDag, &pSchema, &numOfCols, pNodeList, pRequest->requestId);
if (code != 0) { if (code != 0) {
return code; return code;
} }
...@@ -224,7 +220,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t ...@@ -224,7 +220,7 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
for (int32_t i = 0; i < pResInfo->numOfCols; ++i) { for (int32_t i = 0; i < pResInfo->numOfCols; ++i) {
pResInfo->fields[i].bytes = pSchema[i].bytes; pResInfo->fields[i].bytes = pSchema[i].bytes;
pResInfo->fields[i].type = pSchema[i].type; pResInfo->fields[i].type = pSchema[i].type;
tstrncpy(pResInfo->fields[i].name, pSchema[i].name, tListLen(pResInfo->fields[i].name)); tstrncpy(pResInfo->fields[i].name, pSchema[i].name, tListLen(pResInfo->fields[i].name));
} }
} }
...@@ -233,7 +229,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, SArray* pNodeList) ...@@ -233,7 +229,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, SArray* pNodeList)
void* pTransporter = pRequest->pTscObj->pAppInfo->pTransporter; void* pTransporter = pRequest->pTscObj->pAppInfo->pTransporter;
if (TSDB_SQL_INSERT == pRequest->type || TSDB_SQL_CREATE_TABLE == pRequest->type) { if (TSDB_SQL_INSERT == pRequest->type || TSDB_SQL_CREATE_TABLE == pRequest->type) {
SQueryResult res = {.code = 0, .numOfRows = 0, .msgSize = ERROR_MSG_BUF_DEFAULT_SIZE, .msg = pRequest->msgBuf}; SQueryResult res = {.code = 0, .numOfRows = 0, .msgSize = ERROR_MSG_BUF_DEFAULT_SIZE, .msg = pRequest->msgBuf};
int32_t code = schedulerExecJob(pTransporter, NULL, pDag, &pRequest->body.pQueryJob, pRequest->sqlstr, &res); int32_t code = schedulerExecJob(pTransporter, NULL, pDag, &pRequest->body.pQueryJob, pRequest->sqlstr, &res);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
// handle error and retry // handle error and retry
} else { } else {
...@@ -250,9 +246,9 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, SArray* pNodeList) ...@@ -250,9 +246,9 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, SArray* pNodeList)
return schedulerAsyncExecJob(pTransporter, pNodeList, pDag, pRequest->sqlstr, &pRequest->body.pQueryJob); return schedulerAsyncExecJob(pTransporter, pNodeList, pDag, pRequest->sqlstr, &pRequest->body.pQueryJob);
} }
TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) { TAOS_RES* taos_query_l(TAOS* taos, const char* sql, int sqlLen) {
STscObj *pTscObj = (STscObj *)taos; STscObj* pTscObj = (STscObj*)taos;
if (sqlLen > (size_t) TSDB_MAX_ALLOWED_SQL_LEN) { if (sqlLen > (size_t)TSDB_MAX_ALLOWED_SQL_LEN) {
tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN); tscError("sql string exceeds max length:%d", TSDB_MAX_ALLOWED_SQL_LEN);
terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT; terrno = TSDB_CODE_TSC_EXCEED_SQL_LIMIT;
return NULL; return NULL;
...@@ -260,9 +256,9 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) { ...@@ -260,9 +256,9 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
nPrintTsc("%s", sql) nPrintTsc("%s", sql)
SRequestObj *pRequest = NULL; SRequestObj* pRequest = NULL;
SQueryNode *pQueryNode = NULL; SQueryNode* pQueryNode = NULL;
SArray *pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr)); SArray* pNodeList = taosArrayInit(4, sizeof(struct SQueryNodeAddr));
terrno = TSDB_CODE_SUCCESS; terrno = TSDB_CODE_SUCCESS;
CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return); CHECK_CODE_GOTO(buildRequest(pTscObj, sql, sqlLen, &pRequest), _return);
...@@ -286,13 +282,13 @@ _return: ...@@ -286,13 +282,13 @@ _return:
return pRequest; return pRequest;
} }
int initEpSetFromCfg(const char *firstEp, const char *secondEp, SCorEpSet *pEpSet) { int initEpSetFromCfg(const char* firstEp, const char* secondEp, SCorEpSet* pEpSet) {
pEpSet->version = 0; pEpSet->version = 0;
// init mnode ip set // init mnode ip set
SEpSet *mgmtEpSet = &(pEpSet->epSet); SEpSet* mgmtEpSet = &(pEpSet->epSet);
mgmtEpSet->numOfEps = 0; mgmtEpSet->numOfEps = 0;
mgmtEpSet->inUse = 0; mgmtEpSet->inUse = 0;
if (firstEp && firstEp[0] != 0) { if (firstEp && firstEp[0] != 0) {
if (strlen(firstEp) >= TSDB_EP_LEN) { if (strlen(firstEp) >= TSDB_EP_LEN) {
...@@ -322,14 +318,15 @@ int initEpSetFromCfg(const char *firstEp, const char *secondEp, SCorEpSet *pEpSe ...@@ -322,14 +318,15 @@ int initEpSetFromCfg(const char *firstEp, const char *secondEp, SCorEpSet *pEpSe
return 0; return 0;
} }
STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __taos_async_fn_t fp, void *param, SAppInstInfo* pAppInfo) { STscObj* taosConnectImpl(const char* user, const char* auth, const char* db, __taos_async_fn_t fp, void* param,
STscObj *pTscObj = createTscObj(user, auth, db, pAppInfo); SAppInstInfo* pAppInfo) {
STscObj* pTscObj = createTscObj(user, auth, db, pAppInfo);
if (NULL == pTscObj) { if (NULL == pTscObj) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
return pTscObj; return pTscObj;
} }
SRequestObj *pRequest = createRequest(pTscObj, fp, param, TDMT_MND_CONNECT); SRequestObj* pRequest = createRequest(pTscObj, fp, param, TDMT_MND_CONNECT);
if (pRequest == NULL) { if (pRequest == NULL) {
destroyTscObj(pTscObj); destroyTscObj(pTscObj);
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
...@@ -343,14 +340,16 @@ STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __t ...@@ -343,14 +340,16 @@ STscObj* taosConnectImpl(const char *user, const char *auth, const char *db, __t
tsem_wait(&pRequest->body.rspSem); tsem_wait(&pRequest->body.rspSem);
if (pRequest->code != TSDB_CODE_SUCCESS) { if (pRequest->code != TSDB_CODE_SUCCESS) {
const char *errorMsg = (pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) ? taos_errstr(pRequest) : tstrerror(pRequest->code); const char* errorMsg =
(pRequest->code == TSDB_CODE_RPC_FQDN_ERROR) ? taos_errstr(pRequest) : tstrerror(pRequest->code);
printf("failed to connect to server, reason: %s\n\n", errorMsg); printf("failed to connect to server, reason: %s\n\n", errorMsg);
destroyRequest(pRequest); destroyRequest(pRequest);
taos_close(pTscObj); taos_close(pTscObj);
pTscObj = NULL; pTscObj = NULL;
} else { } else {
tscDebug("0x%"PRIx64" connection is opening, connId:%d, dnodeConn:%p, reqId:0x%"PRIx64, pTscObj->id, pTscObj->connId, pTscObj->pAppInfo->pTransporter, pRequest->requestId); tscDebug("0x%" PRIx64 " connection is opening, connId:%d, dnodeConn:%p, reqId:0x%" PRIx64, pTscObj->id,
pTscObj->connId, pTscObj->pAppInfo->pTransporter, pRequest->requestId);
destroyRequest(pRequest); destroyRequest(pRequest);
} }
...@@ -365,11 +364,13 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) { ...@@ -365,11 +364,13 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest) {
} }
pMsgSendInfo->msgType = TDMT_MND_CONNECT; pMsgSendInfo->msgType = TDMT_MND_CONNECT;
pMsgSendInfo->requestObjRefId = pRequest->self; pMsgSendInfo->requestObjRefId = pRequest->self;
pMsgSendInfo->requestId = pRequest->requestId; pMsgSendInfo->requestId = pRequest->requestId;
pMsgSendInfo->fp = handleRequestRspFp[TMSG_INDEX(pMsgSendInfo->msgType)]; pMsgSendInfo->fp = handleRequestRspFp[TMSG_INDEX(pMsgSendInfo->msgType)];
pMsgSendInfo->param = pRequest; pMsgSendInfo->param = pRequest;
SConnectReq connectReq = {0}; SConnectReq connectReq = {0};
STscObj* pObj = pRequest->pTscObj; STscObj* pObj = pRequest->pTscObj;
...@@ -399,17 +400,17 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) { ...@@ -399,17 +400,17 @@ static void destroySendMsgInfo(SMsgSendInfo* pMsgBody) {
} }
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
SMsgSendInfo *pSendInfo = (SMsgSendInfo *) pMsg->ahandle; SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->ahandle;
assert(pMsg->ahandle != NULL); assert(pMsg->ahandle != NULL);
if (pSendInfo->requestObjRefId != 0) { if (pSendInfo->requestObjRefId != 0) {
SRequestObj *pRequest = (SRequestObj *)taosAcquireRef(clientReqRefPool, pSendInfo->requestObjRefId); SRequestObj* pRequest = (SRequestObj*)taosAcquireRef(clientReqRefPool, pSendInfo->requestObjRefId);
assert(pRequest->self == pSendInfo->requestObjRefId); assert(pRequest->self == pSendInfo->requestObjRefId);
pRequest->metric.rsp = taosGetTimestampMs(); pRequest->metric.rsp = taosGetTimestampMs();
pRequest->code = pMsg->code; pRequest->code = pMsg->code;
STscObj *pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
if (pEpSet) { if (pEpSet) {
if (!isEpsetEqual(&pTscObj->pAppInfo->mgmtEp.epSet, pEpSet)) { if (!isEpsetEqual(&pTscObj->pAppInfo->mgmtEp.epSet, pEpSet)) {
updateEpSet_s(&pTscObj->pAppInfo->mgmtEp, pEpSet); updateEpSet_s(&pTscObj->pAppInfo->mgmtEp, pEpSet);
...@@ -417,22 +418,22 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { ...@@ -417,22 +418,22 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
} }
/* /*
* There is not response callback function for submit response. * There is not response callback function for submit response.
* The actual inserted number of points is the first number. * The actual inserted number of points is the first number.
*/ */
int32_t elapsed = pRequest->metric.rsp - pRequest->metric.start; int32_t elapsed = pRequest->metric.rsp - pRequest->metric.start;
if (pMsg->code == TSDB_CODE_SUCCESS) { if (pMsg->code == TSDB_CODE_SUCCESS) {
tscDebug("0x%" PRIx64 " message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%"PRIx64, pRequest->self, tscDebug("0x%" PRIx64 " message:%s, code:%s rspLen:%d, elapsed:%d ms, reqId:0x%" PRIx64, pRequest->self,
TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed, pRequest->requestId); TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed, pRequest->requestId);
} else { } else {
tscError("0x%" PRIx64 " SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%"PRIx64, pRequest->self, tscError("0x%" PRIx64 " SQL cmd:%s, code:%s rspLen:%d, elapsed time:%d ms, reqId:0x%" PRIx64, pRequest->self,
TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed, pRequest->requestId); TMSG_INFO(pMsg->msgType), tstrerror(pMsg->code), pMsg->contLen, elapsed, pRequest->requestId);
} }
taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId); taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId);
} }
SDataBuf buf = {.len = pMsg->contLen, .pData = NULL}; SDataBuf buf = {.len = pMsg->contLen, .pData = NULL, .handle = pMsg->handle};
if (pMsg->contLen > 0) { if (pMsg->contLen > 0) {
buf.pData = calloc(1, pMsg->contLen); buf.pData = calloc(1, pMsg->contLen);
...@@ -449,7 +450,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) { ...@@ -449,7 +450,7 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
destroySendMsgInfo(pSendInfo); destroySendMsgInfo(pSendInfo);
} }
TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port) { TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, const char* db, uint16_t port) {
tscDebug("try to connect to %s:%u by auth, user:%s db:%s", ip, port, user, db); tscDebug("try to connect to %s:%u by auth, user:%s db:%s", ip, port, user, db);
if (user == NULL) { if (user == NULL) {
user = TSDB_DEFAULT_USER; user = TSDB_DEFAULT_USER;
...@@ -463,16 +464,17 @@ TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, cons ...@@ -463,16 +464,17 @@ TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, cons
return taos_connect_internal(ip, user, NULL, auth, db, port); return taos_connect_internal(ip, user, NULL, auth, db, port);
} }
TAOS *taos_connect_l(const char *ip, int ipLen, const char *user, int userLen, const char *pass, int passLen, const char *db, int dbLen, uint16_t port) { TAOS* taos_connect_l(const char* ip, int ipLen, const char* user, int userLen, const char* pass, int passLen,
char ipStr[TSDB_EP_LEN] = {0}; const char* db, int dbLen, uint16_t port) {
char ipStr[TSDB_EP_LEN] = {0};
char dbStr[TSDB_DB_NAME_LEN] = {0}; char dbStr[TSDB_DB_NAME_LEN] = {0};
char userStr[TSDB_USER_LEN] = {0}; char userStr[TSDB_USER_LEN] = {0};
char passStr[TSDB_PASSWORD_LEN] = {0}; char passStr[TSDB_PASSWORD_LEN] = {0};
strncpy(ipStr, ip, TMIN(TSDB_EP_LEN - 1, ipLen)); strncpy(ipStr, ip, TMIN(TSDB_EP_LEN - 1, ipLen));
strncpy(userStr, user, TMIN(TSDB_USER_LEN - 1, userLen)); strncpy(userStr, user, TMIN(TSDB_USER_LEN - 1, userLen));
strncpy(passStr, pass, TMIN(TSDB_PASSWORD_LEN - 1, passLen)); strncpy(passStr, pass, TMIN(TSDB_PASSWORD_LEN - 1, passLen));
strncpy(dbStr, db, TMIN(TSDB_DB_NAME_LEN - 1, dbLen)); strncpy(dbStr, db, TMIN(TSDB_DB_NAME_LEN - 1, dbLen));
return taos_connect(ipStr, userStr, passStr, dbStr, port); return taos_connect(ipStr, userStr, passStr, dbStr, port);
} }
...@@ -490,15 +492,15 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -490,15 +492,15 @@ void* doFetchRow(SRequestObj* pRequest) {
} }
SReqResultInfo* pResInfo = &pRequest->body.resInfo; SReqResultInfo* pResInfo = &pRequest->body.resInfo;
int32_t code = schedulerFetchRows(pRequest->body.pQueryJob, (void **)&pResInfo->pData); int32_t code = schedulerFetchRows(pRequest->body.pQueryJob, (void**)&pResInfo->pData);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
pRequest->code = code; pRequest->code = code;
return NULL; return NULL;
} }
setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData); setQueryResultFromRsp(&pRequest->body.resInfo, (SRetrieveTableRsp*)pResInfo->pData);
tscDebug("0x%"PRIx64 " fetch results, numOfRows:%d total Rows:%"PRId64", complete:%d, reqId:0x%"PRIx64, pRequest->self, pResInfo->numOfRows, tscDebug("0x%" PRIx64 " fetch results, numOfRows:%d total Rows:%" PRId64 ", complete:%d, reqId:0x%" PRIx64,
pResInfo->totalRows, pResInfo->completed, pRequest->requestId); pRequest->self, pResInfo->numOfRows, pResInfo->totalRows, pResInfo->completed, pRequest->requestId);
if (pResultInfo->numOfRows == 0) { if (pResultInfo->numOfRows == 0) {
return NULL; return NULL;
...@@ -511,7 +513,7 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -511,7 +513,7 @@ void* doFetchRow(SRequestObj* pRequest) {
} else if (pRequest->type == TDMT_VND_SHOW_TABLES) { } else if (pRequest->type == TDMT_VND_SHOW_TABLES) {
pRequest->type = TDMT_VND_SHOW_TABLES_FETCH; pRequest->type = TDMT_VND_SHOW_TABLES_FETCH;
SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo; SShowReqInfo* pShowReqInfo = &pRequest->body.showInfo;
SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex); SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex);
epSet = pVgroupInfo->epset; epSet = pVgroupInfo->epset;
} else if (pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) { } else if (pRequest->type == TDMT_VND_SHOW_TABLES_FETCH) {
...@@ -522,7 +524,7 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -522,7 +524,7 @@ void* doFetchRow(SRequestObj* pRequest) {
return NULL; return NULL;
} }
SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex); SVgroupInfo* pVgroupInfo = taosArrayGet(pShowReqInfo->pArray, pShowReqInfo->currentIndex);
SVShowTablesReq* pShowReq = calloc(1, sizeof(SVShowTablesReq)); SVShowTablesReq* pShowReq = calloc(1, sizeof(SVShowTablesReq));
pShowReq->head.vgId = htonl(pVgroupInfo->vgId); pShowReq->head.vgId = htonl(pVgroupInfo->vgId);
...@@ -533,14 +535,14 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -533,14 +535,14 @@ void* doFetchRow(SRequestObj* pRequest) {
epSet = pVgroupInfo->epset; epSet = pVgroupInfo->epset;
int64_t transporterId = 0; int64_t transporterId = 0;
STscObj *pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body); asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body);
tsem_wait(&pRequest->body.rspSem); tsem_wait(&pRequest->body.rspSem);
pRequest->type = TDMT_VND_SHOW_TABLES_FETCH; pRequest->type = TDMT_VND_SHOW_TABLES_FETCH;
} else if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) { } else if (pRequest->type == TDMT_MND_SHOW_RETRIEVE) {
epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); epSet = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp);
if (pResultInfo->completed) { if (pResultInfo->completed) {
return NULL; return NULL;
} }
...@@ -549,7 +551,7 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -549,7 +551,7 @@ void* doFetchRow(SRequestObj* pRequest) {
SMsgSendInfo* body = buildMsgInfoImpl(pRequest); SMsgSendInfo* body = buildMsgInfoImpl(pRequest);
int64_t transporterId = 0; int64_t transporterId = 0;
STscObj *pTscObj = pRequest->pTscObj; STscObj* pTscObj = pRequest->pTscObj;
asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body); asyncSendMsgToServer(pTscObj->pAppInfo->pTransporter, &epSet, &transporterId, body);
tsem_wait(&pRequest->body.rspSem); tsem_wait(&pRequest->body.rspSem);
...@@ -562,7 +564,7 @@ void* doFetchRow(SRequestObj* pRequest) { ...@@ -562,7 +564,7 @@ void* doFetchRow(SRequestObj* pRequest) {
_return: _return:
for(int32_t i = 0; i < pResultInfo->numOfCols; ++i) { for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) {
pResultInfo->row[i] = pResultInfo->pCol[i] + pResultInfo->fields[i].bytes * pResultInfo->current; pResultInfo->row[i] = pResultInfo->pCol[i] + pResultInfo->fields[i].bytes * pResultInfo->current;
if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) { if (IS_VAR_DATA_TYPE(pResultInfo->fields[i].type)) {
pResultInfo->length[i] = varDataLen(pResultInfo->row[i]); pResultInfo->length[i] = varDataLen(pResultInfo->row[i]);
...@@ -576,8 +578,8 @@ _return: ...@@ -576,8 +578,8 @@ _return:
static void doPrepareResPtr(SReqResultInfo* pResInfo) { static void doPrepareResPtr(SReqResultInfo* pResInfo) {
if (pResInfo->row == NULL) { if (pResInfo->row == NULL) {
pResInfo->row = calloc(pResInfo->numOfCols, POINTER_BYTES); pResInfo->row = calloc(pResInfo->numOfCols, POINTER_BYTES);
pResInfo->pCol = calloc(pResInfo->numOfCols, POINTER_BYTES); pResInfo->pCol = calloc(pResInfo->numOfCols, POINTER_BYTES);
pResInfo->length = calloc(pResInfo->numOfCols, sizeof(int32_t)); pResInfo->length = calloc(pResInfo->numOfCols, sizeof(int32_t));
} }
} }
...@@ -594,14 +596,14 @@ void setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t ...@@ -594,14 +596,14 @@ void setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32_t
int32_t offset = 0; int32_t offset = 0;
for (int32_t i = 0; i < numOfCols; ++i) { for (int32_t i = 0; i < numOfCols; ++i) {
pResultInfo->length[i] = pResultInfo->fields[i].bytes; pResultInfo->length[i] = pResultInfo->fields[i].bytes;
pResultInfo->row[i] = (char*) (pResultInfo->pData + offset * pResultInfo->numOfRows); pResultInfo->row[i] = (char*)(pResultInfo->pData + offset * pResultInfo->numOfRows);
pResultInfo->pCol[i] = pResultInfo->row[i]; pResultInfo->pCol[i] = pResultInfo->row[i];
offset += pResultInfo->fields[i].bytes; offset += pResultInfo->fields[i].bytes;
} }
} }
char* getDbOfConnection(STscObj* pObj) { char* getDbOfConnection(STscObj* pObj) {
char *p = NULL; char* p = NULL;
pthread_mutex_lock(&pObj->mutex); pthread_mutex_lock(&pObj->mutex);
size_t len = strlen(pObj->db); size_t len = strlen(pObj->db);
if (len > 0) { if (len > 0) {
...@@ -622,10 +624,10 @@ void setConnectionDB(STscObj* pTscObj, const char* db) { ...@@ -622,10 +624,10 @@ void setConnectionDB(STscObj* pTscObj, const char* db) {
void setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp) { void setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableRsp* pRsp) {
assert(pResultInfo != NULL && pRsp != NULL); assert(pResultInfo != NULL && pRsp != NULL);
pResultInfo->pRspMsg = (const char*) pRsp; pResultInfo->pRspMsg = (const char*)pRsp;
pResultInfo->pData = (void*) pRsp->data; pResultInfo->pData = (void*)pRsp->data;
pResultInfo->numOfRows = htonl(pRsp->numOfRows); pResultInfo->numOfRows = htonl(pRsp->numOfRows);
pResultInfo->current = 0; pResultInfo->current = 0;
pResultInfo->completed = (pRsp->completed == 1); pResultInfo->completed = (pRsp->completed == 1);
pResultInfo->totalRows += pResultInfo->numOfRows; pResultInfo->totalRows += pResultInfo->numOfRows;
......
...@@ -97,9 +97,9 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) { ...@@ -97,9 +97,9 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq); int32_t contLen = tSerializeSRetrieveTableReq(NULL, 0, &retrieveReq);
void* pReq = malloc(contLen); void* pReq = malloc(contLen);
tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq); tSerializeSRetrieveTableReq(pReq, contLen, &retrieveReq);
pMsgSendInfo->msgInfo.pData = pReq; pMsgSendInfo->msgInfo.pData = pReq;
pMsgSendInfo->msgInfo.len = contLen; pMsgSendInfo->msgInfo.len = contLen;
pMsgSendInfo->msgInfo.handle = NULL;
} else { } else {
SVShowTablesFetchReq* pFetchMsg = calloc(1, sizeof(SVShowTablesFetchReq)); SVShowTablesFetchReq* pFetchMsg = calloc(1, sizeof(SVShowTablesFetchReq));
if (pFetchMsg == NULL) { if (pFetchMsg == NULL) {
...@@ -111,6 +111,7 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) { ...@@ -111,6 +111,7 @@ SMsgSendInfo* buildMsgInfoImpl(SRequestObj *pRequest) {
pMsgSendInfo->msgInfo.pData = pFetchMsg; pMsgSendInfo->msgInfo.pData = pFetchMsg;
pMsgSendInfo->msgInfo.len = sizeof(SVShowTablesFetchReq); pMsgSendInfo->msgInfo.len = sizeof(SVShowTablesFetchReq);
pMsgSendInfo->msgInfo.handle = NULL;
} }
} else { } else {
assert(pRequest != NULL); assert(pRequest != NULL);
......
...@@ -328,7 +328,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) { ...@@ -328,7 +328,7 @@ tmq_resp_err_t tmq_subscribe(tmq_t* tmq, tmq_list_t* topic_list) {
SMqSubscribeCbParam param = {.rspErr = TMQ_RESP_ERR__SUCCESS, .tmq = tmq}; SMqSubscribeCbParam param = {.rspErr = TMQ_RESP_ERR__SUCCESS, .tmq = tmq};
tsem_init(&param.rspSem, 0, 0); tsem_init(&param.rspSem, 0, 0);
pRequest->body.requestMsg = (SDataBuf){.pData = buf, .len = tlen}; pRequest->body.requestMsg = (SDataBuf){.pData = buf, .len = tlen, .handle = NULL};
SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest); SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest);
sendInfo->param = &param; sendInfo->param = &param;
...@@ -453,7 +453,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i ...@@ -453,7 +453,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i
tSerializeMCreateTopicReq(buf, tlen, &req); tSerializeMCreateTopicReq(buf, tlen, &req);
/*printf("formatted: %s\n", dagStr);*/ /*printf("formatted: %s\n", dagStr);*/
pRequest->body.requestMsg = (SDataBuf){.pData = buf, .len = tlen}; pRequest->body.requestMsg = (SDataBuf){.pData = buf, .len = tlen, .handle = NULL};
pRequest->type = TDMT_MND_CREATE_TOPIC; pRequest->type = TDMT_MND_CREATE_TOPIC;
SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest); SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest);
...@@ -779,8 +779,10 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) { ...@@ -779,8 +779,10 @@ tmq_message_t* tmq_consumer_poll(tmq_t* tmq, int64_t blocking_time) {
param->pVg = pVg; param->pVg = pVg;
tsem_init(&param->rspSem, 0, 0); tsem_init(&param->rspSem, 0, 0);
SRequestObj* pRequest = createRequest(tmq->pTscObj, NULL, NULL, TDMT_VND_CONSUME); SRequestObj* pRequest = createRequest(tmq->pTscObj, NULL, NULL, TDMT_VND_CONSUME);
pRequest->body.requestMsg = (SDataBuf){.pData = pReq, .len = sizeof(SMqConsumeReq)}; pRequest->body.requestMsg = (SDataBuf){.pData = pReq, .len = sizeof(SMqConsumeReq), .handle = NULL};
SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest); SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest);
sendInfo->requestObjRefId = 0; sendInfo->requestObjRefId = 0;
......
...@@ -1275,6 +1275,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) { ...@@ -1275,6 +1275,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if (tEncodeI8(&encoder, pReq->update) < 0) return -1; if (tEncodeI8(&encoder, pReq->update) < 0) return -1;
if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1; if (tEncodeI8(&encoder, pReq->cacheLastRow) < 0) return -1;
if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1; if (tEncodeI8(&encoder, pReq->ignoreExist) < 0) return -1;
if (tEncodeI8(&encoder, pReq->streamMode) < 0) return -1;
tEndEncode(&encoder); tEndEncode(&encoder);
int32_t tlen = encoder.pos; int32_t tlen = encoder.pos;
...@@ -1307,6 +1308,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) ...@@ -1307,6 +1308,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
if (tDecodeI8(&decoder, &pReq->update) < 0) return -1; if (tDecodeI8(&decoder, &pReq->update) < 0) return -1;
if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1; if (tDecodeI8(&decoder, &pReq->cacheLastRow) < 0) return -1;
if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1; if (tDecodeI8(&decoder, &pReq->ignoreExist) < 0) return -1;
if (tDecodeI8(&decoder, &pReq->streamMode) < 0) return -1;
tEndDecode(&decoder); tEndDecode(&decoder);
tCoderClear(&decoder); tCoderClear(&decoder);
...@@ -2239,6 +2241,31 @@ int32_t tDeserializeSKillConnReq(void *buf, int32_t bufLen, SKillConnReq *pReq) ...@@ -2239,6 +2241,31 @@ int32_t tDeserializeSKillConnReq(void *buf, int32_t bufLen, SKillConnReq *pReq)
return 0; return 0;
} }
int32_t tSerializeSKillTransReq(void *buf, int32_t bufLen, SKillTransReq *pReq) {
SCoder encoder = {0};
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
if (tStartEncode(&encoder) < 0) return -1;
if (tEncodeI32(&encoder, pReq->transId) < 0) return -1;
tEndEncode(&encoder);
int32_t tlen = encoder.pos;
tCoderClear(&encoder);
return tlen;
}
int32_t tDeserializeSKillTransReq(void *buf, int32_t bufLen, SKillTransReq *pReq) {
SCoder decoder = {0};
tCoderInit(&decoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_DECODER);
if (tStartDecode(&decoder) < 0) return -1;
if (tDecodeI32(&decoder, &pReq->transId) < 0) return -1;
tEndDecode(&decoder);
tCoderClear(&decoder);
return 0;
}
int32_t tSerializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *pReq) { int32_t tSerializeSDCreateMnodeReq(void *buf, int32_t bufLen, SDCreateMnodeReq *pReq) {
SCoder encoder = {0}; SCoder encoder = {0};
tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER); tCoderInit(&encoder, TD_LITTLE_ENDIAN, buf, bufLen, TD_ENCODER);
......
...@@ -27,6 +27,7 @@ void mndCleanupDb(SMnode *pMnode); ...@@ -27,6 +27,7 @@ void mndCleanupDb(SMnode *pMnode);
SDbObj *mndAcquireDb(SMnode *pMnode, const char *db); SDbObj *mndAcquireDb(SMnode *pMnode, const char *db);
void mndReleaseDb(SMnode *pMnode, SDbObj *pDb); void mndReleaseDb(SMnode *pMnode, SDbObj *pDb);
int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, void **ppRsp, int32_t *pRspLen); int32_t mndValidateDbInfo(SMnode *pMnode, SDbVgVersion *pDbs, int32_t numOfDbs, void **ppRsp, int32_t *pRspLen);
char *mnGetDbStr(char *src);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -104,6 +104,44 @@ typedef enum { ...@@ -104,6 +104,44 @@ typedef enum {
TRN_STAGE_FINISHED = 8 TRN_STAGE_FINISHED = 8
} ETrnStage; } ETrnStage;
typedef enum {
TRN_TYPE_BASIC_SCOPE = 1000,
TRN_TYPE_CREATE_USER = 1001,
TRN_TYPE_ALTER_USER = 1002,
TRN_TYPE_DROP_USER = 1003,
TRN_TYPE_CREATE_FUNC = 1004,
TRN_TYPE_DROP_FUNC = 1005,
TRN_TYPE_CREATE_SNODE = 1006,
TRN_TYPE_DROP_SNODE = 1007,
TRN_TYPE_CREATE_QNODE = 1008,
TRN_TYPE_DROP_QNODE = 1009,
TRN_TYPE_CREATE_BNODE = 1010,
TRN_TYPE_DROP_BNODE = 1011,
TRN_TYPE_CREATE_MNODE = 1012,
TRN_TYPE_DROP_MNODE = 1013,
TRN_TYPE_CREATE_TOPIC = 1014,
TRN_TYPE_DROP_TOPIC = 1015,
TRN_TYPE_SUBSCRIBE = 1016,
TRN_TYPE_REBALANCE = 1017,
TRN_TYPE_BASIC_SCOPE_END,
TRN_TYPE_GLOBAL_SCOPE = 2000,
TRN_TYPE_CREATE_DNODE = 2001,
TRN_TYPE_DROP_DNODE = 2002,
TRN_TYPE_GLOBAL_SCOPE_END,
TRN_TYPE_DB_SCOPE = 3000,
TRN_TYPE_CREATE_DB = 3001,
TRN_TYPE_ALTER_DB = 3002,
TRN_TYPE_DROP_DB = 3003,
TRN_TYPE_SPLIT_VGROUP = 3004,
TRN_TYPE_MERGE_VGROUP = 3015,
TRN_TYPE_DB_SCOPE_END,
TRN_TYPE_STB_SCOPE = 4000,
TRN_TYPE_CREATE_STB = 4001,
TRN_TYPE_ALTER_STB = 4002,
TRN_TYPE_DROP_STB = 4003,
TRN_TYPE_STB_SCOPE_END,
} ETrnType;
typedef enum { TRN_POLICY_ROLLBACK = 0, TRN_POLICY_RETRY = 1 } ETrnPolicy; typedef enum { TRN_POLICY_ROLLBACK = 0, TRN_POLICY_RETRY = 1 } ETrnPolicy;
typedef enum { typedef enum {
...@@ -124,6 +162,7 @@ typedef struct { ...@@ -124,6 +162,7 @@ typedef struct {
int32_t id; int32_t id;
ETrnStage stage; ETrnStage stage;
ETrnPolicy policy; ETrnPolicy policy;
ETrnType transType;
int32_t code; int32_t code;
int32_t failedTimes; int32_t failedTimes;
void* rpcHandle; void* rpcHandle;
...@@ -135,6 +174,11 @@ typedef struct { ...@@ -135,6 +174,11 @@ typedef struct {
SArray* commitLogs; SArray* commitLogs;
SArray* redoActions; SArray* redoActions;
SArray* undoActions; SArray* undoActions;
int64_t createdTime;
int64_t lastExecTime;
uint64_t dbUid;
char dbname[TSDB_DB_FNAME_LEN];
char lastError[TSDB_TRANS_ERROR_LEN];
} STrans; } STrans;
typedef struct { typedef struct {
......
...@@ -36,7 +36,7 @@ typedef struct { ...@@ -36,7 +36,7 @@ typedef struct {
int32_t mndInitTrans(SMnode *pMnode); int32_t mndInitTrans(SMnode *pMnode);
void mndCleanupTrans(SMnode *pMnode); void mndCleanupTrans(SMnode *pMnode);
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq); STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const SRpcMsg *pReq);
void mndTransDrop(STrans *pTrans); void mndTransDrop(STrans *pTrans);
int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw); int32_t mndTransAppendRedolog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw); int32_t mndTransAppendUndolog(STrans *pTrans, SSdbRaw *pRaw);
...@@ -44,6 +44,7 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw); ...@@ -44,6 +44,7 @@ int32_t mndTransAppendCommitlog(STrans *pTrans, SSdbRaw *pRaw);
int32_t mndTransAppendRedoAction(STrans *pTrans, STransAction *pAction); int32_t mndTransAppendRedoAction(STrans *pTrans, STransAction *pAction);
int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction); int32_t mndTransAppendUndoAction(STrans *pTrans, STransAction *pAction);
void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen); void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen);
void mndTransSetDbInfo(STrans *pTrans, SDbObj *pDb);
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans); int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans);
void mndTransProcessRsp(SMnodeMsg *pRsp); void mndTransProcessRsp(SMnodeMsg *pRsp);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "mndTrans.h" #include "mndTrans.h"
#include "mndUser.h" #include "mndUser.h"
#define TSDB_BNODE_VER_NUMBER 1 #define TSDB_BNODE_VER_NUMBER 1
#define TSDB_BNODE_RESERVE_SIZE 64 #define TSDB_BNODE_RESERVE_SIZE 64
static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj); static SSdbRaw *mndBnodeActionEncode(SBnodeObj *pObj);
...@@ -248,7 +248,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode ...@@ -248,7 +248,7 @@ static int32_t mndCreateBnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode
bnodeObj.createdTime = taosGetTimestampMs(); bnodeObj.createdTime = taosGetTimestampMs();
bnodeObj.updateTime = bnodeObj.createdTime; bnodeObj.updateTime = bnodeObj.createdTime;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_BNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_BNODE_OVER; if (pTrans == NULL) goto CREATE_BNODE_OVER;
mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId); mDebug("trans:%d, used to create bnode:%d", pTrans->id, pCreate->dnodeId);
...@@ -366,7 +366,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn ...@@ -366,7 +366,7 @@ static int32_t mndSetDropBnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SBn
static int32_t mndDropBnode(SMnode *pMnode, SMnodeMsg *pReq, SBnodeObj *pObj) { static int32_t mndDropBnode(SMnode *pMnode, SMnodeMsg *pReq, SBnodeObj *pObj) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_BNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_BNODE_OVER; if (pTrans == NULL) goto DROP_BNODE_OVER;
mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id); mDebug("trans:%d, used to drop bnode:%d", pTrans->id, pObj->id);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "mndUser.h" #include "mndUser.h"
#include "mndVgroup.h" #include "mndVgroup.h"
#define TSDB_DB_VER_NUMBER 1 #define TSDB_DB_VER_NUMBER 1
#define TSDB_DB_RESERVE_SIZE 64 #define TSDB_DB_RESERVE_SIZE 64
static SSdbRaw *mndDbActionEncode(SDbObj *pDb); static SSdbRaw *mndDbActionEncode(SDbObj *pDb);
...@@ -434,11 +434,12 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pReq, SCreateDbReq *pCreat ...@@ -434,11 +434,12 @@ static int32_t mndCreateDb(SMnode *pMnode, SMnodeMsg *pReq, SCreateDbReq *pCreat
} }
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_DB, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_DB_OVER; if (pTrans == NULL) goto CREATE_DB_OVER;
mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db); mDebug("trans:%d, used to create db:%s", pTrans->id, pCreate->db);
mndTransSetDbInfo(pTrans, &dbObj);
if (mndSetCreateDbRedoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER; if (mndSetCreateDbRedoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER;
if (mndSetCreateDbUndoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER; if (mndSetCreateDbUndoLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER;
if (mndSetCreateDbCommitLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER; if (mndSetCreateDbCommitLogs(pMnode, pTrans, &dbObj, pVgroups) != 0) goto CREATE_DB_OVER;
...@@ -620,11 +621,12 @@ static int32_t mndSetUpdateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -620,11 +621,12 @@ static int32_t mndSetUpdateDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
static int32_t mndUpdateDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pOld, SDbObj *pNew) { static int32_t mndUpdateDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pOld, SDbObj *pNew) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_ALTER_DB, &pReq->rpcMsg);
if (pTrans == NULL) goto UPDATE_DB_OVER; if (pTrans == NULL) goto UPDATE_DB_OVER;
mDebug("trans:%d, used to update db:%s", pTrans->id, pOld->name); mDebug("trans:%d, used to update db:%s", pTrans->id, pOld->name);
mndTransSetDbInfo(pTrans, pOld);
if (mndSetUpdateDbRedoLogs(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER; if (mndSetUpdateDbRedoLogs(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER;
if (mndSetUpdateDbCommitLogs(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER; if (mndSetUpdateDbCommitLogs(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER;
if (mndSetUpdateDbRedoActions(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER; if (mndSetUpdateDbRedoActions(pMnode, pTrans, pOld, pNew) != 0) goto UPDATE_DB_OVER;
...@@ -799,10 +801,11 @@ static int32_t mndSetDropDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *p ...@@ -799,10 +801,11 @@ static int32_t mndSetDropDbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *p
static int32_t mndDropDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb) { static int32_t mndDropDb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_DB, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_DB_OVER; if (pTrans == NULL) goto DROP_DB_OVER;
mDebug("trans:%d, used to drop db:%s", pTrans->id, pDb->name); mDebug("trans:%d, used to drop db:%s", pTrans->id, pDb->name);
mndTransSetDbInfo(pTrans, pDb);
if (mndSetDropDbRedoLogs(pMnode, pTrans, pDb) != 0) goto DROP_DB_OVER; if (mndSetDropDbRedoLogs(pMnode, pTrans, pDb) != 0) goto DROP_DB_OVER;
if (mndSetDropDbCommitLogs(pMnode, pTrans, pDb) != 0) goto DROP_DB_OVER; if (mndSetDropDbCommitLogs(pMnode, pTrans, pDb) != 0) goto DROP_DB_OVER;
...@@ -914,6 +917,8 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SArray *pVgList) { ...@@ -914,6 +917,8 @@ static void mndBuildDBVgroupInfo(SDbObj *pDb, SMnode *pMnode, SArray *pVgList) {
sdbRelease(pSdb, pVgroup); sdbRelease(pSdb, pVgroup);
} }
sdbCancelFetch(pSdb, pIter);
} }
static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) { static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
......
...@@ -440,7 +440,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pReq, SCreateDnodeReq * ...@@ -440,7 +440,7 @@ static int32_t mndCreateDnode(SMnode *pMnode, SMnodeMsg *pReq, SCreateDnodeReq *
memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN); memcpy(dnodeObj.fqdn, pCreate->fqdn, TSDB_FQDN_LEN);
snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port); snprintf(dnodeObj.ep, TSDB_EP_LEN, "%s:%u", dnodeObj.fqdn, dnodeObj.port);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_DNODE, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("dnode:%s, failed to create since %s", dnodeObj.ep, terrstr()); mError("dnode:%s, failed to create since %s", dnodeObj.ep, terrstr());
return -1; return -1;
...@@ -516,7 +516,7 @@ CREATE_DNODE_OVER: ...@@ -516,7 +516,7 @@ CREATE_DNODE_OVER:
} }
static int32_t mndDropDnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode) { static int32_t mndDropDnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode) {
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_DROP_DNODE, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("dnode:%d, failed to drop since %s", pDnode->id, terrstr()); mError("dnode:%d, failed to drop since %s", pDnode->id, terrstr());
return -1; return -1;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "mndTrans.h" #include "mndTrans.h"
#include "mndUser.h" #include "mndUser.h"
#define SDB_FUNC_VER 1 #define SDB_FUNC_VER 1
#define SDB_FUNC_RESERVE_SIZE 64 #define SDB_FUNC_RESERVE_SIZE 64
static SSdbRaw *mndFuncActionEncode(SFuncObj *pFunc); static SSdbRaw *mndFuncActionEncode(SFuncObj *pFunc);
...@@ -206,7 +206,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SMnodeMsg *pReq, SCreateFuncReq *pC ...@@ -206,7 +206,7 @@ static int32_t mndCreateFunc(SMnode *pMnode, SMnodeMsg *pReq, SCreateFuncReq *pC
memcpy(func.pComment, pCreate->pComment, pCreate->commentSize); memcpy(func.pComment, pCreate->pComment, pCreate->commentSize);
memcpy(func.pCode, pCreate->pCode, func.codeSize); memcpy(func.pCode, pCreate->pCode, func.codeSize);
pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_FUNC, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_FUNC_OVER; if (pTrans == NULL) goto CREATE_FUNC_OVER;
mDebug("trans:%d, used to create func:%s", pTrans->id, pCreate->name); mDebug("trans:%d, used to create func:%s", pTrans->id, pCreate->name);
...@@ -236,7 +236,7 @@ CREATE_FUNC_OVER: ...@@ -236,7 +236,7 @@ CREATE_FUNC_OVER:
static int32_t mndDropFunc(SMnode *pMnode, SMnodeMsg *pReq, SFuncObj *pFunc) { static int32_t mndDropFunc(SMnode *pMnode, SMnodeMsg *pReq, SFuncObj *pFunc) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_DROP_FUNC, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_FUNC_OVER; if (pTrans == NULL) goto DROP_FUNC_OVER;
mDebug("trans:%d, used to drop user:%s", pTrans->id, pFunc->name); mDebug("trans:%d, used to drop user:%s", pTrans->id, pFunc->name);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "mndTrans.h" #include "mndTrans.h"
#include "mndUser.h" #include "mndUser.h"
#define TSDB_MNODE_VER_NUMBER 1 #define TSDB_MNODE_VER_NUMBER 1
#define TSDB_MNODE_RESERVE_SIZE 64 #define TSDB_MNODE_RESERVE_SIZE 64
static int32_t mndCreateDefaultMnode(SMnode *pMnode); static int32_t mndCreateDefaultMnode(SMnode *pMnode);
...@@ -359,7 +359,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode ...@@ -359,7 +359,7 @@ static int32_t mndCreateMnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode
mnodeObj.createdTime = taosGetTimestampMs(); mnodeObj.createdTime = taosGetTimestampMs();
mnodeObj.updateTime = mnodeObj.createdTime; mnodeObj.updateTime = mnodeObj.createdTime;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_CREATE_MNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_MNODE_OVER; if (pTrans == NULL) goto CREATE_MNODE_OVER;
mDebug("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId); mDebug("trans:%d, used to create mnode:%d", pTrans->id, pCreate->dnodeId);
...@@ -526,7 +526,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode ...@@ -526,7 +526,7 @@ static int32_t mndSetDropMnodeRedoActions(SMnode *pMnode, STrans *pTrans, SDnode
static int32_t mndDropMnode(SMnode *pMnode, SMnodeMsg *pReq, SMnodeObj *pObj) { static int32_t mndDropMnode(SMnode *pMnode, SMnodeMsg *pReq, SMnodeObj *pObj) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_MNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_MNODE_OVER; if (pTrans == NULL) goto DROP_MNODE_OVER;
mDebug("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id); mDebug("trans:%d, used to drop mnode:%d", pTrans->id, pObj->id);
......
...@@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode ...@@ -248,7 +248,7 @@ static int32_t mndCreateQnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode
qnodeObj.createdTime = taosGetTimestampMs(); qnodeObj.createdTime = taosGetTimestampMs();
qnodeObj.updateTime = qnodeObj.createdTime; qnodeObj.updateTime = qnodeObj.createdTime;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_QNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_QNODE_OVER; if (pTrans == NULL) goto CREATE_QNODE_OVER;
mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId); mDebug("trans:%d, used to create qnode:%d", pTrans->id, pCreate->dnodeId);
...@@ -366,7 +366,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn ...@@ -366,7 +366,7 @@ static int32_t mndSetDropQnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SQn
static int32_t mndDropQnode(SMnode *pMnode, SMnodeMsg *pReq, SQnodeObj *pObj) { static int32_t mndDropQnode(SMnode *pMnode, SMnodeMsg *pReq, SQnodeObj *pObj) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_QNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_QNODE_OVER; if (pTrans == NULL) goto DROP_QNODE_OVER;
mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id); mDebug("trans:%d, used to drop qnode:%d", pTrans->id, pObj->id);
......
...@@ -295,8 +295,8 @@ char *mndShowStr(int32_t showType) { ...@@ -295,8 +295,8 @@ char *mndShowStr(int32_t showType) {
return "show configs"; return "show configs";
case TSDB_MGMT_TABLE_CONNS: case TSDB_MGMT_TABLE_CONNS:
return "show connections"; return "show connections";
case TSDB_MGMT_TABLE_SCORES: case TSDB_MGMT_TABLE_TRANS:
return "show scores"; return "show trans";
case TSDB_MGMT_TABLE_GRANTS: case TSDB_MGMT_TABLE_GRANTS:
return "show grants"; return "show grants";
case TSDB_MGMT_TABLE_VNODES: case TSDB_MGMT_TABLE_VNODES:
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "mndTrans.h" #include "mndTrans.h"
#include "mndUser.h" #include "mndUser.h"
#define TSDB_SNODE_VER_NUMBER 1 #define TSDB_SNODE_VER_NUMBER 1
#define TSDB_SNODE_RESERVE_SIZE 64 #define TSDB_SNODE_RESERVE_SIZE 64
static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj); static SSdbRaw *mndSnodeActionEncode(SSnodeObj *pObj);
...@@ -248,7 +248,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode ...@@ -248,7 +248,7 @@ static int32_t mndCreateSnode(SMnode *pMnode, SMnodeMsg *pReq, SDnodeObj *pDnode
snodeObj.createdTime = taosGetTimestampMs(); snodeObj.createdTime = taosGetTimestampMs();
snodeObj.updateTime = snodeObj.createdTime; snodeObj.updateTime = snodeObj.createdTime;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_SNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_SNODE_OVER; if (pTrans == NULL) goto CREATE_SNODE_OVER;
mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId); mDebug("trans:%d, used to create snode:%d", pTrans->id, pCreate->dnodeId);
...@@ -368,7 +368,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn ...@@ -368,7 +368,7 @@ static int32_t mndSetDropSnodeRedoActions(STrans *pTrans, SDnodeObj *pDnode, SSn
static int32_t mndDropSnode(SMnode *pMnode, SMnodeMsg *pReq, SSnodeObj *pObj) { static int32_t mndDropSnode(SMnode *pMnode, SMnodeMsg *pReq, SSnodeObj *pObj) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_DROP_SNODE, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_SNODE_OVER; if (pTrans == NULL) goto DROP_SNODE_OVER;
mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id); mDebug("trans:%d, used to drop snode:%d", pTrans->id, pObj->id);
......
...@@ -420,7 +420,10 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -420,7 +420,10 @@ static int32_t mndSetCreateStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break; if (pIter == NULL) break;
if (pVgroup->dbUid != pDb->uid) continue; if (pVgroup->dbUid != pDb->uid) {
sdbRelease(pSdb, pVgroup);
continue;
}
void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen);
if (pReq == NULL) { if (pReq == NULL) {
...@@ -455,7 +458,10 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -455,7 +458,10 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break; if (pIter == NULL) break;
if (pVgroup->dbUid != pDb->uid) continue; if (pVgroup->dbUid != pDb->uid) {
sdbRelease(pSdb, pVgroup);
continue;
}
int32_t contLen = 0; int32_t contLen = 0;
void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen); void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen);
...@@ -524,10 +530,11 @@ static int32_t mndCreateStb(SMnode *pMnode, SMnodeMsg *pReq, SMCreateStbReq *pCr ...@@ -524,10 +530,11 @@ static int32_t mndCreateStb(SMnode *pMnode, SMnodeMsg *pReq, SMCreateStbReq *pCr
} }
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_STB, &pReq->rpcMsg);
if (pTrans == NULL) goto CREATE_STB_OVER; if (pTrans == NULL) goto CREATE_STB_OVER;
mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name); mDebug("trans:%d, used to create stb:%s", pTrans->id, pCreate->name);
mndTransSetDbInfo(pTrans, pDb);
if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto CREATE_STB_OVER; if (mndSetCreateStbRedoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto CREATE_STB_OVER;
if (mndSetCreateStbUndoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto CREATE_STB_OVER; if (mndSetCreateStbUndoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto CREATE_STB_OVER;
...@@ -942,7 +949,10 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj ...@@ -942,7 +949,10 @@ static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break; if (pIter == NULL) break;
if (pVgroup->dbUid != pDb->uid) continue; if (pVgroup->dbUid != pDb->uid) {
sdbRelease(pSdb, pVgroup);
continue;
}
void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen); void *pReq = mndBuildVCreateStbReq(pMnode, pVgroup, pStb, &contLen);
if (pReq == NULL) { if (pReq == NULL) {
...@@ -1012,10 +1022,11 @@ static int32_t mndAlterStb(SMnode *pMnode, SMnodeMsg *pReq, const SMAltertbReq * ...@@ -1012,10 +1022,11 @@ static int32_t mndAlterStb(SMnode *pMnode, SMnodeMsg *pReq, const SMAltertbReq *
if (code != 0) goto ALTER_STB_OVER; if (code != 0) goto ALTER_STB_OVER;
code = -1; code = -1;
pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pReq->rpcMsg); pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_ALTER_STB, &pReq->rpcMsg);
if (pTrans == NULL) goto ALTER_STB_OVER; if (pTrans == NULL) goto ALTER_STB_OVER;
mDebug("trans:%d, used to alter stb:%s", pTrans->id, pAlter->name); mDebug("trans:%d, used to alter stb:%s", pTrans->id, pAlter->name);
mndTransSetDbInfo(pTrans, pDb);
if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto ALTER_STB_OVER; if (mndSetAlterStbRedoLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto ALTER_STB_OVER;
if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto ALTER_STB_OVER; if (mndSetAlterStbCommitLogs(pMnode, pTrans, pDb, &stbObj) != 0) goto ALTER_STB_OVER;
...@@ -1116,7 +1127,10 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * ...@@ -1116,7 +1127,10 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break; if (pIter == NULL) break;
if (pVgroup->dbUid != pDb->uid) continue; if (pVgroup->dbUid != pDb->uid) {
sdbRelease(pSdb, pVgroup);
continue;
}
int32_t contLen = 0; int32_t contLen = 0;
void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen); void *pReq = mndBuildVDropStbReq(pMnode, pVgroup, pStb, &contLen);
...@@ -1147,10 +1161,11 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj * ...@@ -1147,10 +1161,11 @@ static int32_t mndSetDropStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *
static int32_t mndDropStb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb, SStbObj *pStb) { static int32_t mndDropStb(SMnode *pMnode, SMnodeMsg *pReq, SDbObj *pDb, SStbObj *pStb) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK,TRN_TYPE_DROP_STB, &pReq->rpcMsg);
if (pTrans == NULL) goto DROP_STB_OVER; if (pTrans == NULL) goto DROP_STB_OVER;
mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name); mDebug("trans:%d, used to drop stb:%s", pTrans->id, pStb->name);
mndTransSetDbInfo(pTrans, pDb);
if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto DROP_STB_OVER; if (mndSetDropStbRedoLogs(pMnode, pTrans, pStb) != 0) goto DROP_STB_OVER;
if (mndSetDropStbCommitLogs(pMnode, pTrans, pStb) != 0) goto DROP_STB_OVER; if (mndSetDropStbCommitLogs(pMnode, pTrans, pStb) != 0) goto DROP_STB_OVER;
......
...@@ -135,8 +135,6 @@ static int32_t mndBuildRebalanceMsg(void **pBuf, int32_t *pLen, const SMqConsume ...@@ -135,8 +135,6 @@ static int32_t mndBuildRebalanceMsg(void **pBuf, int32_t *pLen, const SMqConsume
static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) { static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) {
ASSERT(pConsumerEp->oldConsumerId != -1); ASSERT(pConsumerEp->oldConsumerId != -1);
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
void *buf; void *buf;
int32_t tlen; int32_t tlen;
...@@ -144,6 +142,9 @@ static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqC ...@@ -144,6 +142,9 @@ static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqC
return -1; return -1;
} }
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgObj); action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf; action.pCont = buf;
...@@ -181,15 +182,15 @@ static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsum ...@@ -181,15 +182,15 @@ static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsum
} }
static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) { static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp) {
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
void *buf; void *buf;
int32_t tlen; int32_t tlen;
if (mndBuildCancelConnReq(&buf, &tlen, pConsumerEp) < 0) { if (mndBuildCancelConnReq(&buf, &tlen, pConsumerEp) < 0) {
return -1; return -1;
} }
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgObj); action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf; action.pCont = buf;
...@@ -408,8 +409,8 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) { ...@@ -408,8 +409,8 @@ static int32_t mndProcessMqTimerMsg(SMnodeMsg *pMsg) {
static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) { static int32_t mndProcessDoRebalanceMsg(SMnodeMsg *pMsg) {
SMnode *pMnode = pMsg->pMnode; SMnode *pMnode = pMsg->pMnode;
SMqDoRebalanceMsg *pReq = (SMqDoRebalanceMsg *)pMsg->rpcMsg.pCont; SMqDoRebalanceMsg *pReq = pMsg->rpcMsg.pCont;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pMsg->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_REBALANCE, &pMsg->rpcMsg);
void *pIter = NULL; void *pIter = NULL;
mInfo("mq rebalance start"); mInfo("mq rebalance start");
...@@ -762,7 +763,10 @@ static int32_t mndInitUnassignedVg(SMnode *pMnode, const SMqTopicObj *pTopic, SM ...@@ -762,7 +763,10 @@ static int32_t mndInitUnassignedVg(SMnode *pMnode, const SMqTopicObj *pTopic, SM
while (1) { while (1) {
pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup); pIter = sdbFetch(pSdb, SDB_VGROUP, pIter, (void **)&pVgroup);
if (pIter == NULL) break; if (pIter == NULL) break;
if (pVgroup->dbUid != pTopic->dbUid) continue; if (pVgroup->dbUid != pTopic->dbUid) {
sdbRelease(pSdb, pVgroup);
continue;
}
pSub->vgNum++; pSub->vgNum++;
plan->execNode.nodeId = pVgroup->vgId; plan->execNode.nodeId = pVgroup->vgId;
...@@ -796,7 +800,6 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT ...@@ -796,7 +800,6 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT
const SMqConsumerEp *pConsumerEp) { const SMqConsumerEp *pConsumerEp) {
ASSERT(pConsumerEp->oldConsumerId == -1); ASSERT(pConsumerEp->oldConsumerId == -1);
int32_t vgId = pConsumerEp->vgId; int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
SMqSetCVgReq req = { SMqSetCVgReq req = {
.vgId = vgId, .vgId = vgId,
...@@ -824,6 +827,8 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT ...@@ -824,6 +827,8 @@ static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqT
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
tEncodeSMqSetCVgReq(&abuf, &req); tEncodeSMqSetCVgReq(&abuf, &req);
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
STransAction action = {0}; STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgObj); action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf; action.pCont = buf;
...@@ -1004,7 +1009,7 @@ static int32_t mndProcessSubscribeReq(SMnodeMsg *pMsg) { ...@@ -1004,7 +1009,7 @@ static int32_t mndProcessSubscribeReq(SMnodeMsg *pMsg) {
oldTopicNum = taosArrayGetSize(oldSub); oldTopicNum = taosArrayGetSize(oldSub);
} }
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, &pMsg->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_SUBSCRIBE, &pMsg->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
// TODO: free memory // TODO: free memory
return -1; return -1;
......
...@@ -252,7 +252,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SMnodeMsg *pReq, SMCreateTopicReq ...@@ -252,7 +252,7 @@ static int32_t mndCreateTopic(SMnode *pMnode, SMnodeMsg *pReq, SMCreateTopicReq
topicObj.logicalPlan = pCreate->logicalPlan; topicObj.logicalPlan = pCreate->logicalPlan;
topicObj.sqlLen = strlen(pCreate->sql); topicObj.sqlLen = strlen(pCreate->sql);
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_CREATE_TOPIC, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("topic:%s, failed to create since %s", pCreate->name, terrstr()); mError("topic:%s, failed to create since %s", pCreate->name, terrstr());
return -1; return -1;
...@@ -343,7 +343,7 @@ CREATE_TOPIC_OVER: ...@@ -343,7 +343,7 @@ CREATE_TOPIC_OVER:
} }
static int32_t mndDropTopic(SMnode *pMnode, SMnodeMsg *pReq, SMqTopicObj *pTopic) { static int32_t mndDropTopic(SMnode *pMnode, SMnodeMsg *pReq, SMqTopicObj *pTopic) {
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_DROP_TOPIC, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("topic:%s, failed to drop since %s", pTopic->name, terrstr()); mError("topic:%s, failed to drop since %s", pTopic->name, terrstr());
return -1; return -1;
......
...@@ -15,10 +15,14 @@ ...@@ -15,10 +15,14 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "mndTrans.h" #include "mndTrans.h"
#include "mndAuth.h"
#include "mndDb.h"
#include "mndShow.h"
#include "mndSync.h" #include "mndSync.h"
#include "mndUser.h"
#define MND_TRANS_VER_NUMBER 1 #define MND_TRANS_VER_NUMBER 1
#define MND_TRANS_ARRAY_SIZE 8 #define MND_TRANS_ARRAY_SIZE 8
#define MND_TRANS_RESERVE_SIZE 64 #define MND_TRANS_RESERVE_SIZE 64
static SSdbRaw *mndTransActionEncode(STrans *pTrans); static SSdbRaw *mndTransActionEncode(STrans *pTrans);
...@@ -51,7 +55,12 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans); ...@@ -51,7 +55,12 @@ static bool mndTransPerfromFinishedStage(SMnode *pMnode, STrans *pTrans);
static void mndTransExecute(SMnode *pMnode, STrans *pTrans); static void mndTransExecute(SMnode *pMnode, STrans *pTrans);
static void mndTransSendRpcRsp(STrans *pTrans); static void mndTransSendRpcRsp(STrans *pTrans);
static int32_t mndProcessTransMsg(SMnodeMsg *pMsg); static int32_t mndProcessTransReq(SMnodeMsg *pReq);
static int32_t mndProcessKillTransReq(SMnodeMsg *pReq);
static int32_t mndGetTransMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta);
static int32_t mndRetrieveTrans(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows);
static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter);
int32_t mndInitTrans(SMnode *pMnode) { int32_t mndInitTrans(SMnode *pMnode) {
SSdbTable table = {.sdbType = SDB_TRANS, SSdbTable table = {.sdbType = SDB_TRANS,
...@@ -62,7 +71,12 @@ int32_t mndInitTrans(SMnode *pMnode) { ...@@ -62,7 +71,12 @@ int32_t mndInitTrans(SMnode *pMnode) {
.updateFp = (SdbUpdateFp)mndTransActionUpdate, .updateFp = (SdbUpdateFp)mndTransActionUpdate,
.deleteFp = (SdbDeleteFp)mndTransActionDelete}; .deleteFp = (SdbDeleteFp)mndTransActionDelete};
mndSetMsgHandle(pMnode, TDMT_MND_TRANS, mndProcessTransMsg); mndSetMsgHandle(pMnode, TDMT_MND_TRANS, mndProcessTransReq);
mndSetMsgHandle(pMnode, TDMT_MND_KILL_TRANS, mndProcessKillTransReq);
mndAddShowMetaHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndGetTransMeta);
mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndRetrieveTrans);
mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_TRANS, mndCancelGetNextTrans);
return sdbSetTable(pMnode->pSdb, table); return sdbSetTable(pMnode->pSdb, table);
} }
...@@ -80,17 +94,17 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) { ...@@ -80,17 +94,17 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
for (int32_t i = 0; i < redoLogNum; ++i) { for (int32_t i = 0; i < redoLogNum; ++i) {
SSdbRaw *pTmp = taosArrayGetP(pTrans->redoLogs, i); SSdbRaw *pTmp = taosArrayGetP(pTrans->redoLogs, i);
rawDataLen += (sdbGetRawTotalSize(pTmp) + 4); rawDataLen += (sdbGetRawTotalSize(pTmp) + sizeof(int32_t));
} }
for (int32_t i = 0; i < undoLogNum; ++i) { for (int32_t i = 0; i < undoLogNum; ++i) {
SSdbRaw *pTmp = taosArrayGetP(pTrans->undoLogs, i); SSdbRaw *pTmp = taosArrayGetP(pTrans->undoLogs, i);
rawDataLen += (sdbGetRawTotalSize(pTmp) + 4); rawDataLen += (sdbGetRawTotalSize(pTmp) + sizeof(int32_t));
} }
for (int32_t i = 0; i < commitLogNum; ++i) { for (int32_t i = 0; i < commitLogNum; ++i) {
SSdbRaw *pTmp = taosArrayGetP(pTrans->commitLogs, i); SSdbRaw *pTmp = taosArrayGetP(pTrans->commitLogs, i);
rawDataLen += (sdbGetRawTotalSize(pTmp) + 4); rawDataLen += (sdbGetRawTotalSize(pTmp) + sizeof(int32_t));
} }
for (int32_t i = 0; i < redoActionNum; ++i) { for (int32_t i = 0; i < redoActionNum; ++i) {
...@@ -111,8 +125,12 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) { ...@@ -111,8 +125,12 @@ static SSdbRaw *mndTransActionEncode(STrans *pTrans) {
int32_t dataPos = 0; int32_t dataPos = 0;
SDB_SET_INT32(pRaw, dataPos, pTrans->id, TRANS_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, pTrans->id, TRANS_ENCODE_OVER)
SDB_SET_INT8(pRaw, dataPos, pTrans->policy, TRANS_ENCODE_OVER) SDB_SET_INT16(pRaw, dataPos, pTrans->policy, TRANS_ENCODE_OVER)
SDB_SET_INT8(pRaw, dataPos, pTrans->stage, TRANS_ENCODE_OVER) SDB_SET_INT16(pRaw, dataPos, pTrans->stage, TRANS_ENCODE_OVER)
SDB_SET_INT16(pRaw, dataPos, pTrans->transType, TRANS_ENCODE_OVER)
SDB_SET_INT64(pRaw, dataPos, pTrans->createdTime, TRANS_ENCODE_OVER)
SDB_SET_INT64(pRaw, dataPos, pTrans->dbUid, TRANS_ENCODE_OVER)
SDB_SET_BINARY(pRaw, dataPos, pTrans->dbname, TSDB_DB_FNAME_LEN, TRANS_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, redoLogNum, TRANS_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, redoLogNum, TRANS_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, undoLogNum, TRANS_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, undoLogNum, TRANS_ENCODE_OVER)
SDB_SET_INT32(pRaw, dataPos, commitLogNum, TRANS_ENCODE_OVER) SDB_SET_INT32(pRaw, dataPos, commitLogNum, TRANS_ENCODE_OVER)
...@@ -203,27 +221,39 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) { ...@@ -203,27 +221,39 @@ static SSdbRow *mndTransActionDecode(SSdbRaw *pRaw) {
pTrans = sdbGetRowObj(pRow); pTrans = sdbGetRowObj(pRow);
if (pTrans == NULL) goto TRANS_DECODE_OVER; if (pTrans == NULL) goto TRANS_DECODE_OVER;
pTrans->redoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
pTrans->undoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
pTrans->commitLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
pTrans->redoActions = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(STransAction));
pTrans->undoActions = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(STransAction));
if (pTrans->redoLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->undoLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->commitLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->redoActions == NULL) goto TRANS_DECODE_OVER;
if (pTrans->undoActions == NULL) goto TRANS_DECODE_OVER;
SDB_GET_INT32(pRaw, dataPos, &pTrans->id, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &pTrans->id, TRANS_DECODE_OVER)
SDB_GET_INT8(pRaw, dataPos, (int8_t *)&pTrans->policy, TRANS_DECODE_OVER)
SDB_GET_INT8(pRaw, dataPos, (int8_t *)&pTrans->stage, TRANS_DECODE_OVER) int16_t type = 0;
int16_t policy = 0;
int16_t stage = 0;
SDB_GET_INT16(pRaw, dataPos, &policy, TRANS_DECODE_OVER)
SDB_GET_INT16(pRaw, dataPos, &stage, TRANS_DECODE_OVER)
SDB_GET_INT16(pRaw, dataPos, &type, TRANS_DECODE_OVER)
pTrans->policy = policy;
pTrans->stage = stage;
pTrans->transType = type;
SDB_GET_INT64(pRaw, dataPos, &pTrans->createdTime, TRANS_DECODE_OVER)
SDB_GET_INT64(pRaw, dataPos, &pTrans->dbUid, TRANS_DECODE_OVER)
SDB_GET_BINARY(pRaw, dataPos, pTrans->dbname, TSDB_DB_FNAME_LEN, TRANS_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &redoLogNum, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &redoLogNum, TRANS_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &undoLogNum, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &undoLogNum, TRANS_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &commitLogNum, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &commitLogNum, TRANS_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &redoActionNum, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &redoActionNum, TRANS_DECODE_OVER)
SDB_GET_INT32(pRaw, dataPos, &undoActionNum, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &undoActionNum, TRANS_DECODE_OVER)
pTrans->redoLogs = taosArrayInit(redoLogNum, sizeof(void *));
pTrans->undoLogs = taosArrayInit(undoLogNum, sizeof(void *));
pTrans->commitLogs = taosArrayInit(commitLogNum, sizeof(void *));
pTrans->redoActions = taosArrayInit(redoActionNum, sizeof(STransAction));
pTrans->undoActions = taosArrayInit(undoActionNum, sizeof(STransAction));
if (pTrans->redoLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->undoLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->commitLogs == NULL) goto TRANS_DECODE_OVER;
if (pTrans->redoActions == NULL) goto TRANS_DECODE_OVER;
if (pTrans->undoActions == NULL) goto TRANS_DECODE_OVER;
for (int32_t i = 0; i < redoLogNum; ++i) { for (int32_t i = 0; i < redoLogNum; ++i) {
SDB_GET_INT32(pRaw, dataPos, &dataLen, TRANS_DECODE_OVER) SDB_GET_INT32(pRaw, dataPos, &dataLen, TRANS_DECODE_OVER)
pData = malloc(dataLen); pData = malloc(dataLen);
...@@ -296,9 +326,43 @@ TRANS_DECODE_OVER: ...@@ -296,9 +326,43 @@ TRANS_DECODE_OVER:
return pRow; return pRow;
} }
static const char *mndTransStr(ETrnStage stage) {
switch (stage) {
case TRN_STAGE_PREPARE:
return "prepare";
case TRN_STAGE_REDO_LOG:
return "redoLog";
case TRN_STAGE_REDO_ACTION:
return "redoAction";
case TRN_STAGE_COMMIT:
return "commit";
case TRN_STAGE_COMMIT_LOG:
return "commitLog";
case TRN_STAGE_UNDO_ACTION:
return "undoAction";
case TRN_STAGE_UNDO_LOG:
return "undoLog";
case TRN_STAGE_ROLLBACK:
return "rollback";
case TRN_STAGE_FINISHED:
return "finished";
default:
return "invalid";
}
}
static const char *mndTransType(ETrnType type) {
switch (type) {
case TRN_TYPE_CREATE_DB:
return "create-db";
default:
return "invalid";
}
}
static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) { static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) {
pTrans->stage = TRN_STAGE_PREPARE; // pTrans->stage = TRN_STAGE_PREPARE;
mTrace("trans:%d, perform insert action, row:%p", pTrans->id, pTrans); mTrace("trans:%d, perform insert action, row:%p stage:%s", pTrans->id, pTrans, mndTransStr(pTrans->stage));
return 0; return 0;
} }
...@@ -309,28 +373,31 @@ static void mndTransDropData(STrans *pTrans) { ...@@ -309,28 +373,31 @@ static void mndTransDropData(STrans *pTrans) {
mndTransDropActions(pTrans->redoActions); mndTransDropActions(pTrans->redoActions);
mndTransDropActions(pTrans->undoActions); mndTransDropActions(pTrans->undoActions);
if (pTrans->rpcRsp != NULL) { if (pTrans->rpcRsp != NULL) {
rpcFreeCont(pTrans->rpcRsp); free(pTrans->rpcRsp);
pTrans->rpcRsp = NULL; pTrans->rpcRsp = NULL;
pTrans->rpcRspLen = 0; pTrans->rpcRspLen = 0;
} }
} }
static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) { static int32_t mndTransActionDelete(SSdb *pSdb, STrans *pTrans) {
mTrace("trans:%d, perform delete action, row:%p", pTrans->id, pTrans); mTrace("trans:%d, perform delete action, row:%p stage:%s", pTrans->id, pTrans, mndTransStr(pTrans->stage));
mndTransDropData(pTrans); mndTransDropData(pTrans);
return 0; return 0;
} }
static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) { static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
if (pNew->stage == TRN_STAGE_COMMIT) pNew->stage = TRN_STAGE_COMMIT_LOG; if (pNew->stage == TRN_STAGE_COMMIT) {
pNew->stage = TRN_STAGE_COMMIT_LOG;
mTrace("trans:%d, stage from %s to %s", pNew->id, mndTransStr(TRN_STAGE_COMMIT), mndTransStr(TRN_STAGE_COMMIT_LOG));
}
mTrace("trans:%d, perform update action, old row:%p stage:%d, new row:%p stage:%d", pOld->id, pOld, pOld->stage, pNew, mTrace("trans:%d, perform update action, old row:%p stage:%s, new row:%p stage:%s", pOld->id, pOld,
pNew->stage); mndTransStr(pOld->stage), pNew, mndTransStr(pNew->stage));
pOld->stage = pNew->stage; pOld->stage = pNew->stage;
return 0; return 0;
} }
STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId) { static STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId) {
SSdb *pSdb = pMnode->pSdb; SSdb *pSdb = pMnode->pSdb;
STrans *pTrans = sdbAcquire(pSdb, SDB_TRANS, &transId); STrans *pTrans = sdbAcquire(pSdb, SDB_TRANS, &transId);
if (pTrans == NULL) { if (pTrans == NULL) {
...@@ -339,12 +406,12 @@ STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId) { ...@@ -339,12 +406,12 @@ STrans *mndAcquireTrans(SMnode *pMnode, int32_t transId) {
return pTrans; return pTrans;
} }
void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) { static void mndReleaseTrans(SMnode *pMnode, STrans *pTrans) {
SSdb *pSdb = pMnode->pSdb; SSdb *pSdb = pMnode->pSdb;
sdbRelease(pSdb, pTrans); sdbRelease(pSdb, pTrans);
} }
STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq) { STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, ETrnType type, const SRpcMsg *pReq) {
STrans *pTrans = calloc(1, sizeof(STrans)); STrans *pTrans = calloc(1, sizeof(STrans));
if (pTrans == NULL) { if (pTrans == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
...@@ -355,6 +422,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq) { ...@@ -355,6 +422,7 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq) {
pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS); pTrans->id = sdbGetMaxId(pMnode->pSdb, SDB_TRANS);
pTrans->stage = TRN_STAGE_PREPARE; pTrans->stage = TRN_STAGE_PREPARE;
pTrans->policy = policy; pTrans->policy = policy;
pTrans->transType = type;
pTrans->rpcHandle = pReq->handle; pTrans->rpcHandle = pReq->handle;
pTrans->rpcAHandle = pReq->ahandle; pTrans->rpcAHandle = pReq->ahandle;
pTrans->redoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *)); pTrans->redoLogs = taosArrayInit(MND_TRANS_ARRAY_SIZE, sizeof(void *));
...@@ -375,8 +443,8 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq) { ...@@ -375,8 +443,8 @@ STrans *mndTransCreate(SMnode *pMnode, ETrnPolicy policy, const SRpcMsg *pReq) {
} }
static void mndTransDropLogs(SArray *pArray) { static void mndTransDropLogs(SArray *pArray) {
if (pArray == NULL) return; int32_t size = taosArrayGetSize(pArray);
for (int32_t i = 0; i < pArray->size; ++i) { for (int32_t i = 0; i < size; ++i) {
SSdbRaw *pRaw = taosArrayGetP(pArray, i); SSdbRaw *pRaw = taosArrayGetP(pArray, i);
sdbFreeRaw(pRaw); sdbFreeRaw(pRaw);
} }
...@@ -385,10 +453,10 @@ static void mndTransDropLogs(SArray *pArray) { ...@@ -385,10 +453,10 @@ static void mndTransDropLogs(SArray *pArray) {
} }
static void mndTransDropActions(SArray *pArray) { static void mndTransDropActions(SArray *pArray) {
if (pArray == NULL) return; int32_t size = taosArrayGetSize(pArray);
for (int32_t i = 0; i < pArray->size; ++i) { for (int32_t i = 0; i < size; ++i) {
STransAction *pAction = taosArrayGet(pArray, i); STransAction *pAction = taosArrayGet(pArray, i);
free(pAction->pCont); tfree(pAction->pCont);
} }
taosArrayDestroy(pArray); taosArrayDestroy(pArray);
...@@ -446,6 +514,11 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen) { ...@@ -446,6 +514,11 @@ void mndTransSetRpcRsp(STrans *pTrans, void *pCont, int32_t contLen) {
pTrans->rpcRspLen = contLen; pTrans->rpcRspLen = contLen;
} }
void mndTransSetDbInfo(STrans *pTrans, SDbObj *pDb) {
pTrans->dbUid = pDb->uid;
memcpy(pTrans->dbname, pDb->name, TSDB_DB_FNAME_LEN);
}
static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
SSdbRaw *pRaw = mndTransActionEncode(pTrans); SSdbRaw *pRaw = mndTransActionEncode(pTrans);
if (pRaw == NULL) { if (pRaw == NULL) {
...@@ -473,7 +546,89 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) { ...@@ -473,7 +546,89 @@ static int32_t mndTransSync(SMnode *pMnode, STrans *pTrans) {
return 0; return 0;
} }
static bool mndIsBasicTrans(STrans *pTrans) {
return pTrans->stage > TRN_TYPE_BASIC_SCOPE && pTrans->stage < TRN_TYPE_BASIC_SCOPE_END;
}
static bool mndIsGlobalTrans(STrans *pTrans) {
return pTrans->stage > TRN_TYPE_GLOBAL_SCOPE && pTrans->stage < TRN_TYPE_GLOBAL_SCOPE_END;
}
static bool mndIsDbTrans(STrans *pTrans) {
return pTrans->stage > TRN_TYPE_DB_SCOPE && pTrans->stage < TRN_TYPE_DB_SCOPE_END;
}
static bool mndIsStbTrans(STrans *pTrans) {
return pTrans->stage > TRN_TYPE_STB_SCOPE && pTrans->stage < TRN_TYPE_STB_SCOPE_END;
}
static int32_t mndCheckTransCanBeStartedInParallel(SMnode *pMnode, STrans *pNewTrans) {
if (mndIsBasicTrans(pNewTrans)) return 0;
STrans *pTrans = NULL;
void *pIter = NULL;
int32_t code = 0;
while (1) {
pIter = sdbFetch(pMnode->pSdb, SDB_TRANS, pIter, (void **)&pTrans);
if (pIter == NULL) break;
if (mndIsGlobalTrans(pNewTrans)) {
if (mndIsDbTrans(pTrans) || mndIsStbTrans(pTrans)) {
mError("trans:%d, can't execute since trans:%d in progress db:%s", pNewTrans->id, pTrans->id, pTrans->dbname);
code = -1;
break;
}
}
if (mndIsDbTrans(pNewTrans)) {
if (mndIsBasicTrans(pTrans)) continue;
if (mndIsGlobalTrans(pTrans)) {
mError("trans:%d, can't execute since trans:%d in progress", pNewTrans->id, pTrans->id);
code = -1;
break;
}
if (mndIsDbTrans(pTrans) || mndIsStbTrans(pTrans)) {
if (pNewTrans->dbUid == pTrans->dbUid) {
mError("trans:%d, can't execute since trans:%d in progress db:%s", pNewTrans->id, pTrans->id, pTrans->dbname);
code = -1;
break;
}
}
}
if (mndIsStbTrans(pNewTrans)) {
if (mndIsBasicTrans(pTrans)) continue;
if (mndIsGlobalTrans(pTrans)) {
mError("trans:%d, can't execute since trans:%d in progress", pNewTrans->id, pTrans->id);
code = -1;
break;
}
if (mndIsDbTrans(pTrans)) {
if (pNewTrans->dbUid == pTrans->dbUid) {
mError("trans:%d, can't execute since trans:%d in progress db:%s", pNewTrans->id, pTrans->id, pTrans->dbname);
code = -1;
break;
}
}
if (mndIsStbTrans(pTrans)) continue;
}
sdbRelease(pMnode->pSdb, pTrans);
}
sdbCancelFetch(pMnode->pSdb, pIter);
sdbRelease(pMnode->pSdb, pTrans);
return code;
}
int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) { int32_t mndTransPrepare(SMnode *pMnode, STrans *pTrans) {
if (mndCheckTransCanBeStartedInParallel(pMnode, pTrans) != 0) {
terrno = TSDB_CODE_MND_TRANS_CANT_PARALLEL;
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
return -1;
}
mDebug("trans:%d, prepare transaction", pTrans->id); mDebug("trans:%d, prepare transaction", pTrans->id);
if (mndTransSync(pMnode, pTrans) != 0) { if (mndTransSync(pMnode, pTrans) != 0) {
mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr()); mError("trans:%d, failed to prepare since %s", pTrans->id, terrstr());
...@@ -941,11 +1096,92 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) { ...@@ -941,11 +1096,92 @@ static void mndTransExecute(SMnode *pMnode, STrans *pTrans) {
mndTransSendRpcRsp(pTrans); mndTransSendRpcRsp(pTrans);
} }
static int32_t mndProcessTransMsg(SMnodeMsg *pMsg) { static int32_t mndProcessTransReq(SMnodeMsg *pReq) {
mndTransPullup(pMsg->pMnode); mndTransPullup(pReq->pMnode);
return 0;
}
static int32_t mndKillTrans(SMnode *pMnode, STrans *pTrans) {
SArray *pArray = NULL;
if (pTrans->stage == TRN_STAGE_REDO_ACTION) {
pArray = pTrans->redoActions;
} else if (pTrans->stage == TRN_STAGE_UNDO_ACTION) {
pArray = pTrans->undoActions;
} else {
terrno = TSDB_CODE_MND_TRANS_INVALID_STAGE;
return -1;
}
int32_t size = taosArrayGetSize(pArray);
for (int32_t i = 0; i < size; ++i) {
STransAction *pAction = taosArrayGet(pArray, i);
if (pAction == NULL) continue;
if (pAction->msgReceived == 0) {
mInfo("trans:%d, action:%d set processed", pTrans->id, i);
pAction->msgSent = 1;
pAction->msgReceived = 1;
pAction->errCode = 0;
}
if (pAction->errCode != 0) {
mInfo("trans:%d, action:%d set processed, errCode from %s to success", pTrans->id, i,
tstrerror(pAction->errCode));
pAction->msgSent = 1;
pAction->msgReceived = 1;
pAction->errCode = 0;
}
}
mndTransExecute(pMnode, pTrans);
return 0; return 0;
} }
static int32_t mndProcessKillTransReq(SMnodeMsg *pReq) {
SMnode *pMnode = pReq->pMnode;
SKillTransReq killReq = {0};
int32_t code = -1;
SUserObj *pUser = NULL;
STrans *pTrans = NULL;
if (tDeserializeSKillTransReq(pReq->rpcMsg.pCont, pReq->rpcMsg.contLen, &killReq) != 0) {
terrno = TSDB_CODE_INVALID_MSG;
goto KILL_OVER;
}
mInfo("trans:%d, start to kill", killReq.transId);
pUser = mndAcquireUser(pMnode, pReq->user);
if (pUser == NULL) {
goto KILL_OVER;
}
if (!pUser->superUser) {
terrno = TSDB_CODE_MND_NO_RIGHTS;
goto KILL_OVER;
}
pTrans = mndAcquireTrans(pMnode, killReq.transId);
if (pTrans == NULL) {
terrno = TSDB_CODE_MND_TRANS_NOT_EXIST;
mError("trans:%d, failed to kill since %s", killReq.transId, terrstr());
return -1;
}
code = mndKillTrans(pMnode, pTrans);
if (code == 0) code = TSDB_CODE_MND_ACTION_IN_PROGRESS;
KILL_OVER:
if (code != 0 && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
mError("trans:%d, failed to kill since %s", killReq.transId, terrstr());
return -1;
}
mndReleaseTrans(pMnode, pTrans);
return code;
}
void mndTransPullup(SMnode *pMnode) { void mndTransPullup(SMnode *pMnode) {
STrans *pTrans = NULL; STrans *pTrans = NULL;
void *pIter = NULL; void *pIter = NULL;
...@@ -960,3 +1196,127 @@ void mndTransPullup(SMnode *pMnode) { ...@@ -960,3 +1196,127 @@ void mndTransPullup(SMnode *pMnode) {
sdbWriteFile(pMnode->pSdb); sdbWriteFile(pMnode->pSdb);
} }
static int32_t mndGetTransMeta(SMnodeMsg *pReq, SShowObj *pShow, STableMetaRsp *pMeta) {
SMnode *pMnode = pReq->pMnode;
SSdb *pSdb = pMnode->pSdb;
int32_t cols = 0;
SSchema *pSchema = pMeta->pSchemas;
pShow->bytes[cols] = 4;
pSchema[cols].type = TSDB_DATA_TYPE_INT;
strcpy(pSchema[cols].name, "id");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = 8;
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
strcpy(pSchema[cols].name, "create_time");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = TSDB_TRANS_STAGE_LEN + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "stage");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = (TSDB_DB_NAME_LEN - 1) + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "db");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = (TSDB_TRANS_DESC_LEN - 1) + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "type");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = 8;
pSchema[cols].type = TSDB_DATA_TYPE_TIMESTAMP;
strcpy(pSchema[cols].name, "last_exec_time");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pShow->bytes[cols] = (TSDB_TRANS_ERROR_LEN - 1) + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "last_error");
pSchema[cols].bytes = pShow->bytes[cols];
cols++;
pMeta->numOfColumns = cols;
pShow->numOfColumns = cols;
pShow->offset[0] = 0;
for (int32_t i = 1; i < cols; ++i) {
pShow->offset[i] = pShow->offset[i - 1] + pShow->bytes[i - 1];
}
pShow->numOfRows = sdbGetSize(pSdb, SDB_TRANS);
pShow->rowSize = pShow->offset[cols - 1] + pShow->bytes[cols - 1];
strcpy(pMeta->tbName, mndShowStr(pShow->type));
return 0;
}
static int32_t mndRetrieveTrans(SMnodeMsg *pReq, SShowObj *pShow, char *data, int32_t rows) {
SMnode *pMnode = pReq->pMnode;
SSdb *pSdb = pMnode->pSdb;
int32_t numOfRows = 0;
STrans *pTrans = NULL;
int32_t cols = 0;
char *pWrite;
while (numOfRows < rows) {
pShow->pIter = sdbFetch(pSdb, SDB_TRANS, pShow->pIter, (void **)&pTrans);
if (pShow->pIter == NULL) break;
cols = 0;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int32_t *)pWrite = pTrans->id;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int64_t *)pWrite = pTrans->createdTime;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_TO_VARSTR(pWrite, mndTransStr(pTrans->stage));
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
char *name = mnGetDbStr(pTrans->dbname);
if (name != NULL) {
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, name, pShow->bytes[cols]);
} else {
STR_TO_VARSTR(pWrite, "-");
}
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_TO_VARSTR(pWrite, mndTransType(pTrans->transType));
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int64_t *)pWrite = pTrans->lastExecTime;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_TO_VARSTR(pWrite, pTrans->lastError);
cols++;
numOfRows++;
sdbRelease(pSdb, pTrans);
}
mndVacuumResult(data, pShow->numOfColumns, numOfRows, rows, pShow);
pShow->numOfReads += numOfRows;
return numOfRows;
}
static void mndCancelGetNextTrans(SMnode *pMnode, void *pIter) {
SSdb *pSdb = pMnode->pSdb;
sdbCancelFetch(pSdb, pIter);
}
...@@ -270,7 +270,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate ...@@ -270,7 +270,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, SCreateUserReq *pCreate
userObj.updateTime = userObj.createdTime; userObj.updateTime = userObj.createdTime;
userObj.superUser = pCreate->superUser; userObj.superUser = pCreate->superUser;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK,TRN_TYPE_CREATE_USER, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("user:%s, failed to create since %s", pCreate->user, terrstr()); mError("user:%s, failed to create since %s", pCreate->user, terrstr());
return -1; return -1;
...@@ -350,7 +350,7 @@ CREATE_USER_OVER: ...@@ -350,7 +350,7 @@ CREATE_USER_OVER:
} }
static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SMnodeMsg *pReq) { static int32_t mndUpdateUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SMnodeMsg *pReq) {
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_TYPE_ALTER_USER,&pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("user:%s, failed to update since %s", pOld->user, terrstr()); mError("user:%s, failed to update since %s", pOld->user, terrstr());
return -1; return -1;
...@@ -511,7 +511,7 @@ ALTER_USER_OVER: ...@@ -511,7 +511,7 @@ ALTER_USER_OVER:
} }
static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pReq, SUserObj *pUser) { static int32_t mndDropUser(SMnode *pMnode, SMnodeMsg *pReq, SUserObj *pUser) {
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, &pReq->rpcMsg); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK,TRN_TYPE_DROP_USER, &pReq->rpcMsg);
if (pTrans == NULL) { if (pTrans == NULL) {
mError("user:%s, failed to drop since %s", pUser->user, terrstr()); mError("user:%s, failed to drop since %s", pUser->user, terrstr());
return -1; return -1;
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "sdbInt.h" #include "sdbInt.h"
static void sdbCheck(SSdb *pSdb, SSdbRow *pRow);
const char *sdbTableName(ESdbType type) { const char *sdbTableName(ESdbType type) {
switch (type) { switch (type) {
case SDB_TRANS: case SDB_TRANS:
...@@ -221,6 +223,8 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow * ...@@ -221,6 +223,8 @@ static int32_t sdbDeleteRow(SSdb *pSdb, SHashObj *hash, SSdbRaw *pRaw, SSdbRow *
pSdb->tableVer[pOldRow->type]++; pSdb->tableVer[pOldRow->type]++;
sdbFreeRow(pSdb, pRow); sdbFreeRow(pSdb, pRow);
sdbCheck(pSdb, pOldRow);
// sdbRelease(pSdb, pOldRow->pObj); // sdbRelease(pSdb, pOldRow->pObj);
return 0; return 0;
} }
...@@ -305,6 +309,19 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, const void *pKey) { ...@@ -305,6 +309,19 @@ void *sdbAcquire(SSdb *pSdb, ESdbType type, const void *pKey) {
return pRet; return pRet;
} }
static void sdbCheck(SSdb *pSdb, SSdbRow *pRow) {
SRWLatch *pLock = &pSdb->locks[pRow->type];
taosRLockLatch(pLock);
int32_t ref = atomic_load_32(&pRow->refCount);
sdbPrintOper(pSdb, pRow, "checkRow");
if (ref <= 0 && pRow->status == SDB_STATUS_DROPPED) {
sdbFreeRow(pSdb, pRow);
}
taosRUnLockLatch(pLock);
}
void sdbRelease(SSdb *pSdb, void *pObj) { void sdbRelease(SSdb *pSdb, void *pObj) {
if (pObj == NULL) return; if (pObj == NULL) return;
...@@ -332,6 +349,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) { ...@@ -332,6 +349,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) {
SRWLatch *pLock = &pSdb->locks[type]; SRWLatch *pLock = &pSdb->locks[type];
taosRLockLatch(pLock); taosRLockLatch(pLock);
#if 0
if (pIter != NULL) { if (pIter != NULL) {
SSdbRow *pLastRow = *(SSdbRow **)pIter; SSdbRow *pLastRow = *(SSdbRow **)pIter;
int32_t ref = atomic_load_32(&pLastRow->refCount); int32_t ref = atomic_load_32(&pLastRow->refCount);
...@@ -339,6 +357,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) { ...@@ -339,6 +357,7 @@ void *sdbFetch(SSdb *pSdb, ESdbType type, void *pIter, void **ppObj) {
sdbFreeRow(pSdb, pLastRow); sdbFreeRow(pSdb, pLastRow);
} }
} }
#endif
SSdbRow **ppRow = taosHashIterate(hash, pIter); SSdbRow **ppRow = taosHashIterate(hash, pIter);
while (ppRow != NULL) { while (ppRow != NULL) {
......
...@@ -264,3 +264,60 @@ void nodesRewriteNodePostOrder(SNode** pNode, FNodeRewriter rewriter, void* pCon ...@@ -264,3 +264,60 @@ void nodesRewriteNodePostOrder(SNode** pNode, FNodeRewriter rewriter, void* pCon
void nodesRewriteListPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* pContext) { void nodesRewriteListPostOrder(SNodeList* pList, FNodeRewriter rewriter, void* pContext) {
(void)rewriteList(pList, TRAVERSAL_POSTORDER, rewriter, pContext); (void)rewriteList(pList, TRAVERSAL_POSTORDER, rewriter, pContext);
} }
void nodesWalkSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeWalker walker, void* pContext) {
if (NULL == pSelect) {
return;
}
switch (clause) {
case SQL_CLAUSE_FROM:
nodesWalkNode(pSelect->pFromTable, walker, pContext);
nodesWalkNode(pSelect->pWhere, walker, pContext);
case SQL_CLAUSE_WHERE:
nodesWalkList(pSelect->pPartitionByList, walker, pContext);
case SQL_CLAUSE_PARTITION_BY:
nodesWalkNode(pSelect->pWindow, walker, pContext);
case SQL_CLAUSE_WINDOW:
nodesWalkList(pSelect->pGroupByList, walker, pContext);
case SQL_CLAUSE_GROUP_BY:
nodesWalkNode(pSelect->pHaving, walker, pContext);
case SQL_CLAUSE_HAVING:
nodesWalkList(pSelect->pProjectionList, walker, pContext);
case SQL_CLAUSE_SELECT:
nodesWalkList(pSelect->pOrderByList, walker, pContext);
case SQL_CLAUSE_ORDER_BY:
default:
break;
}
return;
}
void nodesRewriteSelectStmt(SSelectStmt* pSelect, ESqlClause clause, FNodeRewriter rewriter, void* pContext) {
if (NULL == pSelect) {
return;
}
switch (clause) {
case SQL_CLAUSE_FROM:
nodesRewriteNode(&(pSelect->pFromTable), rewriter, pContext);
nodesRewriteNode(&(pSelect->pWhere), rewriter, pContext);
case SQL_CLAUSE_WHERE:
nodesRewriteList(pSelect->pPartitionByList, rewriter, pContext);
case SQL_CLAUSE_PARTITION_BY:
nodesRewriteNode(&(pSelect->pWindow), rewriter, pContext);
case SQL_CLAUSE_WINDOW:
nodesRewriteList(pSelect->pGroupByList, rewriter, pContext);
case SQL_CLAUSE_GROUP_BY:
nodesRewriteNode(&(pSelect->pHaving), rewriter, pContext);
case SQL_CLAUSE_HAVING:
nodesRewriteList(pSelect->pProjectionList, rewriter, pContext);
case SQL_CLAUSE_SELECT:
nodesRewriteList(pSelect->pOrderByList, rewriter, pContext);
default:
break;
}
return;
}
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
#include "querynodes.h" #include "querynodes.h"
#include "nodesShowStmts.h" #include "nodesShowStmts.h"
#include "taos.h"
#include "taoserror.h" #include "taoserror.h"
#include "thash.h"
static SNode* makeNode(ENodeType type, size_t size) { static SNode* makeNode(ENodeType type, size_t size) {
SNode* p = calloc(1, size); SNode* p = calloc(1, size);
...@@ -98,14 +100,14 @@ SNodeList* nodesMakeList() { ...@@ -98,14 +100,14 @@ SNodeList* nodesMakeList() {
return p; return p;
} }
SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode) { int32_t nodesListAppend(SNodeList* pList, SNode* pNode) {
if (NULL == pList || NULL == pNode) { if (NULL == pList || NULL == pNode) {
return NULL; return TSDB_CODE_SUCCESS;
} }
SListCell* p = calloc(1, sizeof(SListCell)); SListCell* p = calloc(1, sizeof(SListCell));
if (NULL == p) { if (NULL == p) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;
return pList; return TSDB_CODE_OUT_OF_MEMORY;
} }
p->pNode = pNode; p->pNode = pNode;
if (NULL == pList->pHead) { if (NULL == pList->pHead) {
...@@ -116,7 +118,7 @@ SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode) { ...@@ -116,7 +118,7 @@ SNodeList* nodesListAppend(SNodeList* pList, SNode* pNode) {
} }
pList->pTail = p; pList->pTail = p;
++(pList->length); ++(pList->length);
return pList; return TSDB_CODE_SUCCESS;
} }
SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) { SListCell* nodesListErase(SNodeList* pList, SListCell* pCell) {
...@@ -207,4 +209,100 @@ bool nodesIsTimeorderQuery(const SNode* pQuery) { ...@@ -207,4 +209,100 @@ bool nodesIsTimeorderQuery(const SNode* pQuery) {
bool nodesIsTimelineQuery(const SNode* pQuery) { bool nodesIsTimelineQuery(const SNode* pQuery) {
return false; return false;
} }
\ No newline at end of file
typedef struct SCollectColumnsCxt {
int32_t errCode;
uint64_t tableId;
bool realCol;
SNodeList* pCols;
SHashObj* pColIdHash;
} SCollectColumnsCxt;
static EDealRes doCollect(SCollectColumnsCxt* pCxt, int32_t id, SNode* pNode) {
if (NULL == taosHashGet(pCxt->pColIdHash, &id, sizeof(id))) {
pCxt->errCode = taosHashPut(pCxt->pColIdHash, &id, sizeof(id), NULL, 0);
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
pCxt->errCode = nodesListAppend(pCxt->pCols, pNode);
}
return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR);
}
return DEAL_RES_CONTINUE;
}
static EDealRes collectColumns(SNode* pNode, void* pContext) {
SCollectColumnsCxt* pCxt = (SCollectColumnsCxt*)pContext;
if (pCxt->realCol && QUERY_NODE_COLUMN == nodeType(pNode)) {
SColumnNode* pCol = (SColumnNode*)pNode;
int32_t colId = pCol->colId;
if (pCxt->tableId == pCol->tableId && colId > 0) {
return doCollect(pCxt, colId, pNode);
}
} else if (!pCxt->realCol && QUERY_NODE_COLUMN_REF == nodeType(pNode)) {
return doCollect(pCxt, ((SColumnRefNode*)pNode)->slotId, pNode);
}
return DEAL_RES_CONTINUE;
}
int32_t nodesCollectColumns(SSelectStmt* pSelect, ESqlClause clause, uint64_t tableId, bool realCol, SNodeList** pCols) {
if (NULL == pSelect || NULL == pCols) {
return TSDB_CODE_SUCCESS;
}
SCollectColumnsCxt cxt = {
.errCode = TSDB_CODE_SUCCESS,
.realCol = realCol,
.pCols = nodesMakeList(),
.pColIdHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK)
};
if (NULL == cxt.pCols || NULL == cxt.pColIdHash) {
return TSDB_CODE_OUT_OF_MEMORY;
}
nodesWalkSelectStmt(pSelect, clause, collectColumns, &cxt);
taosHashCleanup(cxt.pColIdHash);
if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyList(cxt.pCols);
return cxt.errCode;
}
*pCols = cxt.pCols;
return TSDB_CODE_SUCCESS;
}
typedef struct SCollectFuncsCxt {
int32_t errCode;
FFuncClassifier classifier;
SNodeList* pFuncs;
} SCollectFuncsCxt;
static EDealRes collectFuncs(SNode* pNode, void* pContext) {
SCollectFuncsCxt* pCxt = (SCollectFuncsCxt*)pContext;
if (QUERY_NODE_FUNCTION == nodeType(pNode) && pCxt->classifier(((SFunctionNode*)pNode)->funcId)) {
pCxt->errCode = nodesListAppend(pCxt->pFuncs, pNode);
return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR);
}
return DEAL_RES_CONTINUE;
}
int32_t nodesCollectFuncs(SSelectStmt* pSelect, FFuncClassifier classifier, SNodeList** pFuncs) {
if (NULL == pSelect || NULL == pFuncs) {
return TSDB_CODE_SUCCESS;
}
SCollectFuncsCxt cxt = {
.errCode = TSDB_CODE_SUCCESS,
.classifier = classifier,
.pFuncs = nodesMakeList()
};
if (NULL == cxt.pFuncs) {
return TSDB_CODE_OUT_OF_MEMORY;
}
nodesWalkSelectStmt(pSelect, SQL_CLAUSE_GROUP_BY, collectFuncs, &cxt);
if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyList(cxt.pFuncs);
return cxt.errCode;
}
*pFuncs = cxt.pFuncs;
return TSDB_CODE_SUCCESS;
}
...@@ -170,6 +170,7 @@ typedef struct SCreateDbInfo { ...@@ -170,6 +170,7 @@ typedef struct SCreateDbInfo {
int8_t update; int8_t update;
int8_t cachelast; int8_t cachelast;
SArray *keep; SArray *keep;
int8_t streamMode;
} SCreateDbInfo; } SCreateDbInfo;
typedef struct SCreateFuncInfo { typedef struct SCreateFuncInfo {
......
...@@ -76,7 +76,7 @@ cmd ::= SHOW QUERIES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0); ...@@ -76,7 +76,7 @@ cmd ::= SHOW QUERIES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_QUERIES, 0, 0);
cmd ::= SHOW CONNECTIONS.{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);} cmd ::= SHOW CONNECTIONS.{ setShowOptions(pInfo, TSDB_MGMT_TABLE_CONNS, 0, 0);}
cmd ::= SHOW STREAMS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); } cmd ::= SHOW STREAMS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_STREAMS, 0, 0); }
cmd ::= SHOW VARIABLES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); } cmd ::= SHOW VARIABLES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); }
cmd ::= SHOW SCORES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } cmd ::= SHOW SCORES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_TRANS, 0, 0); }
cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } cmd ::= SHOW GRANTS. { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); }
cmd ::= SHOW VNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); } cmd ::= SHOW VNODES. { setShowOptions(pInfo, TSDB_MGMT_TABLE_VNODES, 0, 0); }
...@@ -282,6 +282,7 @@ update(Y) ::= UPDATE INTEGER(X). { Y = X; } ...@@ -282,6 +282,7 @@ update(Y) ::= UPDATE INTEGER(X). { Y = X; }
cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; } cachelast(Y) ::= CACHELAST INTEGER(X). { Y = X; }
vgroups(Y) ::= VGROUPS INTEGER(X). { Y = X; } vgroups(Y) ::= VGROUPS INTEGER(X). { Y = X; }
//partitions(Y) ::= PARTITIONS INTEGER(X). { Y = X; } //partitions(Y) ::= PARTITIONS INTEGER(X). { Y = X; }
stream_mode(Y) ::= STREAM MODE INTEGER(X). { Y = X; }
%type db_optr {SCreateDbInfo} %type db_optr {SCreateDbInfo}
db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);} db_optr(Y) ::= . {setDefaultCreateDbOption(&Y);}
...@@ -302,6 +303,7 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; } ...@@ -302,6 +303,7 @@ db_optr(Y) ::= db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
db_optr(Y) ::= db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) vgroups(X). { Y = Z; Y.numOfVgroups = strtol(X.z, NULL, 10); } db_optr(Y) ::= db_optr(Z) vgroups(X). { Y = Z; Y.numOfVgroups = strtol(X.z, NULL, 10); }
db_optr(Y) ::= db_optr(Z) stream_mode(X). { Y = Z; Y.streamMode = strtol(X.z, NULL, 10); }
//%type topic_optr {SCreateDbInfo} //%type topic_optr {SCreateDbInfo}
// //
......
...@@ -96,11 +96,17 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) { ...@@ -96,11 +96,17 @@ SToken getTokenFromRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode) { SNodeList* createNodeList(SAstCreateContext* pCxt, SNode* pNode) {
SNodeList* list = nodesMakeList(); SNodeList* list = nodesMakeList();
CHECK_OUT_OF_MEM(list); CHECK_OUT_OF_MEM(list);
return nodesListAppend(list, pNode); if (TSDB_CODE_SUCCESS != nodesListAppend(list, pNode)) {
pCxt->valid = false;
}
return list;
} }
SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode) { SNodeList* addNodeToList(SAstCreateContext* pCxt, SNodeList* pList, SNode* pNode) {
return nodesListAppend(pList, pNode); if (TSDB_CODE_SUCCESS != nodesListAppend(pList, pNode)) {
pCxt->valid = false;
}
return pList;
} }
SNode* createColumnNode(SAstCreateContext* pCxt, const SToken* pTableAlias, const SToken* pColumnName) { SNode* createColumnNode(SAstCreateContext* pCxt, const SToken* pTableAlias, const SToken* pColumnName) {
......
...@@ -242,6 +242,7 @@ static void doSetDbOptions(SCreateDbReq* pMsg, const SCreateDbInfo* pCreateDb) { ...@@ -242,6 +242,7 @@ static void doSetDbOptions(SCreateDbReq* pMsg, const SCreateDbInfo* pCreateDb) {
pMsg->update = pCreateDb->update; pMsg->update = pCreateDb->update;
pMsg->cacheLastRow = pCreateDb->cachelast; pMsg->cacheLastRow = pCreateDb->cachelast;
pMsg->numOfVgroups = pCreateDb->numOfVgroups; pMsg->numOfVgroups = pCreateDb->numOfVgroups;
pMsg->streamMode = pCreateDb->streamMode;
} }
int32_t setDbOptions(SCreateDbReq* pCreateDbMsg, const SCreateDbInfo* pCreateDbSql, SMsgBuf* pMsgBuf) { int32_t setDbOptions(SCreateDbReq* pCreateDbMsg, const SCreateDbInfo* pCreateDbSql, SMsgBuf* pMsgBuf) {
......
...@@ -241,17 +241,6 @@ abort_parse: ...@@ -241,17 +241,6 @@ abort_parse:
return cxt.valid ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED; return cxt.valid ? TSDB_CODE_SUCCESS : TSDB_CODE_FAILED;
} }
typedef enum ESqlClause {
SQL_CLAUSE_FROM = 1,
SQL_CLAUSE_WHERE,
SQL_CLAUSE_PARTITION_BY,
SQL_CLAUSE_WINDOW,
SQL_CLAUSE_GROUP_BY,
SQL_CLAUSE_HAVING,
SQL_CLAUSE_SELECT,
SQL_CLAUSE_ORDER_BY
} ESqlClause;
static bool afterGroupBy(ESqlClause clause) { static bool afterGroupBy(ESqlClause clause) {
return clause > SQL_CLAUSE_GROUP_BY; return clause > SQL_CLAUSE_GROUP_BY;
} }
...@@ -298,7 +287,7 @@ static char* getSyntaxErrFormat(int32_t errCode) { ...@@ -298,7 +287,7 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "Not SELECTed expression"; return "Not SELECTed expression";
case TSDB_CODE_PAR_NOT_SINGLE_GROUP: case TSDB_CODE_PAR_NOT_SINGLE_GROUP:
return "Not a single-group group function"; return "Not a single-group group function";
case TSDB_CODE_PAR_OUT_OF_MEMORY: case TSDB_CODE_OUT_OF_MEMORY:
return "Out of memory"; return "Out of memory";
default: default:
return "Unknown error"; return "Unknown error";
...@@ -360,14 +349,15 @@ static SNodeList* getProjectList(SNode* pNode) { ...@@ -360,14 +349,15 @@ static SNodeList* getProjectList(SNode* pNode) {
return NULL; return NULL;
} }
static void setColumnInfoBySchema(const STableNode* pTable, const SSchema* pColSchema, SColumnNode* pCol) { static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* pColSchema, SColumnNode* pCol) {
strcpy(pCol->dbName, pTable->dbName); strcpy(pCol->dbName, pTable->table.dbName);
strcpy(pCol->tableAlias, pTable->tableAlias); strcpy(pCol->tableAlias, pTable->table.tableAlias);
strcpy(pCol->tableName, pTable->tableName); strcpy(pCol->tableName, pTable->table.tableName);
strcpy(pCol->colName, pColSchema->name); strcpy(pCol->colName, pColSchema->name);
if ('\0' == pCol->node.aliasName[0]) { if ('\0' == pCol->node.aliasName[0]) {
strcpy(pCol->node.aliasName, pColSchema->name); strcpy(pCol->node.aliasName, pColSchema->name);
} }
pCol->tableId = pTable->pMeta->uid;
pCol->colId = pColSchema->colId; pCol->colId = pColSchema->colId;
// pCol->colType = pColSchema->type; // pCol->colType = pColSchema->type;
pCol->node.resType.type = pColSchema->type; pCol->node.resType.type = pColSchema->type;
...@@ -376,7 +366,7 @@ static void setColumnInfoBySchema(const STableNode* pTable, const SSchema* pColS ...@@ -376,7 +366,7 @@ static void setColumnInfoBySchema(const STableNode* pTable, const SSchema* pColS
static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SColumnNode* pCol) { static void setColumnInfoByExpr(const STableNode* pTable, SExprNode* pExpr, SColumnNode* pCol) {
pCol->pProjectRef = (SNode*)pExpr; pCol->pProjectRef = (SNode*)pExpr;
pExpr->pAssociationList = nodesListAppend(pExpr->pAssociationList, (SNode*)pCol); nodesListAppend(pExpr->pAssociationList, (SNode*)pCol);
if (NULL != pTable) { if (NULL != pTable) {
strcpy(pCol->tableAlias, pTable->tableAlias); strcpy(pCol->tableAlias, pTable->tableAlias);
} }
...@@ -391,9 +381,9 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode ...@@ -391,9 +381,9 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode
for (int32_t i = 0; i < nums; ++i) { for (int32_t i = 0; i < nums; ++i) {
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) { if (NULL == pCol) {
return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
} }
setColumnInfoBySchema(pTable, pMeta->schema + i, pCol); setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, pCol);
nodesListAppend(pList, (SNode*)pCol); nodesListAppend(pList, (SNode*)pCol);
} }
} else { } else {
...@@ -402,7 +392,7 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode ...@@ -402,7 +392,7 @@ static int32_t createColumnNodeByTable(STranslateContext* pCxt, const STableNode
FOREACH(pNode, pProjectList) { FOREACH(pNode, pProjectList) {
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) { if (NULL == pCol) {
return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
} }
setColumnInfoByExpr(pTable, (SExprNode*)pNode, pCol); setColumnInfoByExpr(pTable, (SExprNode*)pNode, pCol);
nodesListAppend(pList, (SNode*)pCol); nodesListAppend(pList, (SNode*)pCol);
...@@ -418,7 +408,7 @@ static bool findAndSetColumn(SColumnNode* pCol, const STableNode* pTable) { ...@@ -418,7 +408,7 @@ static bool findAndSetColumn(SColumnNode* pCol, const STableNode* pTable) {
int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns; int32_t nums = pMeta->tableInfo.numOfTags + pMeta->tableInfo.numOfColumns;
for (int32_t i = 0; i < nums; ++i) { for (int32_t i = 0; i < nums; ++i) {
if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) { if (0 == strcmp(pCol->colName, pMeta->schema[i].name)) {
setColumnInfoBySchema(pTable, pMeta->schema + i, pCol); setColumnInfoBySchema((SRealTableNode*)pTable, pMeta->schema + i, pCol);
found = true; found = true;
break; break;
} }
...@@ -572,7 +562,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { ...@@ -572,7 +562,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
int32_t n = strlen(pVal->literal); int32_t n = strlen(pVal->literal);
pVal->datum.p = calloc(1, n); pVal->datum.p = calloc(1, n);
if (NULL == pVal->datum.p) { if (NULL == pVal->datum.p) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
return DEAL_RES_ERROR; return DEAL_RES_ERROR;
} }
trimStringCopy(pVal->literal, n, pVal->datum.p); trimStringCopy(pVal->literal, n, pVal->datum.p);
...@@ -582,7 +572,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) { ...@@ -582,7 +572,7 @@ static EDealRes translateValue(STranslateContext* pCxt, SValueNode* pVal) {
int32_t n = strlen(pVal->literal); int32_t n = strlen(pVal->literal);
char* tmp = calloc(1, n); char* tmp = calloc(1, n);
if (NULL == tmp) { if (NULL == tmp) {
generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
return DEAL_RES_ERROR; return DEAL_RES_ERROR;
} }
int32_t len = trimStringCopy(pVal->literal, n, tmp); int32_t len = trimStringCopy(pVal->literal, n, tmp);
...@@ -830,7 +820,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect, bool ...@@ -830,7 +820,7 @@ static int32_t translateStar(STranslateContext* pCxt, SSelectStmt* pSelect, bool
size_t nums = taosArrayGetSize(pTables); size_t nums = taosArrayGetSize(pTables);
pSelect->pProjectionList = nodesMakeList(); pSelect->pProjectionList = nodesMakeList();
if (NULL == pSelect->pProjectionList) { if (NULL == pSelect->pProjectionList) {
return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
} }
for (size_t i = 0; i < nums; ++i) { for (size_t i = 0; i < nums; ++i) {
STableNode* pTable = taosArrayGetP(pTables, i); STableNode* pTable = taosArrayGetP(pTables, i);
...@@ -897,7 +887,7 @@ static int32_t translateOrderByPosition(STranslateContext* pCxt, SNodeList* pPro ...@@ -897,7 +887,7 @@ static int32_t translateOrderByPosition(STranslateContext* pCxt, SNodeList* pPro
} else { } else {
SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN); SColumnNode* pCol = (SColumnNode*)nodesMakeNode(QUERY_NODE_COLUMN);
if (NULL == pCol) { if (NULL == pCol) {
return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
} }
setColumnInfoByExpr(NULL, (SExprNode*)nodesListGetNode(pProjectionList, pos - 1), pCol); setColumnInfoByExpr(NULL, (SExprNode*)nodesListGetNode(pProjectionList, pos - 1), pCol);
((SOrderByExprNode*)pNode)->pExpr = (SNode*)pCol; ((SOrderByExprNode*)pNode)->pExpr = (SNode*)pCol;
...@@ -1036,7 +1026,7 @@ int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) { ...@@ -1036,7 +1026,7 @@ int32_t setReslutSchema(STranslateContext* pCxt, SQuery* pQuery) {
pQuery->numOfResCols = LIST_LENGTH(pSelect->pProjectionList); pQuery->numOfResCols = LIST_LENGTH(pSelect->pProjectionList);
pQuery->pResSchema = calloc(pQuery->numOfResCols, sizeof(SSchema)); pQuery->pResSchema = calloc(pQuery->numOfResCols, sizeof(SSchema));
if (NULL == pQuery->pResSchema) { if (NULL == pQuery->pResSchema) {
return generateSyntaxErrMsg(pCxt, TSDB_CODE_PAR_OUT_OF_MEMORY); return generateSyntaxErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
} }
SNode* pNode; SNode* pNode;
int32_t index = 0; int32_t index = 0;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
** input grammar file: ** input grammar file:
*/ */
#include <stdio.h> #include <stdio.h>
#include <assert.h>
/************ Begin %include sections from the grammar ************************/ /************ Begin %include sections from the grammar ************************/
#include <stdio.h> #include <stdio.h>
...@@ -76,8 +77,10 @@ ...@@ -76,8 +77,10 @@
** zero the stack is dynamically sized using realloc() ** zero the stack is dynamically sized using realloc()
** ParseARG_SDECL A static variable declaration for the %extra_argument ** ParseARG_SDECL A static variable declaration for the %extra_argument
** ParseARG_PDECL A parameter declaration for the %extra_argument ** ParseARG_PDECL A parameter declaration for the %extra_argument
** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
** ParseARG_STORE Code to store %extra_argument into yypParser ** ParseARG_STORE Code to store %extra_argument into yypParser
** ParseARG_FETCH Code to extract %extra_argument from yypParser ** ParseARG_FETCH Code to extract %extra_argument from yypParser
** ParseCTX_* As ParseARG_ except for %extra_context
** YYERRORSYMBOL is the code number of the error symbol. If not ** YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing. ** defined, then do no error processing.
** YYNSTATE the combined number of states. ** YYNSTATE the combined number of states.
...@@ -103,45 +106,52 @@ ...@@ -103,45 +106,52 @@
typedef union { typedef union {
int yyinit; int yyinit;
ParseTOKENTYPE yy0; ParseTOKENTYPE yy0;
SWindowStateVal yy6; SVariant yy1;
SRelationInfo* yy10; SField yy16;
SCreateDbInfo yy16; int yy40;
int32_t yy46; SIntervalVal yy52;
int yy47; int64_t yy61;
SSessionWindowVal yy97; SSubclause* yy93;
SField yy106; SWindowStateVal yy112;
SCreatedTableInfo yy150; SRelationInfo* yy160;
SArray* yy165; SCreatedTableInfo yy184;
tSqlExpr* yy202; SSqlNode* yy185;
int64_t yy207; SArray* yy225;
SCreateAcctInfo yy211; tSqlExpr* yy226;
SSqlNode* yy278; SCreateDbInfo yy326;
SCreateTableSql* yy326; int32_t yy460;
SLimit yy367; SSessionWindowVal yy463;
SVariant yy425; SCreateTableSql* yy482;
SSubclause* yy503; SLimit yy495;
SIntervalVal yy532; SCreateAcctInfo yy523;
} YYMINORTYPE; } YYMINORTYPE;
#ifndef YYSTACKDEPTH #ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100 #define YYSTACKDEPTH 100
#endif #endif
#define ParseARG_SDECL SSqlInfo* pInfo; #define ParseARG_SDECL SSqlInfo* pInfo;
#define ParseARG_PDECL ,SSqlInfo* pInfo #define ParseARG_PDECL ,SSqlInfo* pInfo
#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo #define ParseARG_PARAM ,pInfo
#define ParseARG_STORE yypParser->pInfo = pInfo #define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo;
#define ParseARG_STORE yypParser->pInfo=pInfo;
#define ParseCTX_SDECL
#define ParseCTX_PDECL
#define ParseCTX_PARAM
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1 #define YYFALLBACK 1
#define YYNSTATE 366 #define YYNSTATE 368
#define YYNRULE 302 #define YYNRULE 304
#define YYNTOKEN 191 #define YYNTOKEN 192
#define YY_MAX_SHIFT 365 #define YY_MAX_SHIFT 367
#define YY_MIN_SHIFTREDUCE 586 #define YY_MIN_SHIFTREDUCE 590
#define YY_MAX_SHIFTREDUCE 887 #define YY_MAX_SHIFTREDUCE 893
#define YY_ERROR_ACTION 888 #define YY_ERROR_ACTION 894
#define YY_ACCEPT_ACTION 889 #define YY_ACCEPT_ACTION 895
#define YY_NO_ACTION 890 #define YY_NO_ACTION 896
#define YY_MIN_REDUCE 891 #define YY_MIN_REDUCE 897
#define YY_MAX_REDUCE 1192 #define YY_MAX_REDUCE 1200
/************* End control #defines *******************************************/ /************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
/* Define the yytestcase() macro to be a no-op if is not already defined /* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise. ** otherwise.
...@@ -206,292 +216,294 @@ typedef union { ...@@ -206,292 +216,294 @@ typedef union {
** yy_default[] Default action for each state. ** yy_default[] Default action for each state.
** **
*********** Begin parsing tables **********************************************/ *********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (777) #define YY_ACTTAB_COUNT (781)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 249, 637, 637, 1077, 83, 717, 248, 55, 56, 88, /* 0 */ 91, 641, 242, 1085, 676, 249, 1050, 55, 56, 641,
/* 10 */ 59, 60, 364, 230, 252, 49, 48, 47, 78, 58, /* 10 */ 59, 60, 895, 367, 252, 49, 48, 47, 1075, 58,
/* 20 */ 323, 63, 61, 64, 62, 236, 1054, 889, 365, 54, /* 20 */ 325, 63, 61, 64, 62, 641, 641, 366, 230, 54,
/* 30 */ 53, 343, 342, 52, 51, 50, 253, 55, 56, 242, /* 30 */ 53, 206, 248, 52, 51, 50, 233, 55, 56, 246,
/* 40 */ 59, 60, 1027, 1042, 252, 49, 48, 47, 104, 58, /* 40 */ 59, 60, 1176, 1050, 252, 49, 48, 47, 104, 58,
/* 50 */ 323, 63, 61, 64, 62, 1014, 637, 1012, 1013, 54, /* 50 */ 325, 63, 61, 64, 62, 1022, 21, 1020, 1021, 54,
/* 60 */ 53, 206, 1015, 52, 51, 50, 1016, 206, 1017, 1018, /* 60 */ 53, 1075, 1023, 52, 51, 50, 1024, 206, 1025, 1026,
/* 70 */ 121, 1074, 1169, 55, 56, 1067, 59, 60, 1169, 27, /* 70 */ 280, 279, 1082, 55, 56, 1044, 59, 60, 1177, 274,
/* 80 */ 252, 49, 48, 47, 89, 58, 323, 63, 61, 64, /* 80 */ 252, 49, 48, 47, 89, 58, 325, 63, 61, 64,
/* 90 */ 62, 206, 39, 274, 246, 54, 53, 206, 1042, 52, /* 90 */ 62, 39, 236, 1062, 206, 54, 53, 362, 982, 52,
/* 100 */ 51, 50, 1168, 55, 57, 1030, 59, 60, 1169, 824, /* 100 */ 51, 50, 27, 55, 57, 1177, 59, 60, 323, 830,
/* 110 */ 252, 49, 48, 47, 80, 58, 323, 63, 61, 64, /* 110 */ 252, 49, 48, 47, 1075, 58, 325, 63, 61, 64,
/* 120 */ 62, 294, 637, 81, 159, 54, 53, 91, 319, 52, /* 120 */ 62, 243, 294, 80, 81, 54, 53, 795, 796, 52,
/* 130 */ 51, 50, 104, 1067, 56, 232, 59, 60, 353, 1039, /* 130 */ 51, 50, 234, 116, 56, 232, 59, 60, 311, 1047,
/* 140 */ 252, 49, 48, 47, 261, 58, 323, 63, 61, 64, /* 140 */ 252, 49, 48, 47, 104, 58, 325, 63, 61, 64,
/* 150 */ 62, 233, 43, 124, 79, 54, 53, 80, 39, 52, /* 150 */ 62, 42, 776, 361, 360, 54, 53, 952, 359, 52,
/* 160 */ 51, 50, 587, 588, 589, 590, 591, 592, 593, 594, /* 160 */ 51, 50, 358, 43, 357, 356, 1033, 1034, 30, 1037,
/* 170 */ 595, 596, 597, 598, 599, 600, 199, 309, 231, 59, /* 170 */ 253, 42, 319, 361, 360, 318, 317, 316, 359, 315,
/* 180 */ 60, 939, 1067, 252, 49, 48, 47, 158, 58, 323, /* 180 */ 314, 313, 358, 312, 357, 356, 310, 1014, 1002, 1003,
/* 190 */ 63, 61, 64, 62, 353, 43, 280, 279, 54, 53, /* 190 */ 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013,
/* 200 */ 234, 240, 52, 51, 50, 1039, 14, 1116, 13, 292, /* 200 */ 1015, 1016, 1017, 1018, 641, 59, 60, 159, 773, 252,
/* 210 */ 42, 317, 359, 358, 316, 315, 314, 357, 313, 312, /* 210 */ 49, 48, 47, 113, 58, 325, 63, 61, 64, 62,
/* 220 */ 311, 356, 310, 355, 354, 1007, 995, 996, 997, 998, /* 220 */ 1124, 355, 292, 355, 54, 53, 836, 839, 52, 51,
/* 230 */ 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, /* 230 */ 50, 282, 206, 54, 53, 7, 321, 52, 51, 50,
/* 240 */ 1010, 266, 12, 22, 63, 61, 64, 62, 84, 21, /* 240 */ 780, 723, 22, 1177, 591, 592, 593, 594, 595, 596,
/* 250 */ 270, 269, 54, 53, 789, 790, 52, 51, 50, 946, /* 250 */ 597, 598, 599, 600, 601, 602, 603, 604, 199, 215,
/* 260 */ 215, 113, 251, 839, 828, 831, 834, 216, 753, 750, /* 260 */ 231, 251, 845, 834, 837, 840, 216, 345, 344, 198,
/* 270 */ 751, 752, 672, 175, 174, 172, 217, 119, 261, 282, /* 270 */ 195, 193, 175, 174, 172, 217, 80, 321, 83, 330,
/* 280 */ 328, 80, 251, 839, 828, 831, 834, 127, 116, 203, /* 280 */ 80, 251, 845, 834, 837, 840, 52, 51, 50, 228,
/* 290 */ 228, 229, 255, 39, 324, 257, 258, 745, 742, 743, /* 290 */ 229, 121, 78, 326, 63, 61, 64, 62, 759, 756,
/* 300 */ 744, 204, 39, 1036, 3, 32, 131, 261, 209, 260, /* 300 */ 757, 758, 54, 53, 835, 838, 52, 51, 50, 228,
/* 310 */ 228, 229, 129, 85, 123, 133, 1040, 39, 39, 43, /* 310 */ 229, 255, 751, 748, 749, 750, 43, 1061, 79, 203,
/* 320 */ 1025, 1026, 30, 1029, 244, 245, 189, 186, 183, 52, /* 320 */ 43, 3, 32, 131, 39, 257, 258, 1038, 104, 129,
/* 330 */ 51, 50, 305, 181, 179, 178, 177, 176, 319, 65, /* 330 */ 85, 123, 133, 104, 39, 945, 39, 39, 65, 244,
/* 340 */ 1038, 273, 637, 86, 42, 241, 359, 358, 243, 1039, /* 340 */ 245, 158, 273, 39, 86, 39, 843, 746, 747, 305,
/* 350 */ 224, 357, 770, 830, 833, 356, 39, 355, 354, 65, /* 350 */ 260, 224, 189, 186, 183, 149, 142, 162, 65, 181,
/* 360 */ 332, 333, 54, 53, 1039, 1039, 52, 51, 50, 256, /* 360 */ 179, 178, 177, 176, 167, 170, 160, 39, 240, 269,
/* 370 */ 39, 254, 39, 331, 330, 840, 835, 104, 39, 39, /* 370 */ 39, 88, 1047, 164, 204, 39, 846, 841, 241, 209,
/* 380 */ 754, 755, 836, 149, 142, 162, 262, 39, 259, 806, /* 380 */ 334, 335, 1047, 842, 1047, 1047, 812, 336, 39, 337,
/* 390 */ 338, 337, 167, 170, 160, 840, 835, 829, 832, 334, /* 390 */ 256, 1047, 254, 1047, 333, 332, 846, 841, 327, 266,
/* 400 */ 104, 164, 836, 1039, 826, 363, 362, 190, 767, 746, /* 400 */ 12, 261, 39, 842, 1123, 1035, 84, 261, 270, 82,
/* 410 */ 747, 92, 949, 335, 940, 339, 93, 1039, 158, 1039, /* 410 */ 124, 341, 760, 761, 342, 1047, 127, 92, 1047, 343,
/* 420 */ 158, 340, 341, 71, 321, 1039, 1039, 198, 195, 193, /* 420 */ 365, 364, 190, 1047, 844, 93, 752, 753, 71, 262,
/* 430 */ 345, 360, 976, 7, 1039, 275, 827, 786, 774, 796, /* 430 */ 35, 259, 347, 340, 339, 275, 1047, 119, 955, 261,
/* 440 */ 797, 74, 727, 297, 729, 299, 325, 805, 35, 70, /* 440 */ 792, 946, 802, 803, 158, 74, 811, 158, 1048, 832,
/* 450 */ 210, 40, 1115, 97, 70, 66, 24, 728, 40, 40, /* 450 */ 1046, 40, 733, 297, 744, 745, 97, 70, 66, 24,
/* 460 */ 67, 117, 740, 741, 72, 738, 739, 862, 841, 250, /* 460 */ 735, 299, 734, 868, 847, 70, 300, 250, 40, 40,
/* 470 */ 636, 837, 140, 67, 139, 82, 16, 18, 15, 17, /* 470 */ 1049, 72, 640, 14, 77, 13, 67, 117, 67, 23,
/* 480 */ 75, 211, 300, 23, 23, 77, 23, 758, 759, 169, /* 480 */ 23, 833, 210, 140, 211, 139, 75, 1171, 23, 4,
/* 490 */ 168, 4, 756, 757, 147, 20, 146, 19, 1163, 1162, /* 490 */ 1170, 16, 18, 15, 17, 764, 765, 762, 763, 147,
/* 500 */ 1161, 226, 227, 207, 208, 212, 1053, 1041, 205, 1126, /* 500 */ 1134, 146, 20, 1169, 19, 849, 169, 168, 226, 722,
/* 510 */ 213, 214, 219, 220, 221, 838, 218, 202, 716, 1188, /* 510 */ 227, 207, 208, 212, 205, 1196, 213, 214, 219, 220,
/* 520 */ 1180, 1125, 1069, 238, 1122, 1121, 239, 44, 1068, 344, /* 520 */ 1188, 221, 1077, 218, 202, 1133, 238, 44, 1130, 1076,
/* 530 */ 277, 114, 322, 1108, 1107, 196, 271, 785, 1037, 276, /* 530 */ 277, 1129, 239, 346, 114, 1116, 1115, 324, 196, 271,
/* 540 */ 1065, 87, 1076, 1087, 281, 235, 73, 90, 1084, 1085, /* 540 */ 791, 76, 281, 1045, 235, 276, 73, 87, 1084, 283,
/* 550 */ 76, 843, 283, 1089, 295, 46, 105, 106, 94, 107, /* 550 */ 285, 1095, 295, 46, 293, 291, 90, 108, 94, 1092,
/* 560 */ 293, 95, 101, 108, 285, 291, 288, 286, 109, 1109, /* 560 */ 1093, 1097, 95, 1073, 101, 286, 288, 1117, 105, 106,
/* 570 */ 289, 110, 287, 111, 284, 112, 29, 45, 225, 115, /* 570 */ 107, 109, 289, 110, 111, 287, 284, 112, 45, 29,
/* 580 */ 1035, 306, 150, 247, 118, 952, 346, 120, 301, 953, /* 580 */ 306, 115, 225, 958, 1043, 150, 118, 247, 980, 120,
/* 590 */ 302, 303, 304, 974, 307, 308, 200, 347, 348, 38, /* 590 */ 301, 959, 302, 303, 304, 348, 307, 308, 200, 349,
/* 600 */ 320, 349, 948, 951, 947, 130, 329, 350, 1187, 351, /* 600 */ 151, 38, 322, 350, 954, 957, 130, 953, 331, 1195,
/* 610 */ 352, 361, 137, 1186, 1183, 887, 141, 222, 336, 1179, /* 610 */ 137, 351, 1194, 352, 1191, 353, 354, 363, 141, 222,
/* 620 */ 152, 144, 1178, 265, 1175, 886, 148, 223, 973, 268, /* 620 */ 338, 223, 1187, 144, 1186, 1183, 893, 148, 979, 265,
/* 630 */ 885, 868, 867, 70, 296, 8, 28, 41, 31, 761, /* 630 */ 264, 892, 268, 891, 874, 873, 41, 31, 8, 70,
/* 640 */ 278, 96, 153, 201, 937, 151, 154, 156, 157, 155, /* 640 */ 201, 28, 296, 153, 157, 272, 152, 154, 155, 943,
/* 650 */ 163, 935, 165, 1, 166, 933, 264, 932, 263, 171, /* 650 */ 156, 163, 941, 165, 166, 939, 938, 263, 1, 981,
/* 660 */ 267, 975, 931, 930, 173, 929, 928, 927, 926, 925, /* 660 */ 937, 171, 936, 173, 935, 934, 933, 932, 931, 930,
/* 670 */ 924, 272, 923, 787, 180, 184, 98, 182, 922, 798, /* 670 */ 767, 929, 267, 180, 278, 182, 928, 184, 185, 187,
/* 680 */ 185, 921, 99, 188, 187, 920, 918, 792, 100, 916, /* 680 */ 927, 926, 924, 188, 922, 919, 793, 96, 98, 920,
/* 690 */ 914, 102, 194, 913, 911, 912, 197, 907, 794, 2, /* 690 */ 194, 917, 804, 197, 918, 913, 99, 100, 2, 798,
/* 700 */ 237, 103, 290, 9, 33, 34, 10, 11, 25, 298, /* 700 */ 102, 237, 9, 800, 33, 103, 34, 10, 298, 290,
/* 710 */ 26, 122, 119, 36, 126, 125, 650, 688, 37, 128, /* 710 */ 11, 25, 26, 119, 122, 126, 654, 693, 309, 692,
/* 720 */ 685, 683, 682, 681, 679, 678, 677, 674, 640, 132, /* 720 */ 36, 125, 689, 37, 687, 128, 686, 685, 683, 682,
/* 730 */ 5, 134, 135, 842, 318, 844, 6, 326, 327, 68, /* 730 */ 681, 678, 644, 132, 134, 135, 5, 850, 320, 848,
/* 740 */ 136, 40, 69, 719, 718, 138, 143, 145, 715, 666, /* 740 */ 6, 329, 328, 68, 69, 136, 138, 143, 725, 40,
/* 750 */ 664, 656, 662, 658, 660, 654, 652, 687, 686, 684, /* 750 */ 145, 724, 721, 670, 668, 660, 666, 662, 664, 658,
/* 760 */ 680, 676, 675, 161, 604, 638, 891, 890, 890, 890, /* 760 */ 656, 691, 690, 688, 684, 680, 679, 161, 642, 897,
/* 770 */ 890, 890, 890, 890, 890, 191, 192, /* 770 */ 896, 608, 896, 896, 896, 896, 896, 896, 896, 191,
/* 780 */ 192,
}; };
static const YYCODETYPE yy_lookahead[] = { static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 200, 1, 1, 194, 245, 3, 200, 7, 8, 201, /* 0 */ 194, 1, 239, 194, 3, 200, 243, 7, 8, 1,
/* 10 */ 10, 11, 194, 195, 14, 15, 16, 17, 259, 19, /* 10 */ 10, 11, 192, 193, 14, 15, 16, 17, 241, 19,
/* 20 */ 20, 21, 22, 23, 24, 243, 244, 192, 193, 29, /* 20 */ 20, 21, 22, 23, 24, 1, 1, 194, 195, 29,
/* 30 */ 30, 29, 30, 33, 34, 35, 200, 7, 8, 238, /* 30 */ 30, 262, 200, 33, 34, 35, 259, 7, 8, 239,
/* 40 */ 10, 11, 234, 242, 14, 15, 16, 17, 194, 19, /* 40 */ 10, 11, 273, 243, 14, 15, 16, 17, 194, 19,
/* 50 */ 20, 21, 22, 23, 24, 216, 1, 218, 219, 29, /* 50 */ 20, 21, 22, 23, 24, 216, 262, 218, 219, 29,
/* 60 */ 30, 261, 223, 33, 34, 35, 227, 261, 229, 230, /* 60 */ 30, 241, 223, 33, 34, 35, 227, 262, 229, 230,
/* 70 */ 201, 262, 272, 7, 8, 240, 10, 11, 272, 78, /* 70 */ 264, 265, 263, 7, 8, 194, 10, 11, 273, 259,
/* 80 */ 14, 15, 16, 17, 84, 19, 20, 21, 22, 23, /* 80 */ 14, 15, 16, 17, 84, 19, 20, 21, 22, 23,
/* 90 */ 24, 261, 194, 258, 238, 29, 30, 261, 242, 33, /* 90 */ 24, 194, 244, 245, 262, 29, 30, 214, 215, 33,
/* 100 */ 34, 35, 272, 7, 8, 236, 10, 11, 272, 79, /* 100 */ 34, 35, 78, 7, 8, 273, 10, 11, 83, 79,
/* 110 */ 14, 15, 16, 17, 78, 19, 20, 21, 22, 23, /* 110 */ 14, 15, 16, 17, 241, 19, 20, 21, 22, 23,
/* 120 */ 24, 267, 1, 269, 74, 29, 30, 194, 80, 33, /* 120 */ 24, 240, 268, 78, 270, 29, 30, 124, 125, 33,
/* 130 */ 34, 35, 194, 240, 8, 237, 10, 11, 88, 241, /* 130 */ 34, 35, 259, 201, 8, 238, 10, 11, 63, 242,
/* 140 */ 14, 15, 16, 17, 194, 19, 20, 21, 22, 23, /* 140 */ 14, 15, 16, 17, 194, 19, 20, 21, 22, 23,
/* 150 */ 24, 258, 116, 203, 118, 29, 30, 78, 194, 33, /* 150 */ 24, 96, 33, 98, 99, 29, 30, 1, 103, 33,
/* 160 */ 34, 35, 41, 42, 43, 44, 45, 46, 47, 48, /* 160 */ 34, 35, 107, 118, 109, 110, 234, 235, 236, 237,
/* 170 */ 49, 50, 51, 52, 53, 54, 55, 63, 57, 10, /* 170 */ 200, 96, 97, 98, 99, 100, 101, 102, 103, 104,
/* 180 */ 11, 199, 240, 14, 15, 16, 17, 205, 19, 20, /* 180 */ 105, 106, 107, 108, 109, 110, 111, 216, 217, 218,
/* 190 */ 21, 22, 23, 24, 88, 116, 263, 264, 29, 30, /* 190 */ 219, 220, 221, 222, 223, 224, 225, 226, 227, 228,
/* 200 */ 258, 237, 33, 34, 35, 241, 142, 269, 144, 271, /* 200 */ 229, 230, 231, 232, 1, 10, 11, 74, 95, 14,
/* 210 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, /* 210 */ 15, 16, 17, 249, 19, 20, 21, 22, 23, 24,
/* 220 */ 106, 107, 108, 109, 110, 216, 217, 218, 219, 220, /* 220 */ 270, 88, 272, 88, 29, 30, 3, 4, 33, 34,
/* 230 */ 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, /* 230 */ 35, 267, 262, 29, 30, 122, 80, 33, 34, 35,
/* 240 */ 231, 139, 78, 40, 21, 22, 23, 24, 84, 261, /* 240 */ 121, 3, 40, 273, 41, 42, 43, 44, 45, 46,
/* 250 */ 148, 149, 29, 30, 122, 123, 33, 34, 35, 1, /* 250 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 57,
/* 260 */ 57, 248, 1, 2, 3, 4, 5, 64, 2, 3, /* 260 */ 57, 1, 2, 3, 4, 5, 64, 29, 30, 58,
/* 270 */ 4, 5, 3, 70, 71, 72, 73, 113, 194, 266, /* 270 */ 59, 60, 70, 71, 72, 73, 78, 80, 246, 77,
/* 280 */ 77, 78, 1, 2, 3, 4, 5, 203, 201, 261, /* 280 */ 78, 1, 2, 3, 4, 5, 33, 34, 35, 29,
/* 290 */ 29, 30, 64, 194, 33, 29, 30, 2, 3, 4, /* 290 */ 30, 201, 260, 33, 21, 22, 23, 24, 2, 3,
/* 300 */ 5, 261, 194, 194, 58, 59, 60, 194, 261, 64, /* 300 */ 4, 5, 29, 30, 3, 4, 33, 34, 35, 29,
/* 310 */ 29, 30, 66, 67, 68, 69, 203, 194, 194, 116, /* 310 */ 30, 64, 2, 3, 4, 5, 118, 245, 120, 262,
/* 320 */ 233, 234, 235, 236, 29, 30, 58, 59, 60, 33, /* 320 */ 118, 58, 59, 60, 194, 29, 30, 237, 194, 66,
/* 330 */ 34, 35, 86, 65, 66, 67, 68, 69, 80, 78, /* 330 */ 67, 68, 69, 194, 194, 199, 194, 194, 78, 29,
/* 340 */ 241, 138, 1, 140, 96, 237, 98, 99, 239, 241, /* 340 */ 30, 205, 140, 194, 142, 194, 123, 3, 4, 86,
/* 350 */ 147, 103, 33, 3, 4, 107, 194, 109, 110, 78, /* 350 */ 64, 149, 58, 59, 60, 58, 59, 60, 78, 65,
/* 360 */ 237, 237, 29, 30, 241, 241, 33, 34, 35, 141, /* 360 */ 66, 67, 68, 69, 67, 68, 69, 194, 238, 111,
/* 370 */ 194, 143, 194, 145, 146, 114, 115, 194, 194, 194, /* 370 */ 194, 201, 242, 76, 262, 194, 116, 117, 238, 262,
/* 380 */ 114, 115, 121, 58, 59, 60, 141, 194, 143, 72, /* 380 */ 238, 238, 242, 123, 242, 242, 72, 238, 194, 238,
/* 390 */ 145, 146, 67, 68, 69, 114, 115, 3, 4, 237, /* 390 */ 143, 242, 145, 242, 147, 148, 116, 117, 9, 141,
/* 400 */ 194, 76, 121, 241, 1, 61, 62, 63, 95, 114, /* 400 */ 78, 194, 194, 123, 270, 235, 84, 194, 150, 270,
/* 410 */ 115, 79, 199, 237, 199, 237, 79, 241, 205, 241, /* 410 */ 203, 238, 116, 117, 238, 242, 203, 79, 242, 238,
/* 420 */ 205, 237, 237, 95, 83, 241, 241, 58, 59, 60, /* 420 */ 61, 62, 63, 242, 123, 79, 116, 117, 95, 143,
/* 430 */ 237, 214, 215, 120, 241, 79, 33, 79, 119, 79, /* 430 */ 78, 145, 238, 147, 148, 79, 242, 115, 199, 194,
/* 440 */ 79, 95, 79, 79, 79, 79, 9, 130, 78, 117, /* 440 */ 79, 199, 79, 79, 205, 95, 132, 205, 203, 1,
/* 450 */ 261, 95, 269, 95, 117, 95, 95, 79, 95, 95, /* 450 */ 242, 95, 79, 79, 3, 4, 95, 119, 95, 95,
/* 460 */ 95, 95, 3, 4, 136, 3, 4, 79, 79, 56, /* 460 */ 79, 79, 79, 79, 79, 119, 114, 56, 95, 95,
/* 470 */ 79, 121, 142, 95, 144, 269, 142, 142, 144, 144, /* 470 */ 243, 138, 79, 144, 78, 146, 95, 95, 95, 95,
/* 480 */ 134, 261, 112, 95, 95, 78, 95, 3, 4, 74, /* 480 */ 95, 33, 262, 144, 262, 146, 136, 262, 95, 78,
/* 490 */ 75, 78, 3, 4, 142, 142, 144, 144, 261, 261, /* 490 */ 262, 144, 144, 146, 146, 3, 4, 3, 4, 144,
/* 500 */ 261, 261, 261, 261, 261, 261, 244, 242, 261, 232, /* 500 */ 233, 146, 144, 262, 146, 116, 74, 75, 262, 113,
/* 510 */ 261, 261, 261, 261, 261, 121, 261, 261, 111, 244, /* 510 */ 262, 262, 262, 262, 262, 245, 262, 262, 262, 262,
/* 520 */ 244, 232, 240, 232, 232, 232, 232, 260, 240, 232, /* 520 */ 245, 262, 241, 262, 262, 233, 233, 261, 233, 241,
/* 530 */ 240, 246, 194, 270, 270, 56, 194, 121, 240, 196, /* 530 */ 241, 233, 233, 233, 247, 271, 271, 194, 56, 194,
/* 540 */ 257, 194, 194, 194, 265, 265, 135, 196, 194, 194, /* 540 */ 123, 135, 266, 241, 266, 196, 137, 194, 194, 266,
/* 550 */ 133, 114, 265, 194, 128, 132, 256, 255, 196, 254, /* 550 */ 266, 194, 130, 134, 133, 128, 196, 254, 196, 194,
/* 560 */ 131, 194, 194, 253, 265, 126, 194, 196, 252, 196, /* 560 */ 194, 194, 194, 258, 194, 196, 194, 196, 257, 256,
/* 570 */ 125, 251, 124, 250, 127, 249, 247, 137, 196, 194, /* 570 */ 255, 253, 127, 252, 251, 126, 129, 250, 139, 248,
/* 580 */ 194, 87, 94, 196, 194, 204, 93, 194, 196, 194, /* 580 */ 87, 194, 196, 204, 194, 94, 194, 196, 213, 194,
/* 590 */ 194, 194, 194, 213, 194, 194, 194, 47, 90, 194, /* 590 */ 196, 194, 194, 194, 194, 93, 194, 194, 194, 47,
/* 600 */ 194, 92, 194, 204, 194, 201, 194, 51, 194, 91, /* 600 */ 212, 194, 194, 90, 194, 204, 201, 194, 194, 194,
/* 610 */ 89, 80, 194, 194, 194, 3, 194, 196, 194, 194, /* 610 */ 194, 92, 194, 51, 194, 91, 89, 80, 194, 196,
/* 620 */ 211, 194, 194, 3, 194, 3, 194, 196, 194, 3, /* 620 */ 194, 196, 194, 194, 194, 194, 3, 194, 194, 3,
/* 630 */ 3, 98, 97, 117, 112, 78, 78, 194, 194, 79, /* 630 */ 151, 3, 3, 3, 98, 97, 194, 194, 78, 119,
/* 640 */ 95, 95, 207, 194, 194, 212, 210, 209, 206, 208, /* 640 */ 194, 78, 114, 207, 206, 141, 211, 210, 208, 194,
/* 650 */ 194, 194, 194, 202, 194, 194, 150, 194, 194, 194, /* 650 */ 209, 194, 194, 194, 194, 194, 194, 194, 202, 215,
/* 660 */ 150, 215, 196, 196, 194, 194, 194, 194, 194, 194, /* 660 */ 196, 194, 196, 194, 194, 194, 194, 194, 194, 194,
/* 670 */ 194, 139, 194, 79, 197, 194, 78, 197, 196, 79, /* 670 */ 79, 194, 151, 197, 95, 197, 196, 194, 197, 194,
/* 680 */ 197, 196, 78, 197, 194, 194, 194, 79, 95, 194, /* 680 */ 196, 194, 194, 197, 194, 196, 79, 95, 78, 194,
/* 690 */ 194, 78, 194, 196, 194, 196, 194, 194, 79, 198, /* 690 */ 194, 194, 79, 194, 196, 194, 78, 95, 198, 79,
/* 700 */ 1, 78, 78, 129, 95, 95, 129, 78, 78, 112, /* 700 */ 78, 1, 131, 79, 95, 78, 95, 131, 114, 78,
/* 710 */ 78, 74, 113, 85, 66, 84, 3, 3, 85, 84, /* 710 */ 78, 78, 78, 115, 74, 66, 3, 3, 112, 3,
/* 720 */ 5, 3, 3, 3, 3, 3, 3, 3, 81, 74, /* 720 */ 85, 84, 5, 85, 3, 84, 3, 3, 3, 3,
/* 730 */ 78, 82, 82, 79, 9, 114, 78, 20, 55, 10, /* 730 */ 3, 3, 81, 74, 82, 82, 78, 116, 9, 79,
/* 740 */ 144, 95, 10, 3, 3, 144, 144, 144, 79, 3, /* 740 */ 78, 55, 20, 10, 10, 146, 146, 146, 3, 95,
/* 750 */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 750 */ 146, 3, 79, 3, 3, 3, 3, 3, 3, 3,
/* 760 */ 3, 3, 3, 95, 56, 81, 0, 273, 273, 273, /* 760 */ 3, 3, 3, 3, 3, 3, 3, 95, 81, 0,
/* 770 */ 273, 273, 273, 273, 273, 15, 15, 273, 273, 273, /* 770 */ 274, 56, 274, 274, 274, 274, 274, 274, 274, 15,
/* 780 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 780 */ 15, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 790 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 790 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 800 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 800 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 810 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 810 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 820 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 820 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 830 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 830 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 840 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 840 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 850 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 850 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 860 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 860 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 870 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 870 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 880 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 880 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 890 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 890 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 900 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 900 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 910 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 910 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 920 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 920 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 930 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 930 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 940 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 940 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 950 */ 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, /* 950 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 960 */ 273, 273, 273, 273, 273, 273, 273, 273, /* 960 */ 274, 274, 274, 274, 274, 274, 274, 274, 274, 274,
/* 970 */ 274, 274, 274,
}; };
#define YY_SHIFT_COUNT (365) #define YY_SHIFT_COUNT (367)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (766) #define YY_SHIFT_MAX (769)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 203, 114, 248, 48, 261, 281, 281, 1, 55, 55, /* 0 */ 202, 75, 55, 197, 260, 280, 280, 24, 8, 8,
/* 10 */ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, /* 10 */ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
/* 20 */ 55, 0, 121, 281, 266, 295, 295, 79, 79, 132, /* 20 */ 8, 0, 203, 280, 296, 310, 310, 45, 45, 3,
/* 30 */ 258, 50, 48, 55, 55, 55, 55, 55, 106, 55, /* 30 */ 156, 133, 197, 8, 8, 8, 8, 8, 135, 8,
/* 40 */ 55, 106, 269, 777, 281, 281, 281, 281, 281, 281, /* 40 */ 8, 135, 1, 781, 280, 280, 280, 280, 280, 280,
/* 50 */ 281, 281, 281, 281, 281, 281, 281, 281, 281, 281, /* 50 */ 280, 280, 280, 280, 280, 280, 280, 280, 280, 280,
/* 60 */ 281, 281, 281, 281, 281, 281, 266, 295, 266, 266, /* 60 */ 280, 280, 280, 280, 280, 280, 296, 310, 296, 296,
/* 70 */ 36, 2, 2, 2, 2, 2, 2, 2, 319, 79, /* 70 */ 198, 238, 238, 238, 238, 238, 238, 238, 119, 45,
/* 80 */ 79, 317, 317, 313, 79, 341, 55, 479, 55, 55, /* 80 */ 45, 314, 314, 113, 45, 25, 8, 482, 8, 8,
/* 90 */ 55, 479, 55, 55, 55, 479, 55, 416, 416, 416, /* 90 */ 8, 482, 8, 8, 8, 482, 8, 417, 417, 417,
/* 100 */ 416, 479, 55, 55, 479, 417, 411, 426, 423, 429, /* 100 */ 417, 482, 8, 8, 482, 406, 409, 422, 419, 421,
/* 110 */ 439, 445, 448, 447, 440, 479, 55, 55, 479, 55, /* 110 */ 427, 445, 449, 447, 439, 482, 8, 8, 482, 8,
/* 120 */ 479, 55, 55, 55, 494, 55, 55, 494, 55, 55, /* 120 */ 482, 8, 8, 8, 493, 8, 8, 493, 8, 8,
/* 130 */ 55, 48, 55, 55, 55, 55, 55, 55, 55, 55, /* 130 */ 8, 197, 8, 8, 8, 8, 8, 8, 8, 8,
/* 140 */ 55, 479, 55, 55, 55, 55, 55, 55, 479, 55, /* 140 */ 8, 482, 8, 8, 8, 8, 8, 8, 482, 8,
/* 150 */ 55, 488, 493, 550, 508, 509, 556, 518, 521, 55, /* 150 */ 8, 491, 502, 552, 513, 519, 562, 524, 527, 8,
/* 160 */ 55, 269, 55, 55, 55, 55, 55, 55, 55, 55, /* 160 */ 8, 1, 8, 8, 8, 8, 8, 8, 8, 8,
/* 170 */ 55, 479, 55, 479, 55, 55, 55, 55, 55, 55, /* 170 */ 8, 482, 8, 482, 8, 8, 8, 8, 8, 8,
/* 180 */ 55, 531, 55, 531, 479, 55, 531, 479, 55, 531, /* 180 */ 8, 537, 8, 537, 482, 8, 537, 482, 8, 537,
/* 190 */ 55, 55, 55, 55, 479, 55, 55, 479, 55, 55, /* 190 */ 8, 8, 8, 8, 482, 8, 8, 482, 8, 8,
/* 200 */ 777, 777, 30, 66, 66, 96, 66, 126, 169, 223, /* 200 */ 781, 781, 30, 66, 66, 96, 66, 126, 195, 273,
/* 210 */ 223, 223, 223, 223, 223, 246, 268, 325, 333, 333, /* 210 */ 273, 273, 273, 273, 273, 263, 294, 297, 204, 204,
/* 220 */ 333, 333, 228, 245, 102, 164, 296, 296, 350, 394, /* 220 */ 204, 204, 247, 286, 258, 322, 253, 253, 223, 301,
/* 230 */ 344, 369, 356, 332, 337, 358, 360, 361, 328, 346, /* 230 */ 359, 211, 356, 338, 346, 361, 363, 364, 333, 350,
/* 240 */ 363, 364, 365, 366, 459, 462, 378, 370, 388, 389, /* 240 */ 373, 374, 381, 382, 344, 451, 383, 352, 384, 385,
/* 250 */ 403, 413, 437, 391, 64, 330, 334, 484, 489, 335, /* 250 */ 448, 411, 389, 393, 329, 339, 347, 492, 494, 348,
/* 260 */ 352, 407, 353, 415, 612, 506, 620, 622, 510, 626, /* 260 */ 355, 396, 358, 432, 623, 479, 626, 628, 521, 629,
/* 270 */ 627, 533, 535, 532, 516, 522, 557, 560, 558, 545, /* 270 */ 630, 536, 538, 504, 520, 528, 560, 591, 563, 579,
/* 280 */ 546, 594, 598, 600, 604, 608, 593, 613, 619, 623, /* 280 */ 592, 607, 610, 613, 618, 620, 602, 622, 624, 627,
/* 290 */ 699, 624, 609, 574, 610, 577, 629, 522, 630, 597, /* 290 */ 700, 631, 609, 571, 611, 576, 632, 528, 633, 594,
/* 300 */ 632, 599, 637, 628, 631, 648, 713, 633, 635, 714, /* 300 */ 634, 598, 640, 635, 637, 649, 713, 638, 641, 714,
/* 310 */ 715, 718, 719, 720, 721, 722, 723, 724, 647, 725, /* 310 */ 606, 716, 717, 721, 723, 724, 725, 726, 727, 728,
/* 320 */ 655, 649, 650, 652, 654, 621, 658, 717, 683, 729, /* 320 */ 651, 729, 659, 652, 653, 658, 660, 621, 662, 722,
/* 330 */ 596, 601, 646, 646, 646, 646, 732, 602, 603, 646, /* 330 */ 686, 733, 599, 600, 654, 654, 654, 654, 734, 601,
/* 340 */ 646, 646, 740, 741, 669, 646, 746, 747, 748, 749, /* 340 */ 604, 654, 654, 654, 745, 748, 673, 654, 750, 751,
/* 350 */ 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, /* 350 */ 752, 753, 754, 755, 756, 757, 758, 759, 760, 761,
/* 360 */ 668, 684, 760, 761, 708, 766, /* 360 */ 762, 763, 672, 687, 764, 765, 715, 769,
}; };
#define YY_REDUCE_COUNT (201) #define YY_REDUCE_COUNT (201)
#define YY_REDUCE_MIN (-241) #define YY_REDUCE_MIN (-237)
#define YY_REDUCE_MAX (503) #define YY_REDUCE_MAX (501)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ -165, 9, -161, 87, -200, -194, -164, -67, -102, -62, /* 0 */ -180, -29, -161, -68, -195, -168, -30, -194, -103, -50,
/* 10 */ -146, -36, 108, 123, 124, 162, 176, 178, 184, 185, /* 10 */ -146, 130, 140, 142, 143, 149, 151, 173, 176, 181,
/* 20 */ 193, -191, -182, -170, -218, -199, -144, -107, -58, 13, /* 20 */ 194, -191, -167, -231, -152, -237, -200, -223, -127, -36,
/* 30 */ -131, -18, -192, 183, 206, 109, -50, 84, 213, 113, /* 30 */ 90, 136, 170, 134, 139, -119, 207, 213, 239, 245,
/* 40 */ 99, 215, 217, -241, -12, 28, 40, 47, 189, 220, /* 40 */ 208, 242, -117, 32, -206, 57, 112, 117, 220, 222,
/* 50 */ 237, 238, 239, 240, 241, 242, 243, 244, 247, 249, /* 50 */ 225, 228, 241, 246, 248, 249, 250, 251, 252, 254,
/* 60 */ 250, 251, 252, 253, 255, 256, 262, 265, 275, 276, /* 60 */ 255, 256, 257, 259, 261, 262, 72, 227, 270, 275,
/* 70 */ 282, 277, 289, 291, 292, 293, 294, 297, 267, 288, /* 70 */ 281, 267, 292, 293, 295, 298, 299, 300, 266, 288,
/* 80 */ 290, 263, 264, 285, 298, 338, 342, 343, 347, 348, /* 80 */ 289, 264, 265, 287, 302, 343, 345, 349, 353, 354,
/* 90 */ 349, 351, 354, 355, 359, 362, 367, 279, 280, 287, /* 90 */ 357, 360, 365, 366, 367, 362, 368, 276, 278, 283,
/* 100 */ 299, 371, 368, 372, 373, 283, 300, 302, 305, 310, /* 100 */ 284, 369, 370, 372, 371, 305, 311, 313, 315, 303,
/* 110 */ 316, 320, 323, 326, 329, 382, 385, 386, 387, 390, /* 110 */ 318, 321, 323, 327, 331, 386, 387, 390, 391, 392,
/* 120 */ 392, 393, 395, 396, 381, 397, 398, 399, 400, 401, /* 120 */ 394, 395, 397, 398, 379, 399, 400, 401, 402, 403,
/* 130 */ 402, 404, 405, 406, 408, 410, 412, 414, 418, 419, /* 130 */ 404, 405, 407, 408, 410, 413, 414, 415, 416, 418,
/* 140 */ 420, 421, 422, 424, 425, 427, 428, 430, 431, 432, /* 140 */ 420, 423, 424, 426, 428, 429, 430, 431, 425, 433,
/* 150 */ 434, 380, 433, 409, 435, 436, 441, 438, 442, 443, /* 150 */ 434, 375, 388, 435, 436, 437, 440, 441, 438, 442,
/* 160 */ 444, 446, 449, 450, 456, 457, 458, 460, 461, 463, /* 160 */ 443, 444, 446, 455, 457, 458, 459, 460, 461, 462,
/* 170 */ 464, 466, 465, 467, 470, 471, 472, 473, 474, 475, /* 170 */ 463, 464, 467, 466, 469, 470, 471, 472, 473, 474,
/* 180 */ 476, 477, 478, 480, 482, 481, 483, 485, 490, 486, /* 180 */ 475, 476, 477, 478, 480, 483, 481, 484, 485, 486,
/* 190 */ 491, 492, 495, 496, 497, 498, 500, 499, 502, 503, /* 190 */ 487, 488, 490, 495, 489, 496, 497, 498, 499, 501,
/* 200 */ 451, 501, /* 200 */ 456, 500,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 888, 950, 938, 946, 1171, 1171, 1171, 888, 888, 888, /* 0 */ 894, 956, 944, 952, 1179, 1179, 1179, 894, 894, 894,
/* 10 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 10 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 20 */ 888, 1078, 908, 1171, 888, 888, 888, 888, 888, 1093, /* 20 */ 894, 1086, 914, 1179, 894, 894, 894, 894, 894, 1101,
/* 30 */ 1028, 956, 946, 888, 888, 888, 888, 888, 956, 888, /* 30 */ 1036, 962, 952, 894, 894, 894, 894, 894, 962, 894,
/* 40 */ 888, 956, 888, 1073, 888, 888, 888, 888, 888, 888, /* 40 */ 894, 962, 894, 1081, 894, 894, 894, 894, 894, 894,
/* 50 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 50 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 60 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 60 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 70 */ 888, 888, 888, 888, 888, 888, 888, 888, 1080, 888, /* 70 */ 894, 894, 894, 894, 894, 894, 894, 894, 1088, 894,
/* 80 */ 888, 1112, 1112, 1071, 888, 888, 888, 910, 888, 888, /* 80 */ 894, 1120, 1120, 1079, 894, 894, 894, 916, 894, 894,
/* 90 */ 1086, 910, 1083, 888, 1088, 910, 888, 888, 888, 888, /* 90 */ 1094, 916, 1091, 894, 1096, 916, 894, 894, 894, 894,
/* 100 */ 888, 910, 888, 888, 910, 1119, 1123, 1105, 1117, 1113, /* 100 */ 894, 916, 894, 894, 916, 1127, 1131, 1113, 1125, 1121,
/* 110 */ 1100, 1098, 1096, 1104, 1127, 910, 888, 888, 910, 888, /* 110 */ 1108, 1106, 1104, 1112, 1135, 916, 894, 894, 916, 894,
/* 120 */ 910, 888, 888, 888, 954, 888, 888, 954, 888, 888, /* 120 */ 916, 894, 894, 894, 960, 894, 894, 960, 894, 894,
/* 130 */ 888, 946, 888, 888, 888, 888, 888, 888, 888, 888, /* 130 */ 894, 952, 894, 894, 894, 894, 894, 894, 894, 894,
/* 140 */ 888, 910, 888, 888, 888, 888, 888, 888, 910, 888, /* 140 */ 894, 916, 894, 894, 894, 894, 894, 894, 916, 894,
/* 150 */ 888, 972, 970, 968, 960, 966, 962, 964, 958, 888, /* 150 */ 894, 978, 976, 974, 966, 972, 968, 970, 964, 894,
/* 160 */ 888, 888, 888, 936, 888, 934, 888, 888, 888, 888, /* 160 */ 894, 894, 894, 942, 894, 940, 894, 894, 894, 894,
/* 170 */ 888, 910, 888, 910, 888, 888, 888, 888, 888, 888, /* 170 */ 894, 916, 894, 916, 894, 894, 894, 894, 894, 894,
/* 180 */ 888, 944, 888, 944, 910, 888, 944, 910, 888, 944, /* 180 */ 894, 950, 894, 950, 916, 894, 950, 916, 894, 950,
/* 190 */ 919, 888, 888, 888, 910, 888, 888, 910, 888, 906, /* 190 */ 925, 894, 894, 894, 916, 894, 894, 916, 894, 912,
/* 200 */ 994, 1011, 888, 1128, 1118, 888, 1170, 1158, 1157, 1166, /* 200 */ 1001, 1019, 894, 1136, 1126, 894, 1178, 1166, 1165, 1174,
/* 210 */ 1165, 1164, 1156, 1155, 1154, 888, 888, 888, 1150, 1153, /* 210 */ 1173, 1172, 1164, 1163, 1162, 894, 894, 894, 1158, 1161,
/* 220 */ 1152, 1151, 888, 888, 888, 888, 1160, 1159, 888, 888, /* 220 */ 1160, 1159, 894, 894, 894, 894, 1168, 1167, 894, 894,
/* 230 */ 888, 888, 888, 888, 888, 888, 888, 888, 1124, 1120, /* 230 */ 894, 894, 894, 894, 894, 894, 894, 894, 1132, 1128,
/* 240 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 240 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 250 */ 888, 1130, 888, 888, 888, 888, 888, 888, 888, 888, /* 250 */ 894, 1138, 894, 894, 894, 894, 894, 894, 894, 894,
/* 260 */ 888, 1019, 888, 888, 888, 888, 888, 888, 888, 888, /* 260 */ 894, 1027, 894, 894, 894, 894, 894, 894, 894, 894,
/* 270 */ 888, 888, 888, 888, 1070, 888, 888, 888, 888, 1082, /* 270 */ 894, 894, 894, 894, 1078, 894, 894, 894, 894, 1090,
/* 280 */ 1081, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 280 */ 1089, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 290 */ 888, 888, 1114, 888, 1106, 888, 888, 1031, 888, 888, /* 290 */ 894, 894, 1122, 894, 1114, 894, 894, 1039, 894, 894,
/* 300 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 300 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 310 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 310 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 320 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 320 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 330 */ 888, 888, 1189, 1184, 1185, 1182, 888, 888, 888, 1181, /* 330 */ 894, 894, 894, 894, 1197, 1192, 1193, 1190, 894, 894,
/* 340 */ 1176, 1177, 888, 888, 888, 1174, 888, 888, 888, 888, /* 340 */ 894, 1189, 1184, 1185, 894, 894, 894, 1182, 894, 894,
/* 350 */ 888, 888, 888, 888, 888, 888, 888, 888, 888, 888, /* 350 */ 894, 894, 894, 894, 894, 894, 894, 894, 894, 894,
/* 360 */ 978, 888, 917, 915, 888, 888, /* 360 */ 894, 894, 984, 894, 923, 921, 894, 894,
}; };
/********** End of lemon-generated parsing tables *****************************/ /********** End of lemon-generated parsing tables *****************************/
...@@ -622,6 +634,8 @@ static const YYCODETYPE yyFallback[] = { ...@@ -622,6 +634,8 @@ static const YYCODETYPE yyFallback[] = {
0, /* PRECISION => nothing */ 0, /* PRECISION => nothing */
0, /* UPDATE => nothing */ 0, /* UPDATE => nothing */
0, /* CACHELAST => nothing */ 0, /* CACHELAST => nothing */
0, /* STREAM => nothing */
0, /* MODE => nothing */
0, /* UNSIGNED => nothing */ 0, /* UNSIGNED => nothing */
0, /* TAGS => nothing */ 0, /* TAGS => nothing */
0, /* USING => nothing */ 0, /* USING => nothing */
...@@ -660,7 +674,6 @@ static const YYCODETYPE yyFallback[] = { ...@@ -660,7 +674,6 @@ static const YYCODETYPE yyFallback[] = {
0, /* SET => nothing */ 0, /* SET => nothing */
0, /* KILL => nothing */ 0, /* KILL => nothing */
0, /* CONNECTION => nothing */ 0, /* CONNECTION => nothing */
0, /* STREAM => nothing */
0, /* COLON => nothing */ 0, /* COLON => nothing */
1, /* ABORT => ID */ 1, /* ABORT => ID */
1, /* AFTER => ID */ 1, /* AFTER => ID */
...@@ -741,6 +754,7 @@ struct yyParser { ...@@ -741,6 +754,7 @@ struct yyParser {
int yyerrcnt; /* Shifts left before out of the error */ int yyerrcnt; /* Shifts left before out of the error */
#endif #endif
ParseARG_SDECL /* A place to hold %extra_argument */ ParseARG_SDECL /* A place to hold %extra_argument */
ParseCTX_SDECL /* A place to hold %extra_context */
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */ int yystksz; /* Current side of the stack */
yyStackEntry *yystack; /* The parser's stack */ yyStackEntry *yystack; /* The parser's stack */
...@@ -899,87 +913,87 @@ static const char *const yyTokenName[] = { ...@@ -899,87 +913,87 @@ static const char *const yyTokenName[] = {
/* 108 */ "PRECISION", /* 108 */ "PRECISION",
/* 109 */ "UPDATE", /* 109 */ "UPDATE",
/* 110 */ "CACHELAST", /* 110 */ "CACHELAST",
/* 111 */ "UNSIGNED", /* 111 */ "STREAM",
/* 112 */ "TAGS", /* 112 */ "MODE",
/* 113 */ "USING", /* 113 */ "UNSIGNED",
/* 114 */ "NULL", /* 114 */ "TAGS",
/* 115 */ "NOW", /* 115 */ "USING",
/* 116 */ "SELECT", /* 116 */ "NULL",
/* 117 */ "UNION", /* 117 */ "NOW",
/* 118 */ "ALL", /* 118 */ "SELECT",
/* 119 */ "DISTINCT", /* 119 */ "UNION",
/* 120 */ "FROM", /* 120 */ "ALL",
/* 121 */ "VARIABLE", /* 121 */ "DISTINCT",
/* 122 */ "INTERVAL", /* 122 */ "FROM",
/* 123 */ "EVERY", /* 123 */ "VARIABLE",
/* 124 */ "SESSION", /* 124 */ "INTERVAL",
/* 125 */ "STATE_WINDOW", /* 125 */ "EVERY",
/* 126 */ "FILL", /* 126 */ "SESSION",
/* 127 */ "SLIDING", /* 127 */ "STATE_WINDOW",
/* 128 */ "ORDER", /* 128 */ "FILL",
/* 129 */ "BY", /* 129 */ "SLIDING",
/* 130 */ "ASC", /* 130 */ "ORDER",
/* 131 */ "GROUP", /* 131 */ "BY",
/* 132 */ "HAVING", /* 132 */ "ASC",
/* 133 */ "LIMIT", /* 133 */ "GROUP",
/* 134 */ "OFFSET", /* 134 */ "HAVING",
/* 135 */ "SLIMIT", /* 135 */ "LIMIT",
/* 136 */ "SOFFSET", /* 136 */ "OFFSET",
/* 137 */ "WHERE", /* 137 */ "SLIMIT",
/* 138 */ "RESET", /* 138 */ "SOFFSET",
/* 139 */ "QUERY", /* 139 */ "WHERE",
/* 140 */ "SYNCDB", /* 140 */ "RESET",
/* 141 */ "ADD", /* 141 */ "QUERY",
/* 142 */ "COLUMN", /* 142 */ "SYNCDB",
/* 143 */ "MODIFY", /* 143 */ "ADD",
/* 144 */ "TAG", /* 144 */ "COLUMN",
/* 145 */ "CHANGE", /* 145 */ "MODIFY",
/* 146 */ "SET", /* 146 */ "TAG",
/* 147 */ "KILL", /* 147 */ "CHANGE",
/* 148 */ "CONNECTION", /* 148 */ "SET",
/* 149 */ "STREAM", /* 149 */ "KILL",
/* 150 */ "COLON", /* 150 */ "CONNECTION",
/* 151 */ "ABORT", /* 151 */ "COLON",
/* 152 */ "AFTER", /* 152 */ "ABORT",
/* 153 */ "ATTACH", /* 153 */ "AFTER",
/* 154 */ "BEFORE", /* 154 */ "ATTACH",
/* 155 */ "BEGIN", /* 155 */ "BEFORE",
/* 156 */ "CASCADE", /* 156 */ "BEGIN",
/* 157 */ "CLUSTER", /* 157 */ "CASCADE",
/* 158 */ "CONFLICT", /* 158 */ "CLUSTER",
/* 159 */ "COPY", /* 159 */ "CONFLICT",
/* 160 */ "DEFERRED", /* 160 */ "COPY",
/* 161 */ "DELIMITERS", /* 161 */ "DEFERRED",
/* 162 */ "DETACH", /* 162 */ "DELIMITERS",
/* 163 */ "EACH", /* 163 */ "DETACH",
/* 164 */ "END", /* 164 */ "EACH",
/* 165 */ "EXPLAIN", /* 165 */ "END",
/* 166 */ "FAIL", /* 166 */ "EXPLAIN",
/* 167 */ "FOR", /* 167 */ "FAIL",
/* 168 */ "IGNORE", /* 168 */ "FOR",
/* 169 */ "IMMEDIATE", /* 169 */ "IGNORE",
/* 170 */ "INITIALLY", /* 170 */ "IMMEDIATE",
/* 171 */ "INSTEAD", /* 171 */ "INITIALLY",
/* 172 */ "KEY", /* 172 */ "INSTEAD",
/* 173 */ "OF", /* 173 */ "KEY",
/* 174 */ "RAISE", /* 174 */ "OF",
/* 175 */ "REPLACE", /* 175 */ "RAISE",
/* 176 */ "RESTRICT", /* 176 */ "REPLACE",
/* 177 */ "ROW", /* 177 */ "RESTRICT",
/* 178 */ "STATEMENT", /* 178 */ "ROW",
/* 179 */ "TRIGGER", /* 179 */ "STATEMENT",
/* 180 */ "VIEW", /* 180 */ "TRIGGER",
/* 181 */ "SEMI", /* 181 */ "VIEW",
/* 182 */ "NONE", /* 182 */ "SEMI",
/* 183 */ "PREV", /* 183 */ "NONE",
/* 184 */ "LINEAR", /* 184 */ "PREV",
/* 185 */ "IMPORT", /* 185 */ "LINEAR",
/* 186 */ "TBNAME", /* 186 */ "IMPORT",
/* 187 */ "JOIN", /* 187 */ "TBNAME",
/* 188 */ "INSERT", /* 188 */ "JOIN",
/* 189 */ "INTO", /* 189 */ "INSERT",
/* 190 */ "VALUES", /* 190 */ "INTO",
/* 191 */ "error", /* 191 */ "VALUES",
/* 192 */ "program", /* 192 */ "program",
/* 193 */ "cmd", /* 193 */ "cmd",
/* 194 */ "ids", /* 194 */ "ids",
...@@ -1020,47 +1034,48 @@ static const char *const yyTokenName[] = { ...@@ -1020,47 +1034,48 @@ static const char *const yyTokenName[] = {
/* 229 */ "update", /* 229 */ "update",
/* 230 */ "cachelast", /* 230 */ "cachelast",
/* 231 */ "vgroups", /* 231 */ "vgroups",
/* 232 */ "signed", /* 232 */ "stream_mode",
/* 233 */ "create_table_args", /* 233 */ "signed",
/* 234 */ "create_stable_args", /* 234 */ "create_table_args",
/* 235 */ "create_table_list", /* 235 */ "create_stable_args",
/* 236 */ "create_from_stable", /* 236 */ "create_table_list",
/* 237 */ "columnlist", /* 237 */ "create_from_stable",
/* 238 */ "tagitemlist1", /* 238 */ "columnlist",
/* 239 */ "tagNamelist", /* 239 */ "tagitemlist1",
/* 240 */ "select", /* 240 */ "tagNamelist",
/* 241 */ "column", /* 241 */ "select",
/* 242 */ "tagitem1", /* 242 */ "column",
/* 243 */ "tagitemlist", /* 243 */ "tagitem1",
/* 244 */ "tagitem", /* 244 */ "tagitemlist",
/* 245 */ "selcollist", /* 245 */ "tagitem",
/* 246 */ "from", /* 246 */ "selcollist",
/* 247 */ "where_opt", /* 247 */ "from",
/* 248 */ "interval_option", /* 248 */ "where_opt",
/* 249 */ "sliding_opt", /* 249 */ "interval_option",
/* 250 */ "session_option", /* 250 */ "sliding_opt",
/* 251 */ "windowstate_option", /* 251 */ "session_option",
/* 252 */ "fill_opt", /* 252 */ "windowstate_option",
/* 253 */ "groupby_opt", /* 253 */ "fill_opt",
/* 254 */ "having_opt", /* 254 */ "groupby_opt",
/* 255 */ "orderby_opt", /* 255 */ "having_opt",
/* 256 */ "slimit_opt", /* 256 */ "orderby_opt",
/* 257 */ "limit_opt", /* 257 */ "slimit_opt",
/* 258 */ "union", /* 258 */ "limit_opt",
/* 259 */ "sclp", /* 259 */ "union",
/* 260 */ "distinct", /* 260 */ "sclp",
/* 261 */ "expr", /* 261 */ "distinct",
/* 262 */ "as", /* 262 */ "expr",
/* 263 */ "tablelist", /* 263 */ "as",
/* 264 */ "sub", /* 264 */ "tablelist",
/* 265 */ "tmvar", /* 265 */ "sub",
/* 266 */ "intervalKey", /* 266 */ "tmvar",
/* 267 */ "sortlist", /* 267 */ "intervalKey",
/* 268 */ "sortitem", /* 268 */ "sortlist",
/* 269 */ "item", /* 269 */ "sortitem",
/* 270 */ "sortorder", /* 270 */ "item",
/* 271 */ "grouplist", /* 271 */ "sortorder",
/* 272 */ "expritem", /* 272 */ "grouplist",
/* 273 */ "expritem",
}; };
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
...@@ -1171,205 +1186,207 @@ static const char *const yyRuleName[] = { ...@@ -1171,205 +1186,207 @@ static const char *const yyRuleName[] = {
/* 100 */ "update ::= UPDATE INTEGER", /* 100 */ "update ::= UPDATE INTEGER",
/* 101 */ "cachelast ::= CACHELAST INTEGER", /* 101 */ "cachelast ::= CACHELAST INTEGER",
/* 102 */ "vgroups ::= VGROUPS INTEGER", /* 102 */ "vgroups ::= VGROUPS INTEGER",
/* 103 */ "db_optr ::=", /* 103 */ "stream_mode ::= STREAM MODE INTEGER",
/* 104 */ "db_optr ::= db_optr cache", /* 104 */ "db_optr ::=",
/* 105 */ "db_optr ::= db_optr replica", /* 105 */ "db_optr ::= db_optr cache",
/* 106 */ "db_optr ::= db_optr quorum", /* 106 */ "db_optr ::= db_optr replica",
/* 107 */ "db_optr ::= db_optr days", /* 107 */ "db_optr ::= db_optr quorum",
/* 108 */ "db_optr ::= db_optr minrows", /* 108 */ "db_optr ::= db_optr days",
/* 109 */ "db_optr ::= db_optr maxrows", /* 109 */ "db_optr ::= db_optr minrows",
/* 110 */ "db_optr ::= db_optr blocks", /* 110 */ "db_optr ::= db_optr maxrows",
/* 111 */ "db_optr ::= db_optr ctime", /* 111 */ "db_optr ::= db_optr blocks",
/* 112 */ "db_optr ::= db_optr wal", /* 112 */ "db_optr ::= db_optr ctime",
/* 113 */ "db_optr ::= db_optr fsync", /* 113 */ "db_optr ::= db_optr wal",
/* 114 */ "db_optr ::= db_optr comp", /* 114 */ "db_optr ::= db_optr fsync",
/* 115 */ "db_optr ::= db_optr prec", /* 115 */ "db_optr ::= db_optr comp",
/* 116 */ "db_optr ::= db_optr keep", /* 116 */ "db_optr ::= db_optr prec",
/* 117 */ "db_optr ::= db_optr update", /* 117 */ "db_optr ::= db_optr keep",
/* 118 */ "db_optr ::= db_optr cachelast", /* 118 */ "db_optr ::= db_optr update",
/* 119 */ "db_optr ::= db_optr vgroups", /* 119 */ "db_optr ::= db_optr cachelast",
/* 120 */ "alter_db_optr ::=", /* 120 */ "db_optr ::= db_optr vgroups",
/* 121 */ "alter_db_optr ::= alter_db_optr replica", /* 121 */ "db_optr ::= db_optr stream_mode",
/* 122 */ "alter_db_optr ::= alter_db_optr quorum", /* 122 */ "alter_db_optr ::=",
/* 123 */ "alter_db_optr ::= alter_db_optr keep", /* 123 */ "alter_db_optr ::= alter_db_optr replica",
/* 124 */ "alter_db_optr ::= alter_db_optr blocks", /* 124 */ "alter_db_optr ::= alter_db_optr quorum",
/* 125 */ "alter_db_optr ::= alter_db_optr comp", /* 125 */ "alter_db_optr ::= alter_db_optr keep",
/* 126 */ "alter_db_optr ::= alter_db_optr update", /* 126 */ "alter_db_optr ::= alter_db_optr blocks",
/* 127 */ "alter_db_optr ::= alter_db_optr cachelast", /* 127 */ "alter_db_optr ::= alter_db_optr comp",
/* 128 */ "typename ::= ids", /* 128 */ "alter_db_optr ::= alter_db_optr update",
/* 129 */ "typename ::= ids LP signed RP", /* 129 */ "alter_db_optr ::= alter_db_optr cachelast",
/* 130 */ "typename ::= ids UNSIGNED", /* 130 */ "typename ::= ids",
/* 131 */ "signed ::= INTEGER", /* 131 */ "typename ::= ids LP signed RP",
/* 132 */ "signed ::= PLUS INTEGER", /* 132 */ "typename ::= ids UNSIGNED",
/* 133 */ "signed ::= MINUS INTEGER", /* 133 */ "signed ::= INTEGER",
/* 134 */ "cmd ::= CREATE TABLE create_table_args", /* 134 */ "signed ::= PLUS INTEGER",
/* 135 */ "cmd ::= CREATE TABLE create_stable_args", /* 135 */ "signed ::= MINUS INTEGER",
/* 136 */ "cmd ::= CREATE STABLE create_stable_args", /* 136 */ "cmd ::= CREATE TABLE create_table_args",
/* 137 */ "cmd ::= CREATE TABLE create_table_list", /* 137 */ "cmd ::= CREATE TABLE create_stable_args",
/* 138 */ "create_table_list ::= create_from_stable", /* 138 */ "cmd ::= CREATE STABLE create_stable_args",
/* 139 */ "create_table_list ::= create_table_list create_from_stable", /* 139 */ "cmd ::= CREATE TABLE create_table_list",
/* 140 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP", /* 140 */ "create_table_list ::= create_from_stable",
/* 141 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP", /* 141 */ "create_table_list ::= create_table_list create_from_stable",
/* 142 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP", /* 142 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
/* 143 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP", /* 143 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
/* 144 */ "tagNamelist ::= tagNamelist COMMA ids", /* 144 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP",
/* 145 */ "tagNamelist ::= ids", /* 145 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP",
/* 146 */ "create_table_args ::= ifnotexists ids cpxName AS select", /* 146 */ "tagNamelist ::= tagNamelist COMMA ids",
/* 147 */ "columnlist ::= columnlist COMMA column", /* 147 */ "tagNamelist ::= ids",
/* 148 */ "columnlist ::= column", /* 148 */ "create_table_args ::= ifnotexists ids cpxName AS select",
/* 149 */ "column ::= ids typename", /* 149 */ "columnlist ::= columnlist COMMA column",
/* 150 */ "tagitemlist1 ::= tagitemlist1 COMMA tagitem1", /* 150 */ "columnlist ::= column",
/* 151 */ "tagitemlist1 ::= tagitem1", /* 151 */ "column ::= ids typename",
/* 152 */ "tagitem1 ::= MINUS INTEGER", /* 152 */ "tagitemlist1 ::= tagitemlist1 COMMA tagitem1",
/* 153 */ "tagitem1 ::= MINUS FLOAT", /* 153 */ "tagitemlist1 ::= tagitem1",
/* 154 */ "tagitem1 ::= PLUS INTEGER", /* 154 */ "tagitem1 ::= MINUS INTEGER",
/* 155 */ "tagitem1 ::= PLUS FLOAT", /* 155 */ "tagitem1 ::= MINUS FLOAT",
/* 156 */ "tagitem1 ::= INTEGER", /* 156 */ "tagitem1 ::= PLUS INTEGER",
/* 157 */ "tagitem1 ::= FLOAT", /* 157 */ "tagitem1 ::= PLUS FLOAT",
/* 158 */ "tagitem1 ::= STRING", /* 158 */ "tagitem1 ::= INTEGER",
/* 159 */ "tagitem1 ::= BOOL", /* 159 */ "tagitem1 ::= FLOAT",
/* 160 */ "tagitem1 ::= NULL", /* 160 */ "tagitem1 ::= STRING",
/* 161 */ "tagitem1 ::= NOW", /* 161 */ "tagitem1 ::= BOOL",
/* 162 */ "tagitemlist ::= tagitemlist COMMA tagitem", /* 162 */ "tagitem1 ::= NULL",
/* 163 */ "tagitemlist ::= tagitem", /* 163 */ "tagitem1 ::= NOW",
/* 164 */ "tagitem ::= INTEGER", /* 164 */ "tagitemlist ::= tagitemlist COMMA tagitem",
/* 165 */ "tagitem ::= FLOAT", /* 165 */ "tagitemlist ::= tagitem",
/* 166 */ "tagitem ::= STRING", /* 166 */ "tagitem ::= INTEGER",
/* 167 */ "tagitem ::= BOOL", /* 167 */ "tagitem ::= FLOAT",
/* 168 */ "tagitem ::= NULL", /* 168 */ "tagitem ::= STRING",
/* 169 */ "tagitem ::= NOW", /* 169 */ "tagitem ::= BOOL",
/* 170 */ "tagitem ::= MINUS INTEGER", /* 170 */ "tagitem ::= NULL",
/* 171 */ "tagitem ::= MINUS FLOAT", /* 171 */ "tagitem ::= NOW",
/* 172 */ "tagitem ::= PLUS INTEGER", /* 172 */ "tagitem ::= MINUS INTEGER",
/* 173 */ "tagitem ::= PLUS FLOAT", /* 173 */ "tagitem ::= MINUS FLOAT",
/* 174 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", /* 174 */ "tagitem ::= PLUS INTEGER",
/* 175 */ "select ::= LP select RP", /* 175 */ "tagitem ::= PLUS FLOAT",
/* 176 */ "union ::= select", /* 176 */ "select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt",
/* 177 */ "union ::= union UNION ALL select", /* 177 */ "select ::= LP select RP",
/* 178 */ "union ::= union UNION select", /* 178 */ "union ::= select",
/* 179 */ "cmd ::= union", /* 179 */ "union ::= union UNION ALL select",
/* 180 */ "select ::= SELECT selcollist", /* 180 */ "union ::= union UNION select",
/* 181 */ "sclp ::= selcollist COMMA", /* 181 */ "cmd ::= union",
/* 182 */ "sclp ::=", /* 182 */ "select ::= SELECT selcollist",
/* 183 */ "selcollist ::= sclp distinct expr as", /* 183 */ "sclp ::= selcollist COMMA",
/* 184 */ "selcollist ::= sclp STAR", /* 184 */ "sclp ::=",
/* 185 */ "as ::= AS ids", /* 185 */ "selcollist ::= sclp distinct expr as",
/* 186 */ "as ::= ids", /* 186 */ "selcollist ::= sclp STAR",
/* 187 */ "as ::=", /* 187 */ "as ::= AS ids",
/* 188 */ "distinct ::= DISTINCT", /* 188 */ "as ::= ids",
/* 189 */ "distinct ::=", /* 189 */ "as ::=",
/* 190 */ "from ::= FROM tablelist", /* 190 */ "distinct ::= DISTINCT",
/* 191 */ "from ::= FROM sub", /* 191 */ "distinct ::=",
/* 192 */ "sub ::= LP union RP", /* 192 */ "from ::= FROM tablelist",
/* 193 */ "sub ::= LP union RP ids", /* 193 */ "from ::= FROM sub",
/* 194 */ "sub ::= sub COMMA LP union RP ids", /* 194 */ "sub ::= LP union RP",
/* 195 */ "tablelist ::= ids cpxName", /* 195 */ "sub ::= LP union RP ids",
/* 196 */ "tablelist ::= ids cpxName ids", /* 196 */ "sub ::= sub COMMA LP union RP ids",
/* 197 */ "tablelist ::= tablelist COMMA ids cpxName", /* 197 */ "tablelist ::= ids cpxName",
/* 198 */ "tablelist ::= tablelist COMMA ids cpxName ids", /* 198 */ "tablelist ::= ids cpxName ids",
/* 199 */ "tmvar ::= VARIABLE", /* 199 */ "tablelist ::= tablelist COMMA ids cpxName",
/* 200 */ "interval_option ::= intervalKey LP tmvar RP", /* 200 */ "tablelist ::= tablelist COMMA ids cpxName ids",
/* 201 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP", /* 201 */ "tmvar ::= VARIABLE",
/* 202 */ "interval_option ::=", /* 202 */ "interval_option ::= intervalKey LP tmvar RP",
/* 203 */ "intervalKey ::= INTERVAL", /* 203 */ "interval_option ::= intervalKey LP tmvar COMMA tmvar RP",
/* 204 */ "intervalKey ::= EVERY", /* 204 */ "interval_option ::=",
/* 205 */ "session_option ::=", /* 205 */ "intervalKey ::= INTERVAL",
/* 206 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP", /* 206 */ "intervalKey ::= EVERY",
/* 207 */ "windowstate_option ::=", /* 207 */ "session_option ::=",
/* 208 */ "windowstate_option ::= STATE_WINDOW LP ids RP", /* 208 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
/* 209 */ "fill_opt ::=", /* 209 */ "windowstate_option ::=",
/* 210 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP", /* 210 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
/* 211 */ "fill_opt ::= FILL LP ID RP", /* 211 */ "fill_opt ::=",
/* 212 */ "sliding_opt ::= SLIDING LP tmvar RP", /* 212 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
/* 213 */ "sliding_opt ::=", /* 213 */ "fill_opt ::= FILL LP ID RP",
/* 214 */ "orderby_opt ::=", /* 214 */ "sliding_opt ::= SLIDING LP tmvar RP",
/* 215 */ "orderby_opt ::= ORDER BY sortlist", /* 215 */ "sliding_opt ::=",
/* 216 */ "sortlist ::= sortlist COMMA item sortorder", /* 216 */ "orderby_opt ::=",
/* 217 */ "sortlist ::= item sortorder", /* 217 */ "orderby_opt ::= ORDER BY sortlist",
/* 218 */ "item ::= ids cpxName", /* 218 */ "sortlist ::= sortlist COMMA item sortorder",
/* 219 */ "sortorder ::= ASC", /* 219 */ "sortlist ::= item sortorder",
/* 220 */ "sortorder ::= DESC", /* 220 */ "item ::= ids cpxName",
/* 221 */ "sortorder ::=", /* 221 */ "sortorder ::= ASC",
/* 222 */ "groupby_opt ::=", /* 222 */ "sortorder ::= DESC",
/* 223 */ "groupby_opt ::= GROUP BY grouplist", /* 223 */ "sortorder ::=",
/* 224 */ "grouplist ::= grouplist COMMA item", /* 224 */ "groupby_opt ::=",
/* 225 */ "grouplist ::= item", /* 225 */ "groupby_opt ::= GROUP BY grouplist",
/* 226 */ "having_opt ::=", /* 226 */ "grouplist ::= grouplist COMMA item",
/* 227 */ "having_opt ::= HAVING expr", /* 227 */ "grouplist ::= item",
/* 228 */ "limit_opt ::=", /* 228 */ "having_opt ::=",
/* 229 */ "limit_opt ::= LIMIT signed", /* 229 */ "having_opt ::= HAVING expr",
/* 230 */ "limit_opt ::= LIMIT signed OFFSET signed", /* 230 */ "limit_opt ::=",
/* 231 */ "limit_opt ::= LIMIT signed COMMA signed", /* 231 */ "limit_opt ::= LIMIT signed",
/* 232 */ "slimit_opt ::=", /* 232 */ "limit_opt ::= LIMIT signed OFFSET signed",
/* 233 */ "slimit_opt ::= SLIMIT signed", /* 233 */ "limit_opt ::= LIMIT signed COMMA signed",
/* 234 */ "slimit_opt ::= SLIMIT signed SOFFSET signed", /* 234 */ "slimit_opt ::=",
/* 235 */ "slimit_opt ::= SLIMIT signed COMMA signed", /* 235 */ "slimit_opt ::= SLIMIT signed",
/* 236 */ "where_opt ::=", /* 236 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
/* 237 */ "where_opt ::= WHERE expr", /* 237 */ "slimit_opt ::= SLIMIT signed COMMA signed",
/* 238 */ "expr ::= LP expr RP", /* 238 */ "where_opt ::=",
/* 239 */ "expr ::= ID", /* 239 */ "where_opt ::= WHERE expr",
/* 240 */ "expr ::= ID DOT ID", /* 240 */ "expr ::= LP expr RP",
/* 241 */ "expr ::= ID DOT STAR", /* 241 */ "expr ::= ID",
/* 242 */ "expr ::= INTEGER", /* 242 */ "expr ::= ID DOT ID",
/* 243 */ "expr ::= MINUS INTEGER", /* 243 */ "expr ::= ID DOT STAR",
/* 244 */ "expr ::= PLUS INTEGER", /* 244 */ "expr ::= INTEGER",
/* 245 */ "expr ::= FLOAT", /* 245 */ "expr ::= MINUS INTEGER",
/* 246 */ "expr ::= MINUS FLOAT", /* 246 */ "expr ::= PLUS INTEGER",
/* 247 */ "expr ::= PLUS FLOAT", /* 247 */ "expr ::= FLOAT",
/* 248 */ "expr ::= STRING", /* 248 */ "expr ::= MINUS FLOAT",
/* 249 */ "expr ::= NOW", /* 249 */ "expr ::= PLUS FLOAT",
/* 250 */ "expr ::= VARIABLE", /* 250 */ "expr ::= STRING",
/* 251 */ "expr ::= PLUS VARIABLE", /* 251 */ "expr ::= NOW",
/* 252 */ "expr ::= MINUS VARIABLE", /* 252 */ "expr ::= VARIABLE",
/* 253 */ "expr ::= BOOL", /* 253 */ "expr ::= PLUS VARIABLE",
/* 254 */ "expr ::= NULL", /* 254 */ "expr ::= MINUS VARIABLE",
/* 255 */ "expr ::= ID LP exprlist RP", /* 255 */ "expr ::= BOOL",
/* 256 */ "expr ::= ID LP STAR RP", /* 256 */ "expr ::= NULL",
/* 257 */ "expr ::= expr IS NULL", /* 257 */ "expr ::= ID LP exprlist RP",
/* 258 */ "expr ::= expr IS NOT NULL", /* 258 */ "expr ::= ID LP STAR RP",
/* 259 */ "expr ::= expr LT expr", /* 259 */ "expr ::= expr IS NULL",
/* 260 */ "expr ::= expr GT expr", /* 260 */ "expr ::= expr IS NOT NULL",
/* 261 */ "expr ::= expr LE expr", /* 261 */ "expr ::= expr LT expr",
/* 262 */ "expr ::= expr GE expr", /* 262 */ "expr ::= expr GT expr",
/* 263 */ "expr ::= expr NE expr", /* 263 */ "expr ::= expr LE expr",
/* 264 */ "expr ::= expr EQ expr", /* 264 */ "expr ::= expr GE expr",
/* 265 */ "expr ::= expr BETWEEN expr AND expr", /* 265 */ "expr ::= expr NE expr",
/* 266 */ "expr ::= expr AND expr", /* 266 */ "expr ::= expr EQ expr",
/* 267 */ "expr ::= expr OR expr", /* 267 */ "expr ::= expr BETWEEN expr AND expr",
/* 268 */ "expr ::= expr PLUS expr", /* 268 */ "expr ::= expr AND expr",
/* 269 */ "expr ::= expr MINUS expr", /* 269 */ "expr ::= expr OR expr",
/* 270 */ "expr ::= expr STAR expr", /* 270 */ "expr ::= expr PLUS expr",
/* 271 */ "expr ::= expr SLASH expr", /* 271 */ "expr ::= expr MINUS expr",
/* 272 */ "expr ::= expr REM expr", /* 272 */ "expr ::= expr STAR expr",
/* 273 */ "expr ::= expr LIKE expr", /* 273 */ "expr ::= expr SLASH expr",
/* 274 */ "expr ::= expr MATCH expr", /* 274 */ "expr ::= expr REM expr",
/* 275 */ "expr ::= expr NMATCH expr", /* 275 */ "expr ::= expr LIKE expr",
/* 276 */ "expr ::= expr IN LP exprlist RP", /* 276 */ "expr ::= expr MATCH expr",
/* 277 */ "exprlist ::= exprlist COMMA expritem", /* 277 */ "expr ::= expr NMATCH expr",
/* 278 */ "exprlist ::= expritem", /* 278 */ "expr ::= expr IN LP exprlist RP",
/* 279 */ "expritem ::= expr", /* 279 */ "exprlist ::= exprlist COMMA expritem",
/* 280 */ "expritem ::=", /* 280 */ "exprlist ::= expritem",
/* 281 */ "cmd ::= RESET QUERY CACHE", /* 281 */ "expritem ::= expr",
/* 282 */ "cmd ::= SYNCDB ids REPLICA", /* 282 */ "expritem ::=",
/* 283 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist", /* 283 */ "cmd ::= RESET QUERY CACHE",
/* 284 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids", /* 284 */ "cmd ::= SYNCDB ids REPLICA",
/* 285 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist", /* 285 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
/* 286 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist", /* 286 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
/* 287 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids", /* 287 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
/* 288 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids", /* 288 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
/* 289 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem", /* 289 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
/* 290 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist", /* 290 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
/* 291 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist", /* 291 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
/* 292 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids", /* 292 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
/* 293 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist", /* 293 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
/* 294 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist", /* 294 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
/* 295 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids", /* 295 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
/* 296 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids", /* 296 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
/* 297 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem", /* 297 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
/* 298 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist", /* 298 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
/* 299 */ "cmd ::= KILL CONNECTION INTEGER", /* 299 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
/* 300 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER", /* 300 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
/* 301 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER", /* 301 */ "cmd ::= KILL CONNECTION INTEGER",
/* 302 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
/* 303 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
}; };
#endif /* NDEBUG */ #endif /* NDEBUG */
...@@ -1418,28 +1435,29 @@ static int yyGrowStack(yyParser *p){ ...@@ -1418,28 +1435,29 @@ static int yyGrowStack(yyParser *p){
/* Initialize a new parser that has already been allocated. /* Initialize a new parser that has already been allocated.
*/ */
void ParseInit(void *yypParser){ void ParseInit(void *yypRawParser ParseCTX_PDECL){
yyParser *pParser = (yyParser*)yypParser; yyParser *yypParser = (yyParser*)yypRawParser;
ParseCTX_STORE
#ifdef YYTRACKMAXSTACKDEPTH #ifdef YYTRACKMAXSTACKDEPTH
pParser->yyhwm = 0; yypParser->yyhwm = 0;
#endif #endif
#if YYSTACKDEPTH<=0 #if YYSTACKDEPTH<=0
pParser->yytos = NULL; yypParser->yytos = NULL;
pParser->yystack = NULL; yypParser->yystack = NULL;
pParser->yystksz = 0; yypParser->yystksz = 0;
if( yyGrowStack(pParser) ){ if( yyGrowStack(yypParser) ){
pParser->yystack = &pParser->yystk0; yypParser->yystack = &yypParser->yystk0;
pParser->yystksz = 1; yypParser->yystksz = 1;
} }
#endif #endif
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
pParser->yyerrcnt = -1; yypParser->yyerrcnt = -1;
#endif #endif
pParser->yytos = pParser->yystack; yypParser->yytos = yypParser->yystack;
pParser->yystack[0].stateno = 0; yypParser->yystack[0].stateno = 0;
pParser->yystack[0].major = 0; yypParser->yystack[0].major = 0;
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
#endif #endif
} }
...@@ -1456,11 +1474,14 @@ void ParseInit(void *yypParser){ ...@@ -1456,11 +1474,14 @@ void ParseInit(void *yypParser){
** A pointer to a parser. This pointer is used in subsequent calls ** A pointer to a parser. This pointer is used in subsequent calls
** to Parse and ParseFree. ** to Parse and ParseFree.
*/ */
void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){
yyParser *pParser; yyParser *yypParser;
pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
if( pParser ) ParseInit(pParser); if( yypParser ){
return pParser; ParseCTX_STORE
ParseInit(yypParser ParseCTX_PARAM);
}
return (void*)yypParser;
} }
#endif /* Parse_ENGINEALWAYSONSTACK */ #endif /* Parse_ENGINEALWAYSONSTACK */
...@@ -1477,7 +1498,8 @@ static void yy_destructor( ...@@ -1477,7 +1498,8 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */ YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */ YYMINORTYPE *yypminor /* The object to be destroyed */
){ ){
ParseARG_FETCH; ParseARG_FETCH
ParseCTX_FETCH
switch( yymajor ){ switch( yymajor ){
/* Here is inserted the actions which take place when a /* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen ** terminal or non-terminal is destroyed. This can happen
...@@ -1491,60 +1513,60 @@ static void yy_destructor( ...@@ -1491,60 +1513,60 @@ static void yy_destructor(
*/ */
/********* Begin destructor definitions ***************************************/ /********* Begin destructor definitions ***************************************/
case 200: /* exprlist */ case 200: /* exprlist */
case 245: /* selcollist */ case 246: /* selcollist */
case 259: /* sclp */ case 260: /* sclp */
{ {
tSqlExprListDestroy((yypminor->yy165)); tSqlExprListDestroy((yypminor->yy225));
} }
break; break;
case 214: /* intitemlist */ case 214: /* intitemlist */
case 216: /* keep */ case 216: /* keep */
case 237: /* columnlist */ case 238: /* columnlist */
case 238: /* tagitemlist1 */ case 239: /* tagitemlist1 */
case 239: /* tagNamelist */ case 240: /* tagNamelist */
case 243: /* tagitemlist */ case 244: /* tagitemlist */
case 252: /* fill_opt */ case 253: /* fill_opt */
case 253: /* groupby_opt */ case 254: /* groupby_opt */
case 255: /* orderby_opt */ case 256: /* orderby_opt */
case 267: /* sortlist */ case 268: /* sortlist */
case 271: /* grouplist */ case 272: /* grouplist */
{ {
taosArrayDestroy((yypminor->yy165)); taosArrayDestroy((yypminor->yy225));
} }
break; break;
case 235: /* create_table_list */ case 236: /* create_table_list */
{ {
destroyCreateTableSql((yypminor->yy326)); destroyCreateTableSql((yypminor->yy482));
} }
break; break;
case 240: /* select */ case 241: /* select */
{ {
destroySqlNode((yypminor->yy278)); destroySqlNode((yypminor->yy185));
} }
break; break;
case 246: /* from */ case 247: /* from */
case 263: /* tablelist */ case 264: /* tablelist */
case 264: /* sub */ case 265: /* sub */
{ {
destroyRelationInfo((yypminor->yy10)); destroyRelationInfo((yypminor->yy160));
} }
break; break;
case 247: /* where_opt */ case 248: /* where_opt */
case 254: /* having_opt */ case 255: /* having_opt */
case 261: /* expr */ case 262: /* expr */
case 272: /* expritem */ case 273: /* expritem */
{ {
tSqlExprDestroy((yypminor->yy202)); tSqlExprDestroy((yypminor->yy226));
} }
break; break;
case 258: /* union */ case 259: /* union */
{ {
destroyAllSqlNode((yypminor->yy503)); destroyAllSqlNode((yypminor->yy93));
} }
break; break;
case 268: /* sortitem */ case 269: /* sortitem */
{ {
taosVariantDestroy(&(yypminor->yy425)); taosVariantDestroy(&(yypminor->yy1));
} }
break; break;
/********* End destructor definitions *****************************************/ /********* End destructor definitions *****************************************/
...@@ -1656,13 +1678,12 @@ int ParseCoverage(FILE *out){ ...@@ -1656,13 +1678,12 @@ int ParseCoverage(FILE *out){
** Find the appropriate action for a parser given the terminal ** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead. ** look-ahead token iLookAhead.
*/ */
static unsigned int yy_find_shift_action( static YYACTIONTYPE yy_find_shift_action(
yyParser *pParser, /* The parser */ YYCODETYPE iLookAhead, /* The look-ahead token */
YYCODETYPE iLookAhead /* The look-ahead token */ YYACTIONTYPE stateno /* Current state number */
){ ){
int i; int i;
int stateno = pParser->yytos->stateno;
if( stateno>YY_MAX_SHIFT ) return stateno; if( stateno>YY_MAX_SHIFT ) return stateno;
assert( stateno <= YY_SHIFT_COUNT ); assert( stateno <= YY_SHIFT_COUNT );
#if defined(YYCOVERAGE) #if defined(YYCOVERAGE)
...@@ -1670,11 +1691,12 @@ static unsigned int yy_find_shift_action( ...@@ -1670,11 +1691,12 @@ static unsigned int yy_find_shift_action(
#endif #endif
do{ do{
i = yy_shift_ofst[stateno]; i = yy_shift_ofst[stateno];
assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) ); assert( i>=0 );
/* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */
assert( iLookAhead!=YYNOCODE ); assert( iLookAhead!=YYNOCODE );
assert( iLookAhead < YYNTOKEN ); assert( iLookAhead < YYNTOKEN );
i += iLookAhead; i += iLookAhead;
if( yy_lookahead[i]!=iLookAhead ){ if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK #ifdef YYFALLBACK
YYCODETYPE iFallback; /* Fallback token */ YYCODETYPE iFallback; /* Fallback token */
if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
...@@ -1700,6 +1722,7 @@ static unsigned int yy_find_shift_action( ...@@ -1700,6 +1722,7 @@ static unsigned int yy_find_shift_action(
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
j<YY_ACTTAB_COUNT && j<YY_ACTTAB_COUNT &&
#endif #endif
j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) &&
yy_lookahead[j]==YYWILDCARD && iLookAhead>0 yy_lookahead[j]==YYWILDCARD && iLookAhead>0
){ ){
#ifndef NDEBUG #ifndef NDEBUG
...@@ -1724,8 +1747,8 @@ static unsigned int yy_find_shift_action( ...@@ -1724,8 +1747,8 @@ static unsigned int yy_find_shift_action(
** Find the appropriate action for a parser given the non-terminal ** Find the appropriate action for a parser given the non-terminal
** look-ahead token iLookAhead. ** look-ahead token iLookAhead.
*/ */
static int yy_find_reduce_action( static YYACTIONTYPE yy_find_reduce_action(
int stateno, /* Current state number */ YYACTIONTYPE stateno, /* Current state number */
YYCODETYPE iLookAhead /* The look-ahead token */ YYCODETYPE iLookAhead /* The look-ahead token */
){ ){
int i; int i;
...@@ -1754,7 +1777,8 @@ static int yy_find_reduce_action( ...@@ -1754,7 +1777,8 @@ static int yy_find_reduce_action(
** The following routine is called if the stack overflows. ** The following routine is called if the stack overflows.
*/ */
static void yyStackOverflow(yyParser *yypParser){ static void yyStackOverflow(yyParser *yypParser){
ParseARG_FETCH; ParseARG_FETCH
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
...@@ -1765,7 +1789,8 @@ static void yyStackOverflow(yyParser *yypParser){ ...@@ -1765,7 +1789,8 @@ static void yyStackOverflow(yyParser *yypParser){
** stack every overflows */ ** stack every overflows */
/******** Begin %stack_overflow code ******************************************/ /******** Begin %stack_overflow code ******************************************/
/******** End %stack_overflow code ********************************************/ /******** End %stack_overflow code ********************************************/
ParseARG_STORE; /* Suppress warning about unused %extra_argument var */ ParseARG_STORE /* Suppress warning about unused %extra_argument var */
ParseCTX_STORE
} }
/* /*
...@@ -1794,8 +1819,8 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ ...@@ -1794,8 +1819,8 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
*/ */
static void yy_shift( static void yy_shift(
yyParser *yypParser, /* The parser to be shifted */ yyParser *yypParser, /* The parser to be shifted */
int yyNewState, /* The new state to shift in */ YYACTIONTYPE yyNewState, /* The new state to shift in */
int yyMajor, /* The major token to shift in */ YYCODETYPE yyMajor, /* The major token to shift in */
ParseTOKENTYPE yyMinor /* The minor token to shift in */ ParseTOKENTYPE yyMinor /* The minor token to shift in */
){ ){
yyStackEntry *yytos; yyStackEntry *yytos;
...@@ -1825,8 +1850,8 @@ static void yy_shift( ...@@ -1825,8 +1850,8 @@ static void yy_shift(
yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
} }
yytos = yypParser->yytos; yytos = yypParser->yytos;
yytos->stateno = (YYACTIONTYPE)yyNewState; yytos->stateno = yyNewState;
yytos->major = (YYCODETYPE)yyMajor; yytos->major = yyMajor;
yytos->minor.yy0 = yyMinor; yytos->minor.yy0 = yyMinor;
yyTraceShift(yypParser, yyNewState, "Shift"); yyTraceShift(yypParser, yyNewState, "Shift");
} }
...@@ -1941,205 +1966,207 @@ static const struct { ...@@ -1941,205 +1966,207 @@ static const struct {
{ 229, -2 }, /* (100) update ::= UPDATE INTEGER */ { 229, -2 }, /* (100) update ::= UPDATE INTEGER */
{ 230, -2 }, /* (101) cachelast ::= CACHELAST INTEGER */ { 230, -2 }, /* (101) cachelast ::= CACHELAST INTEGER */
{ 231, -2 }, /* (102) vgroups ::= VGROUPS INTEGER */ { 231, -2 }, /* (102) vgroups ::= VGROUPS INTEGER */
{ 202, 0 }, /* (103) db_optr ::= */ { 232, -3 }, /* (103) stream_mode ::= STREAM MODE INTEGER */
{ 202, -2 }, /* (104) db_optr ::= db_optr cache */ { 202, 0 }, /* (104) db_optr ::= */
{ 202, -2 }, /* (105) db_optr ::= db_optr replica */ { 202, -2 }, /* (105) db_optr ::= db_optr cache */
{ 202, -2 }, /* (106) db_optr ::= db_optr quorum */ { 202, -2 }, /* (106) db_optr ::= db_optr replica */
{ 202, -2 }, /* (107) db_optr ::= db_optr days */ { 202, -2 }, /* (107) db_optr ::= db_optr quorum */
{ 202, -2 }, /* (108) db_optr ::= db_optr minrows */ { 202, -2 }, /* (108) db_optr ::= db_optr days */
{ 202, -2 }, /* (109) db_optr ::= db_optr maxrows */ { 202, -2 }, /* (109) db_optr ::= db_optr minrows */
{ 202, -2 }, /* (110) db_optr ::= db_optr blocks */ { 202, -2 }, /* (110) db_optr ::= db_optr maxrows */
{ 202, -2 }, /* (111) db_optr ::= db_optr ctime */ { 202, -2 }, /* (111) db_optr ::= db_optr blocks */
{ 202, -2 }, /* (112) db_optr ::= db_optr wal */ { 202, -2 }, /* (112) db_optr ::= db_optr ctime */
{ 202, -2 }, /* (113) db_optr ::= db_optr fsync */ { 202, -2 }, /* (113) db_optr ::= db_optr wal */
{ 202, -2 }, /* (114) db_optr ::= db_optr comp */ { 202, -2 }, /* (114) db_optr ::= db_optr fsync */
{ 202, -2 }, /* (115) db_optr ::= db_optr prec */ { 202, -2 }, /* (115) db_optr ::= db_optr comp */
{ 202, -2 }, /* (116) db_optr ::= db_optr keep */ { 202, -2 }, /* (116) db_optr ::= db_optr prec */
{ 202, -2 }, /* (117) db_optr ::= db_optr update */ { 202, -2 }, /* (117) db_optr ::= db_optr keep */
{ 202, -2 }, /* (118) db_optr ::= db_optr cachelast */ { 202, -2 }, /* (118) db_optr ::= db_optr update */
{ 202, -2 }, /* (119) db_optr ::= db_optr vgroups */ { 202, -2 }, /* (119) db_optr ::= db_optr cachelast */
{ 198, 0 }, /* (120) alter_db_optr ::= */ { 202, -2 }, /* (120) db_optr ::= db_optr vgroups */
{ 198, -2 }, /* (121) alter_db_optr ::= alter_db_optr replica */ { 202, -2 }, /* (121) db_optr ::= db_optr stream_mode */
{ 198, -2 }, /* (122) alter_db_optr ::= alter_db_optr quorum */ { 198, 0 }, /* (122) alter_db_optr ::= */
{ 198, -2 }, /* (123) alter_db_optr ::= alter_db_optr keep */ { 198, -2 }, /* (123) alter_db_optr ::= alter_db_optr replica */
{ 198, -2 }, /* (124) alter_db_optr ::= alter_db_optr blocks */ { 198, -2 }, /* (124) alter_db_optr ::= alter_db_optr quorum */
{ 198, -2 }, /* (125) alter_db_optr ::= alter_db_optr comp */ { 198, -2 }, /* (125) alter_db_optr ::= alter_db_optr keep */
{ 198, -2 }, /* (126) alter_db_optr ::= alter_db_optr update */ { 198, -2 }, /* (126) alter_db_optr ::= alter_db_optr blocks */
{ 198, -2 }, /* (127) alter_db_optr ::= alter_db_optr cachelast */ { 198, -2 }, /* (127) alter_db_optr ::= alter_db_optr comp */
{ 203, -1 }, /* (128) typename ::= ids */ { 198, -2 }, /* (128) alter_db_optr ::= alter_db_optr update */
{ 203, -4 }, /* (129) typename ::= ids LP signed RP */ { 198, -2 }, /* (129) alter_db_optr ::= alter_db_optr cachelast */
{ 203, -2 }, /* (130) typename ::= ids UNSIGNED */ { 203, -1 }, /* (130) typename ::= ids */
{ 232, -1 }, /* (131) signed ::= INTEGER */ { 203, -4 }, /* (131) typename ::= ids LP signed RP */
{ 232, -2 }, /* (132) signed ::= PLUS INTEGER */ { 203, -2 }, /* (132) typename ::= ids UNSIGNED */
{ 232, -2 }, /* (133) signed ::= MINUS INTEGER */ { 233, -1 }, /* (133) signed ::= INTEGER */
{ 193, -3 }, /* (134) cmd ::= CREATE TABLE create_table_args */ { 233, -2 }, /* (134) signed ::= PLUS INTEGER */
{ 193, -3 }, /* (135) cmd ::= CREATE TABLE create_stable_args */ { 233, -2 }, /* (135) signed ::= MINUS INTEGER */
{ 193, -3 }, /* (136) cmd ::= CREATE STABLE create_stable_args */ { 193, -3 }, /* (136) cmd ::= CREATE TABLE create_table_args */
{ 193, -3 }, /* (137) cmd ::= CREATE TABLE create_table_list */ { 193, -3 }, /* (137) cmd ::= CREATE TABLE create_stable_args */
{ 235, -1 }, /* (138) create_table_list ::= create_from_stable */ { 193, -3 }, /* (138) cmd ::= CREATE STABLE create_stable_args */
{ 235, -2 }, /* (139) create_table_list ::= create_table_list create_from_stable */ { 193, -3 }, /* (139) cmd ::= CREATE TABLE create_table_list */
{ 233, -6 }, /* (140) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ { 236, -1 }, /* (140) create_table_list ::= create_from_stable */
{ 234, -10 }, /* (141) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ { 236, -2 }, /* (141) create_table_list ::= create_table_list create_from_stable */
{ 236, -10 }, /* (142) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */ { 234, -6 }, /* (142) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{ 236, -13 }, /* (143) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */ { 235, -10 }, /* (143) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{ 239, -3 }, /* (144) tagNamelist ::= tagNamelist COMMA ids */ { 237, -10 }, /* (144) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
{ 239, -1 }, /* (145) tagNamelist ::= ids */ { 237, -13 }, /* (145) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
{ 233, -5 }, /* (146) create_table_args ::= ifnotexists ids cpxName AS select */ { 240, -3 }, /* (146) tagNamelist ::= tagNamelist COMMA ids */
{ 237, -3 }, /* (147) columnlist ::= columnlist COMMA column */ { 240, -1 }, /* (147) tagNamelist ::= ids */
{ 237, -1 }, /* (148) columnlist ::= column */ { 234, -5 }, /* (148) create_table_args ::= ifnotexists ids cpxName AS select */
{ 241, -2 }, /* (149) column ::= ids typename */ { 238, -3 }, /* (149) columnlist ::= columnlist COMMA column */
{ 238, -3 }, /* (150) tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */ { 238, -1 }, /* (150) columnlist ::= column */
{ 238, -1 }, /* (151) tagitemlist1 ::= tagitem1 */ { 242, -2 }, /* (151) column ::= ids typename */
{ 242, -2 }, /* (152) tagitem1 ::= MINUS INTEGER */ { 239, -3 }, /* (152) tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */
{ 242, -2 }, /* (153) tagitem1 ::= MINUS FLOAT */ { 239, -1 }, /* (153) tagitemlist1 ::= tagitem1 */
{ 242, -2 }, /* (154) tagitem1 ::= PLUS INTEGER */ { 243, -2 }, /* (154) tagitem1 ::= MINUS INTEGER */
{ 242, -2 }, /* (155) tagitem1 ::= PLUS FLOAT */ { 243, -2 }, /* (155) tagitem1 ::= MINUS FLOAT */
{ 242, -1 }, /* (156) tagitem1 ::= INTEGER */ { 243, -2 }, /* (156) tagitem1 ::= PLUS INTEGER */
{ 242, -1 }, /* (157) tagitem1 ::= FLOAT */ { 243, -2 }, /* (157) tagitem1 ::= PLUS FLOAT */
{ 242, -1 }, /* (158) tagitem1 ::= STRING */ { 243, -1 }, /* (158) tagitem1 ::= INTEGER */
{ 242, -1 }, /* (159) tagitem1 ::= BOOL */ { 243, -1 }, /* (159) tagitem1 ::= FLOAT */
{ 242, -1 }, /* (160) tagitem1 ::= NULL */ { 243, -1 }, /* (160) tagitem1 ::= STRING */
{ 242, -1 }, /* (161) tagitem1 ::= NOW */ { 243, -1 }, /* (161) tagitem1 ::= BOOL */
{ 243, -3 }, /* (162) tagitemlist ::= tagitemlist COMMA tagitem */ { 243, -1 }, /* (162) tagitem1 ::= NULL */
{ 243, -1 }, /* (163) tagitemlist ::= tagitem */ { 243, -1 }, /* (163) tagitem1 ::= NOW */
{ 244, -1 }, /* (164) tagitem ::= INTEGER */ { 244, -3 }, /* (164) tagitemlist ::= tagitemlist COMMA tagitem */
{ 244, -1 }, /* (165) tagitem ::= FLOAT */ { 244, -1 }, /* (165) tagitemlist ::= tagitem */
{ 244, -1 }, /* (166) tagitem ::= STRING */ { 245, -1 }, /* (166) tagitem ::= INTEGER */
{ 244, -1 }, /* (167) tagitem ::= BOOL */ { 245, -1 }, /* (167) tagitem ::= FLOAT */
{ 244, -1 }, /* (168) tagitem ::= NULL */ { 245, -1 }, /* (168) tagitem ::= STRING */
{ 244, -1 }, /* (169) tagitem ::= NOW */ { 245, -1 }, /* (169) tagitem ::= BOOL */
{ 244, -2 }, /* (170) tagitem ::= MINUS INTEGER */ { 245, -1 }, /* (170) tagitem ::= NULL */
{ 244, -2 }, /* (171) tagitem ::= MINUS FLOAT */ { 245, -1 }, /* (171) tagitem ::= NOW */
{ 244, -2 }, /* (172) tagitem ::= PLUS INTEGER */ { 245, -2 }, /* (172) tagitem ::= MINUS INTEGER */
{ 244, -2 }, /* (173) tagitem ::= PLUS FLOAT */ { 245, -2 }, /* (173) tagitem ::= MINUS FLOAT */
{ 240, -14 }, /* (174) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { 245, -2 }, /* (174) tagitem ::= PLUS INTEGER */
{ 240, -3 }, /* (175) select ::= LP select RP */ { 245, -2 }, /* (175) tagitem ::= PLUS FLOAT */
{ 258, -1 }, /* (176) union ::= select */ { 241, -14 }, /* (176) select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ 258, -4 }, /* (177) union ::= union UNION ALL select */ { 241, -3 }, /* (177) select ::= LP select RP */
{ 258, -3 }, /* (178) union ::= union UNION select */ { 259, -1 }, /* (178) union ::= select */
{ 193, -1 }, /* (179) cmd ::= union */ { 259, -4 }, /* (179) union ::= union UNION ALL select */
{ 240, -2 }, /* (180) select ::= SELECT selcollist */ { 259, -3 }, /* (180) union ::= union UNION select */
{ 259, -2 }, /* (181) sclp ::= selcollist COMMA */ { 193, -1 }, /* (181) cmd ::= union */
{ 259, 0 }, /* (182) sclp ::= */ { 241, -2 }, /* (182) select ::= SELECT selcollist */
{ 245, -4 }, /* (183) selcollist ::= sclp distinct expr as */ { 260, -2 }, /* (183) sclp ::= selcollist COMMA */
{ 245, -2 }, /* (184) selcollist ::= sclp STAR */ { 260, 0 }, /* (184) sclp ::= */
{ 262, -2 }, /* (185) as ::= AS ids */ { 246, -4 }, /* (185) selcollist ::= sclp distinct expr as */
{ 262, -1 }, /* (186) as ::= ids */ { 246, -2 }, /* (186) selcollist ::= sclp STAR */
{ 262, 0 }, /* (187) as ::= */ { 263, -2 }, /* (187) as ::= AS ids */
{ 260, -1 }, /* (188) distinct ::= DISTINCT */ { 263, -1 }, /* (188) as ::= ids */
{ 260, 0 }, /* (189) distinct ::= */ { 263, 0 }, /* (189) as ::= */
{ 246, -2 }, /* (190) from ::= FROM tablelist */ { 261, -1 }, /* (190) distinct ::= DISTINCT */
{ 246, -2 }, /* (191) from ::= FROM sub */ { 261, 0 }, /* (191) distinct ::= */
{ 264, -3 }, /* (192) sub ::= LP union RP */ { 247, -2 }, /* (192) from ::= FROM tablelist */
{ 264, -4 }, /* (193) sub ::= LP union RP ids */ { 247, -2 }, /* (193) from ::= FROM sub */
{ 264, -6 }, /* (194) sub ::= sub COMMA LP union RP ids */ { 265, -3 }, /* (194) sub ::= LP union RP */
{ 263, -2 }, /* (195) tablelist ::= ids cpxName */ { 265, -4 }, /* (195) sub ::= LP union RP ids */
{ 263, -3 }, /* (196) tablelist ::= ids cpxName ids */ { 265, -6 }, /* (196) sub ::= sub COMMA LP union RP ids */
{ 263, -4 }, /* (197) tablelist ::= tablelist COMMA ids cpxName */ { 264, -2 }, /* (197) tablelist ::= ids cpxName */
{ 263, -5 }, /* (198) tablelist ::= tablelist COMMA ids cpxName ids */ { 264, -3 }, /* (198) tablelist ::= ids cpxName ids */
{ 265, -1 }, /* (199) tmvar ::= VARIABLE */ { 264, -4 }, /* (199) tablelist ::= tablelist COMMA ids cpxName */
{ 248, -4 }, /* (200) interval_option ::= intervalKey LP tmvar RP */ { 264, -5 }, /* (200) tablelist ::= tablelist COMMA ids cpxName ids */
{ 248, -6 }, /* (201) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ { 266, -1 }, /* (201) tmvar ::= VARIABLE */
{ 248, 0 }, /* (202) interval_option ::= */ { 249, -4 }, /* (202) interval_option ::= intervalKey LP tmvar RP */
{ 266, -1 }, /* (203) intervalKey ::= INTERVAL */ { 249, -6 }, /* (203) interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{ 266, -1 }, /* (204) intervalKey ::= EVERY */ { 249, 0 }, /* (204) interval_option ::= */
{ 250, 0 }, /* (205) session_option ::= */ { 267, -1 }, /* (205) intervalKey ::= INTERVAL */
{ 250, -7 }, /* (206) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { 267, -1 }, /* (206) intervalKey ::= EVERY */
{ 251, 0 }, /* (207) windowstate_option ::= */ { 251, 0 }, /* (207) session_option ::= */
{ 251, -4 }, /* (208) windowstate_option ::= STATE_WINDOW LP ids RP */ { 251, -7 }, /* (208) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ 252, 0 }, /* (209) fill_opt ::= */ { 252, 0 }, /* (209) windowstate_option ::= */
{ 252, -6 }, /* (210) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { 252, -4 }, /* (210) windowstate_option ::= STATE_WINDOW LP ids RP */
{ 252, -4 }, /* (211) fill_opt ::= FILL LP ID RP */ { 253, 0 }, /* (211) fill_opt ::= */
{ 249, -4 }, /* (212) sliding_opt ::= SLIDING LP tmvar RP */ { 253, -6 }, /* (212) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ 249, 0 }, /* (213) sliding_opt ::= */ { 253, -4 }, /* (213) fill_opt ::= FILL LP ID RP */
{ 255, 0 }, /* (214) orderby_opt ::= */ { 250, -4 }, /* (214) sliding_opt ::= SLIDING LP tmvar RP */
{ 255, -3 }, /* (215) orderby_opt ::= ORDER BY sortlist */ { 250, 0 }, /* (215) sliding_opt ::= */
{ 267, -4 }, /* (216) sortlist ::= sortlist COMMA item sortorder */ { 256, 0 }, /* (216) orderby_opt ::= */
{ 267, -2 }, /* (217) sortlist ::= item sortorder */ { 256, -3 }, /* (217) orderby_opt ::= ORDER BY sortlist */
{ 269, -2 }, /* (218) item ::= ids cpxName */ { 268, -4 }, /* (218) sortlist ::= sortlist COMMA item sortorder */
{ 270, -1 }, /* (219) sortorder ::= ASC */ { 268, -2 }, /* (219) sortlist ::= item sortorder */
{ 270, -1 }, /* (220) sortorder ::= DESC */ { 270, -2 }, /* (220) item ::= ids cpxName */
{ 270, 0 }, /* (221) sortorder ::= */ { 271, -1 }, /* (221) sortorder ::= ASC */
{ 253, 0 }, /* (222) groupby_opt ::= */ { 271, -1 }, /* (222) sortorder ::= DESC */
{ 253, -3 }, /* (223) groupby_opt ::= GROUP BY grouplist */ { 271, 0 }, /* (223) sortorder ::= */
{ 271, -3 }, /* (224) grouplist ::= grouplist COMMA item */ { 254, 0 }, /* (224) groupby_opt ::= */
{ 271, -1 }, /* (225) grouplist ::= item */ { 254, -3 }, /* (225) groupby_opt ::= GROUP BY grouplist */
{ 254, 0 }, /* (226) having_opt ::= */ { 272, -3 }, /* (226) grouplist ::= grouplist COMMA item */
{ 254, -2 }, /* (227) having_opt ::= HAVING expr */ { 272, -1 }, /* (227) grouplist ::= item */
{ 257, 0 }, /* (228) limit_opt ::= */ { 255, 0 }, /* (228) having_opt ::= */
{ 257, -2 }, /* (229) limit_opt ::= LIMIT signed */ { 255, -2 }, /* (229) having_opt ::= HAVING expr */
{ 257, -4 }, /* (230) limit_opt ::= LIMIT signed OFFSET signed */ { 258, 0 }, /* (230) limit_opt ::= */
{ 257, -4 }, /* (231) limit_opt ::= LIMIT signed COMMA signed */ { 258, -2 }, /* (231) limit_opt ::= LIMIT signed */
{ 256, 0 }, /* (232) slimit_opt ::= */ { 258, -4 }, /* (232) limit_opt ::= LIMIT signed OFFSET signed */
{ 256, -2 }, /* (233) slimit_opt ::= SLIMIT signed */ { 258, -4 }, /* (233) limit_opt ::= LIMIT signed COMMA signed */
{ 256, -4 }, /* (234) slimit_opt ::= SLIMIT signed SOFFSET signed */ { 257, 0 }, /* (234) slimit_opt ::= */
{ 256, -4 }, /* (235) slimit_opt ::= SLIMIT signed COMMA signed */ { 257, -2 }, /* (235) slimit_opt ::= SLIMIT signed */
{ 247, 0 }, /* (236) where_opt ::= */ { 257, -4 }, /* (236) slimit_opt ::= SLIMIT signed SOFFSET signed */
{ 247, -2 }, /* (237) where_opt ::= WHERE expr */ { 257, -4 }, /* (237) slimit_opt ::= SLIMIT signed COMMA signed */
{ 261, -3 }, /* (238) expr ::= LP expr RP */ { 248, 0 }, /* (238) where_opt ::= */
{ 261, -1 }, /* (239) expr ::= ID */ { 248, -2 }, /* (239) where_opt ::= WHERE expr */
{ 261, -3 }, /* (240) expr ::= ID DOT ID */ { 262, -3 }, /* (240) expr ::= LP expr RP */
{ 261, -3 }, /* (241) expr ::= ID DOT STAR */ { 262, -1 }, /* (241) expr ::= ID */
{ 261, -1 }, /* (242) expr ::= INTEGER */ { 262, -3 }, /* (242) expr ::= ID DOT ID */
{ 261, -2 }, /* (243) expr ::= MINUS INTEGER */ { 262, -3 }, /* (243) expr ::= ID DOT STAR */
{ 261, -2 }, /* (244) expr ::= PLUS INTEGER */ { 262, -1 }, /* (244) expr ::= INTEGER */
{ 261, -1 }, /* (245) expr ::= FLOAT */ { 262, -2 }, /* (245) expr ::= MINUS INTEGER */
{ 261, -2 }, /* (246) expr ::= MINUS FLOAT */ { 262, -2 }, /* (246) expr ::= PLUS INTEGER */
{ 261, -2 }, /* (247) expr ::= PLUS FLOAT */ { 262, -1 }, /* (247) expr ::= FLOAT */
{ 261, -1 }, /* (248) expr ::= STRING */ { 262, -2 }, /* (248) expr ::= MINUS FLOAT */
{ 261, -1 }, /* (249) expr ::= NOW */ { 262, -2 }, /* (249) expr ::= PLUS FLOAT */
{ 261, -1 }, /* (250) expr ::= VARIABLE */ { 262, -1 }, /* (250) expr ::= STRING */
{ 261, -2 }, /* (251) expr ::= PLUS VARIABLE */ { 262, -1 }, /* (251) expr ::= NOW */
{ 261, -2 }, /* (252) expr ::= MINUS VARIABLE */ { 262, -1 }, /* (252) expr ::= VARIABLE */
{ 261, -1 }, /* (253) expr ::= BOOL */ { 262, -2 }, /* (253) expr ::= PLUS VARIABLE */
{ 261, -1 }, /* (254) expr ::= NULL */ { 262, -2 }, /* (254) expr ::= MINUS VARIABLE */
{ 261, -4 }, /* (255) expr ::= ID LP exprlist RP */ { 262, -1 }, /* (255) expr ::= BOOL */
{ 261, -4 }, /* (256) expr ::= ID LP STAR RP */ { 262, -1 }, /* (256) expr ::= NULL */
{ 261, -3 }, /* (257) expr ::= expr IS NULL */ { 262, -4 }, /* (257) expr ::= ID LP exprlist RP */
{ 261, -4 }, /* (258) expr ::= expr IS NOT NULL */ { 262, -4 }, /* (258) expr ::= ID LP STAR RP */
{ 261, -3 }, /* (259) expr ::= expr LT expr */ { 262, -3 }, /* (259) expr ::= expr IS NULL */
{ 261, -3 }, /* (260) expr ::= expr GT expr */ { 262, -4 }, /* (260) expr ::= expr IS NOT NULL */
{ 261, -3 }, /* (261) expr ::= expr LE expr */ { 262, -3 }, /* (261) expr ::= expr LT expr */
{ 261, -3 }, /* (262) expr ::= expr GE expr */ { 262, -3 }, /* (262) expr ::= expr GT expr */
{ 261, -3 }, /* (263) expr ::= expr NE expr */ { 262, -3 }, /* (263) expr ::= expr LE expr */
{ 261, -3 }, /* (264) expr ::= expr EQ expr */ { 262, -3 }, /* (264) expr ::= expr GE expr */
{ 261, -5 }, /* (265) expr ::= expr BETWEEN expr AND expr */ { 262, -3 }, /* (265) expr ::= expr NE expr */
{ 261, -3 }, /* (266) expr ::= expr AND expr */ { 262, -3 }, /* (266) expr ::= expr EQ expr */
{ 261, -3 }, /* (267) expr ::= expr OR expr */ { 262, -5 }, /* (267) expr ::= expr BETWEEN expr AND expr */
{ 261, -3 }, /* (268) expr ::= expr PLUS expr */ { 262, -3 }, /* (268) expr ::= expr AND expr */
{ 261, -3 }, /* (269) expr ::= expr MINUS expr */ { 262, -3 }, /* (269) expr ::= expr OR expr */
{ 261, -3 }, /* (270) expr ::= expr STAR expr */ { 262, -3 }, /* (270) expr ::= expr PLUS expr */
{ 261, -3 }, /* (271) expr ::= expr SLASH expr */ { 262, -3 }, /* (271) expr ::= expr MINUS expr */
{ 261, -3 }, /* (272) expr ::= expr REM expr */ { 262, -3 }, /* (272) expr ::= expr STAR expr */
{ 261, -3 }, /* (273) expr ::= expr LIKE expr */ { 262, -3 }, /* (273) expr ::= expr SLASH expr */
{ 261, -3 }, /* (274) expr ::= expr MATCH expr */ { 262, -3 }, /* (274) expr ::= expr REM expr */
{ 261, -3 }, /* (275) expr ::= expr NMATCH expr */ { 262, -3 }, /* (275) expr ::= expr LIKE expr */
{ 261, -5 }, /* (276) expr ::= expr IN LP exprlist RP */ { 262, -3 }, /* (276) expr ::= expr MATCH expr */
{ 200, -3 }, /* (277) exprlist ::= exprlist COMMA expritem */ { 262, -3 }, /* (277) expr ::= expr NMATCH expr */
{ 200, -1 }, /* (278) exprlist ::= expritem */ { 262, -5 }, /* (278) expr ::= expr IN LP exprlist RP */
{ 272, -1 }, /* (279) expritem ::= expr */ { 200, -3 }, /* (279) exprlist ::= exprlist COMMA expritem */
{ 272, 0 }, /* (280) expritem ::= */ { 200, -1 }, /* (280) exprlist ::= expritem */
{ 193, -3 }, /* (281) cmd ::= RESET QUERY CACHE */ { 273, -1 }, /* (281) expritem ::= expr */
{ 193, -3 }, /* (282) cmd ::= SYNCDB ids REPLICA */ { 273, 0 }, /* (282) expritem ::= */
{ 193, -7 }, /* (283) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ { 193, -3 }, /* (283) cmd ::= RESET QUERY CACHE */
{ 193, -7 }, /* (284) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ { 193, -3 }, /* (284) cmd ::= SYNCDB ids REPLICA */
{ 193, -7 }, /* (285) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ { 193, -7 }, /* (285) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{ 193, -7 }, /* (286) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ { 193, -7 }, /* (286) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{ 193, -7 }, /* (287) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ { 193, -7 }, /* (287) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{ 193, -8 }, /* (288) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ { 193, -7 }, /* (288) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{ 193, -9 }, /* (289) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ { 193, -7 }, /* (289) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{ 193, -7 }, /* (290) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ { 193, -8 }, /* (290) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{ 193, -7 }, /* (291) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ { 193, -9 }, /* (291) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{ 193, -7 }, /* (292) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ { 193, -7 }, /* (292) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{ 193, -7 }, /* (293) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ { 193, -7 }, /* (293) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{ 193, -7 }, /* (294) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ { 193, -7 }, /* (294) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{ 193, -7 }, /* (295) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ { 193, -7 }, /* (295) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{ 193, -8 }, /* (296) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ { 193, -7 }, /* (296) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{ 193, -9 }, /* (297) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ { 193, -7 }, /* (297) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{ 193, -7 }, /* (298) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ { 193, -8 }, /* (298) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{ 193, -3 }, /* (299) cmd ::= KILL CONNECTION INTEGER */ { 193, -9 }, /* (299) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
{ 193, -5 }, /* (300) cmd ::= KILL STREAM INTEGER COLON INTEGER */ { 193, -7 }, /* (300) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ 193, -5 }, /* (301) cmd ::= KILL QUERY INTEGER COLON INTEGER */ { 193, -3 }, /* (301) cmd ::= KILL CONNECTION INTEGER */
{ 193, -5 }, /* (302) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{ 193, -5 }, /* (303) cmd ::= KILL QUERY INTEGER COLON INTEGER */
}; };
static void yy_accept(yyParser*); /* Forward Declaration */ static void yy_accept(yyParser*); /* Forward Declaration */
...@@ -2154,17 +2181,18 @@ static void yy_accept(yyParser*); /* Forward Declaration */ ...@@ -2154,17 +2181,18 @@ static void yy_accept(yyParser*); /* Forward Declaration */
** only called from one place, optimizing compilers will in-line it, which ** only called from one place, optimizing compilers will in-line it, which
** means that the extra parameters have no performance impact. ** means that the extra parameters have no performance impact.
*/ */
static void yy_reduce( static YYACTIONTYPE yy_reduce(
yyParser *yypParser, /* The parser */ yyParser *yypParser, /* The parser */
unsigned int yyruleno, /* Number of the rule by which to reduce */ unsigned int yyruleno, /* Number of the rule by which to reduce */
int yyLookahead, /* Lookahead token, or YYNOCODE if none */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */
ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
ParseCTX_PDECL /* %extra_context */
){ ){
int yygoto; /* The next state */ int yygoto; /* The next state */
int yyact; /* The next action */ YYACTIONTYPE yyact; /* The next action */
yyStackEntry *yymsp; /* The top of the parser's stack */ yyStackEntry *yymsp; /* The top of the parser's stack */
int yysize; /* Amount to pop the stack */ int yysize; /* Amount to pop the stack */
ParseARG_FETCH; ParseARG_FETCH
(void)yyLookahead; (void)yyLookahead;
(void)yyLookaheadToken; (void)yyLookaheadToken;
yymsp = yypParser->yytos; yymsp = yypParser->yytos;
...@@ -2195,13 +2223,19 @@ static void yy_reduce( ...@@ -2195,13 +2223,19 @@ static void yy_reduce(
#if YYSTACKDEPTH>0 #if YYSTACKDEPTH>0
if( yypParser->yytos>=yypParser->yystackEnd ){ if( yypParser->yytos>=yypParser->yystackEnd ){
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
return; /* The call to yyStackOverflow() above pops the stack until it is
** empty, causing the main parser loop to exit. So the return value
** is never used and does not matter. */
return 0;
} }
#else #else
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
if( yyGrowStack(yypParser) ){ if( yyGrowStack(yypParser) ){
yyStackOverflow(yypParser); yyStackOverflow(yypParser);
return; /* The call to yyStackOverflow() above pops the stack until it is
** empty, causing the main parser loop to exit. So the return value
** is never used and does not matter. */
return 0;
} }
yymsp = yypParser->yytos; yymsp = yypParser->yytos;
} }
...@@ -2220,9 +2254,9 @@ static void yy_reduce( ...@@ -2220,9 +2254,9 @@ static void yy_reduce(
/********** Begin reduce actions **********************************************/ /********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor; YYMINORTYPE yylhsminor;
case 0: /* program ::= cmd */ case 0: /* program ::= cmd */
case 134: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==134); case 136: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==136);
case 135: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==135); case 137: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==137);
case 136: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==136); case 138: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==138);
{} {}
break; break;
case 1: /* cmd ::= SHOW DATABASES */ case 1: /* cmd ::= SHOW DATABASES */
...@@ -2262,7 +2296,7 @@ static void yy_reduce( ...@@ -2262,7 +2296,7 @@ static void yy_reduce(
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_VARIABLES, 0, 0); }
break; break;
case 13: /* cmd ::= SHOW SCORES */ case 13: /* cmd ::= SHOW SCORES */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_SCORES, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_TRANS, 0, 0); }
break; break;
case 14: /* cmd ::= SHOW GRANTS */ case 14: /* cmd ::= SHOW GRANTS */
{ setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); } { setShowOptions(pInfo, TSDB_MGMT_TABLE_GRANTS, 0, 0); }
...@@ -2398,16 +2432,16 @@ static void yy_reduce( ...@@ -2398,16 +2432,16 @@ static void yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } { setDCLSqlElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break; break;
case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */ case 47: /* cmd ::= ALTER DATABASE ids alter_db_optr */
{ SToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy16, &t);} { SToken t = {0}; setCreateDbInfo(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy326, &t);}
break; break;
case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */ case 48: /* cmd ::= ALTER ACCOUNT ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy211);} { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy523);}
break; break;
case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */ case 49: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);} { setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy523);}
break; break;
case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */ case 50: /* cmd ::= COMPACT VNODES IN LP exprlist RP */
{ setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy165);} { setCompactVnodeSql(pInfo, TSDB_SQL_COMPACT_VNODE, yymsp[-1].minor.yy225);}
break; break;
case 51: /* ids ::= ID */ case 51: /* ids ::= ID */
{yylhsminor.yy0 = yymsp[0].minor.yy0; } {yylhsminor.yy0 = yymsp[0].minor.yy0; }
...@@ -2418,7 +2452,7 @@ static void yy_reduce( ...@@ -2418,7 +2452,7 @@ static void yy_reduce(
break; break;
case 53: /* ifexists ::= */ case 53: /* ifexists ::= */
case 55: /* ifnotexists ::= */ yytestcase(yyruleno==55); case 55: /* ifnotexists ::= */ yytestcase(yyruleno==55);
case 189: /* distinct ::= */ yytestcase(yyruleno==189); case 191: /* distinct ::= */ yytestcase(yyruleno==191);
{ yymsp[1].minor.yy0.n = 0;} { yymsp[1].minor.yy0.n = 0;}
break; break;
case 54: /* ifnotexists ::= IF NOT EXISTS */ case 54: /* ifnotexists ::= IF NOT EXISTS */
...@@ -2429,16 +2463,16 @@ static void yy_reduce( ...@@ -2429,16 +2463,16 @@ static void yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} { setDCLSqlElems(pInfo, TSDB_SQL_CREATE_DNODE, 2, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
break; break;
case 58: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */ case 58: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy211);} { setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy523);}
break; break;
case 59: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */ case 59: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy16, &yymsp[-2].minor.yy0);} { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy326, &yymsp[-2].minor.yy0);}
break; break;
case 60: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ case 60: /* cmd ::= CREATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy106, &yymsp[0].minor.yy0, 1);} { setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy16, &yymsp[0].minor.yy0, 1);}
break; break;
case 61: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */ case 61: /* cmd ::= CREATE AGGREGATE FUNCTION ids AS ids OUTPUTTYPE typename bufsize */
{ setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy106, &yymsp[0].minor.yy0, 2);} { setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &yymsp[-5].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy16, &yymsp[0].minor.yy0, 2);}
break; break;
case 62: /* cmd ::= CREATE USER ids PASS ids */ case 62: /* cmd ::= CREATE USER ids PASS ids */
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);} { setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
...@@ -2469,38 +2503,38 @@ static void yy_reduce( ...@@ -2469,38 +2503,38 @@ static void yy_reduce(
break; break;
case 83: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */ case 83: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{ {
yylhsminor.yy211.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1; yylhsminor.yy523.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
yylhsminor.yy211.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1; yylhsminor.yy523.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
yylhsminor.yy211.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1; yylhsminor.yy523.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
yylhsminor.yy211.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1; yylhsminor.yy523.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
yylhsminor.yy211.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1; yylhsminor.yy523.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
yylhsminor.yy211.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1; yylhsminor.yy523.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy211.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1; yylhsminor.yy523.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
yylhsminor.yy211.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1; yylhsminor.yy523.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
yylhsminor.yy211.stat = yymsp[0].minor.yy0; yylhsminor.yy523.stat = yymsp[0].minor.yy0;
} }
yymsp[-8].minor.yy211 = yylhsminor.yy211; yymsp[-8].minor.yy523 = yylhsminor.yy523;
break; break;
case 84: /* intitemlist ::= intitemlist COMMA intitem */ case 84: /* intitemlist ::= intitemlist COMMA intitem */
case 162: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==162); case 164: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==164);
{ yylhsminor.yy165 = tListItemAppend(yymsp[-2].minor.yy165, &yymsp[0].minor.yy425, -1); } { yylhsminor.yy225 = tListItemAppend(yymsp[-2].minor.yy225, &yymsp[0].minor.yy1, -1); }
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 85: /* intitemlist ::= intitem */ case 85: /* intitemlist ::= intitem */
case 163: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==163); case 165: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==165);
{ yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[0].minor.yy425, -1); } { yylhsminor.yy225 = tListItemAppend(NULL, &yymsp[0].minor.yy1, -1); }
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 86: /* intitem ::= INTEGER */ case 86: /* intitem ::= INTEGER */
case 164: /* tagitem ::= INTEGER */ yytestcase(yyruleno==164); case 166: /* tagitem ::= INTEGER */ yytestcase(yyruleno==166);
case 165: /* tagitem ::= FLOAT */ yytestcase(yyruleno==165); case 167: /* tagitem ::= FLOAT */ yytestcase(yyruleno==167);
case 166: /* tagitem ::= STRING */ yytestcase(yyruleno==166); case 168: /* tagitem ::= STRING */ yytestcase(yyruleno==168);
case 167: /* tagitem ::= BOOL */ yytestcase(yyruleno==167); case 169: /* tagitem ::= BOOL */ yytestcase(yyruleno==169);
{ toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } { toTSDBType(yymsp[0].minor.yy0.type); taosVariantCreate(&yylhsminor.yy1, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); }
yymsp[0].minor.yy425 = yylhsminor.yy425; yymsp[0].minor.yy1 = yylhsminor.yy1;
break; break;
case 87: /* keep ::= KEEP intitemlist */ case 87: /* keep ::= KEEP intitemlist */
{ yymsp[-1].minor.yy165 = yymsp[0].minor.yy165; } { yymsp[-1].minor.yy225 = yymsp[0].minor.yy225; }
break; break;
case 88: /* cache ::= CACHE INTEGER */ case 88: /* cache ::= CACHE INTEGER */
case 89: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==89); case 89: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==89);
...@@ -2519,675 +2553,682 @@ static void yy_reduce( ...@@ -2519,675 +2553,682 @@ static void yy_reduce(
case 102: /* vgroups ::= VGROUPS INTEGER */ yytestcase(yyruleno==102); case 102: /* vgroups ::= VGROUPS INTEGER */ yytestcase(yyruleno==102);
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break; break;
case 103: /* db_optr ::= */ case 103: /* stream_mode ::= STREAM MODE INTEGER */
{setDefaultCreateDbOption(&yymsp[1].minor.yy16);} { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; }
break; break;
case 104: /* db_optr ::= db_optr cache */ case 104: /* db_optr ::= */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); } {setDefaultCreateDbOption(&yymsp[1].minor.yy326);}
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 105: /* db_optr ::= db_optr replica */ case 105: /* db_optr ::= db_optr cache */
case 121: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==121); { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); } yymsp[-1].minor.yy326 = yylhsminor.yy326;
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 106: /* db_optr ::= db_optr quorum */ case 106: /* db_optr ::= db_optr replica */
case 122: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==122); case 123: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==123);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 107: /* db_optr ::= db_optr days */ case 107: /* db_optr ::= db_optr quorum */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); } case 124: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==124);
yymsp[-1].minor.yy16 = yylhsminor.yy16; { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 108: /* db_optr ::= db_optr minrows */ case 108: /* db_optr ::= db_optr days */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 109: /* db_optr ::= db_optr maxrows */ case 109: /* db_optr ::= db_optr minrows */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 110: /* db_optr ::= db_optr blocks */ case 110: /* db_optr ::= db_optr maxrows */
case 124: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==124); { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); } yymsp[-1].minor.yy326 = yylhsminor.yy326;
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 111: /* db_optr ::= db_optr ctime */ case 111: /* db_optr ::= db_optr blocks */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); } case 126: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==126);
yymsp[-1].minor.yy16 = yylhsminor.yy16; { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 112: /* db_optr ::= db_optr wal */ case 112: /* db_optr ::= db_optr ctime */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 113: /* db_optr ::= db_optr fsync */ case 113: /* db_optr ::= db_optr wal */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 114: /* db_optr ::= db_optr comp */ case 114: /* db_optr ::= db_optr fsync */
case 125: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==125); { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); } yymsp[-1].minor.yy326 = yylhsminor.yy326;
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 115: /* db_optr ::= db_optr prec */ case 115: /* db_optr ::= db_optr comp */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.precision = yymsp[0].minor.yy0; } case 127: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==127);
yymsp[-1].minor.yy16 = yylhsminor.yy16; { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 116: /* db_optr ::= db_optr keep */ case 116: /* db_optr ::= db_optr prec */
case 123: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==123); { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.precision = yymsp[0].minor.yy0; }
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.keep = yymsp[0].minor.yy165; } yymsp[-1].minor.yy326 = yylhsminor.yy326;
yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 117: /* db_optr ::= db_optr update */ case 117: /* db_optr ::= db_optr keep */
case 126: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==126); case 125: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==125);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.keep = yymsp[0].minor.yy225; }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 118: /* db_optr ::= db_optr cachelast */ case 118: /* db_optr ::= db_optr update */
case 127: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==127); case 128: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==128);
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy16 = yylhsminor.yy16; yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 119: /* db_optr ::= db_optr vgroups */ case 119: /* db_optr ::= db_optr cachelast */
{ yylhsminor.yy16 = yymsp[-1].minor.yy16; yylhsminor.yy16.numOfVgroups = strtol(yymsp[0].minor.yy0.z, NULL, 10); } case 129: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==129);
yymsp[-1].minor.yy16 = yylhsminor.yy16; { yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break;
case 120: /* db_optr ::= db_optr vgroups */
{ yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.numOfVgroups = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break;
case 121: /* db_optr ::= db_optr stream_mode */
{ yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy326.streamMode = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy326 = yylhsminor.yy326;
break; break;
case 120: /* alter_db_optr ::= */ case 122: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy16);} { setDefaultCreateDbOption(&yymsp[1].minor.yy326);}
break; break;
case 128: /* typename ::= ids */ case 130: /* typename ::= ids */
{ {
yymsp[0].minor.yy0.type = 0; yymsp[0].minor.yy0.type = 0;
tSetColumnType (&yylhsminor.yy106, &yymsp[0].minor.yy0); tSetColumnType (&yylhsminor.yy16, &yymsp[0].minor.yy0);
} }
yymsp[0].minor.yy106 = yylhsminor.yy106; yymsp[0].minor.yy16 = yylhsminor.yy16;
break; break;
case 129: /* typename ::= ids LP signed RP */ case 131: /* typename ::= ids LP signed RP */
{ {
if (yymsp[-1].minor.yy207 <= 0) { if (yymsp[-1].minor.yy61 <= 0) {
yymsp[-3].minor.yy0.type = 0; yymsp[-3].minor.yy0.type = 0;
tSetColumnType(&yylhsminor.yy106, &yymsp[-3].minor.yy0); tSetColumnType(&yylhsminor.yy16, &yymsp[-3].minor.yy0);
} else { } else {
yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy207; // negative value of name length yymsp[-3].minor.yy0.type = -yymsp[-1].minor.yy61; // negative value of name length
tSetColumnType(&yylhsminor.yy106, &yymsp[-3].minor.yy0); tSetColumnType(&yylhsminor.yy16, &yymsp[-3].minor.yy0);
} }
} }
yymsp[-3].minor.yy106 = yylhsminor.yy106; yymsp[-3].minor.yy16 = yylhsminor.yy16;
break; break;
case 130: /* typename ::= ids UNSIGNED */ case 132: /* typename ::= ids UNSIGNED */
{ {
yymsp[-1].minor.yy0.type = 0; yymsp[-1].minor.yy0.type = 0;
yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z); yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
tSetColumnType (&yylhsminor.yy106, &yymsp[-1].minor.yy0); tSetColumnType (&yylhsminor.yy16, &yymsp[-1].minor.yy0);
} }
yymsp[-1].minor.yy106 = yylhsminor.yy106; yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 131: /* signed ::= INTEGER */ case 133: /* signed ::= INTEGER */
{ yylhsminor.yy207 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yylhsminor.yy61 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy207 = yylhsminor.yy207; yymsp[0].minor.yy61 = yylhsminor.yy61;
break; break;
case 132: /* signed ::= PLUS INTEGER */ case 134: /* signed ::= PLUS INTEGER */
{ yymsp[-1].minor.yy207 = strtol(yymsp[0].minor.yy0.z, NULL, 10); } { yymsp[-1].minor.yy61 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break; break;
case 133: /* signed ::= MINUS INTEGER */ case 135: /* signed ::= MINUS INTEGER */
{ yymsp[-1].minor.yy207 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);} { yymsp[-1].minor.yy61 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break; break;
case 137: /* cmd ::= CREATE TABLE create_table_list */ case 139: /* cmd ::= CREATE TABLE create_table_list */
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy326;} { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy482;}
break; break;
case 138: /* create_table_list ::= create_from_stable */ case 140: /* create_table_list ::= create_from_stable */
{ {
SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql)); SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo)); pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy150); taosArrayPush(pCreateTable->childTableInfo, &yymsp[0].minor.yy184);
pCreateTable->type = TSDB_SQL_CREATE_TABLE; pCreateTable->type = TSDB_SQL_CREATE_TABLE;
yylhsminor.yy326 = pCreateTable; yylhsminor.yy482 = pCreateTable;
} }
yymsp[0].minor.yy326 = yylhsminor.yy326; yymsp[0].minor.yy482 = yylhsminor.yy482;
break; break;
case 139: /* create_table_list ::= create_table_list create_from_stable */ case 141: /* create_table_list ::= create_table_list create_from_stable */
{ {
taosArrayPush(yymsp[-1].minor.yy326->childTableInfo, &yymsp[0].minor.yy150); taosArrayPush(yymsp[-1].minor.yy482->childTableInfo, &yymsp[0].minor.yy184);
yylhsminor.yy326 = yymsp[-1].minor.yy326; yylhsminor.yy482 = yymsp[-1].minor.yy482;
} }
yymsp[-1].minor.yy326 = yylhsminor.yy326; yymsp[-1].minor.yy482 = yylhsminor.yy482;
break; break;
case 140: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */ case 142: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{ {
yylhsminor.yy326 = tSetCreateTableInfo(yymsp[-1].minor.yy165, NULL, NULL, TSDB_SQL_CREATE_TABLE); yylhsminor.yy482 = tSetCreateTableInfo(yymsp[-1].minor.yy225, NULL, NULL, TSDB_SQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_TABLE); setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_TABLE);
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0); setCreatedTableName(pInfo, &yymsp[-4].minor.yy0, &yymsp[-5].minor.yy0);
} }
yymsp[-5].minor.yy326 = yylhsminor.yy326; yymsp[-5].minor.yy482 = yylhsminor.yy482;
break; break;
case 141: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */ case 143: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{ {
yylhsminor.yy326 = tSetCreateTableInfo(yymsp[-5].minor.yy165, yymsp[-1].minor.yy165, NULL, TSDB_SQL_CREATE_STABLE); yylhsminor.yy482 = tSetCreateTableInfo(yymsp[-5].minor.yy225, yymsp[-1].minor.yy225, NULL, TSDB_SQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_STABLE); setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_STABLE);
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); setCreatedTableName(pInfo, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
} }
yymsp[-9].minor.yy326 = yylhsminor.yy326; yymsp[-9].minor.yy482 = yylhsminor.yy482;
break; break;
case 142: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */ case 144: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist1 RP */
{ {
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yylhsminor.yy150 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy165, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0); yylhsminor.yy184 = createNewChildTableInfo(&yymsp[-5].minor.yy0, NULL, yymsp[-1].minor.yy225, &yymsp[-8].minor.yy0, &yymsp[-9].minor.yy0);
} }
yymsp[-9].minor.yy150 = yylhsminor.yy150; yymsp[-9].minor.yy184 = yylhsminor.yy184;
break; break;
case 143: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */ case 145: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist1 RP */
{ {
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n; yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n; yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
yylhsminor.yy150 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy165, yymsp[-1].minor.yy165, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0); yylhsminor.yy184 = createNewChildTableInfo(&yymsp[-8].minor.yy0, yymsp[-5].minor.yy225, yymsp[-1].minor.yy225, &yymsp[-11].minor.yy0, &yymsp[-12].minor.yy0);
} }
yymsp[-12].minor.yy150 = yylhsminor.yy150; yymsp[-12].minor.yy184 = yylhsminor.yy184;
break; break;
case 144: /* tagNamelist ::= tagNamelist COMMA ids */ case 146: /* tagNamelist ::= tagNamelist COMMA ids */
{taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy0); yylhsminor.yy165 = yymsp[-2].minor.yy165; } {taosArrayPush(yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); yylhsminor.yy225 = yymsp[-2].minor.yy225; }
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 145: /* tagNamelist ::= ids */ case 147: /* tagNamelist ::= ids */
{yylhsminor.yy165 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy0);} {yylhsminor.yy225 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy225, &yymsp[0].minor.yy0);}
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 146: /* create_table_args ::= ifnotexists ids cpxName AS select */ case 148: /* create_table_args ::= ifnotexists ids cpxName AS select */
{ {
// yylhsminor.yy326 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy278, TSQL_CREATE_STREAM); // yylhsminor.yy482 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy185, TSQL_CREATE_STREAM);
// setSqlInfo(pInfo, yylhsminor.yy326, NULL, TSDB_SQL_CREATE_TABLE); // setSqlInfo(pInfo, yylhsminor.yy482, NULL, TSDB_SQL_CREATE_TABLE);
// //
// yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n; // yymsp[-3].minor.yy0.n += yymsp[-2].minor.yy0.n;
// setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0); // setCreatedTableName(pInfo, &yymsp[-3].minor.yy0, &yymsp[-4].minor.yy0);
} }
yymsp[-4].minor.yy326 = yylhsminor.yy326; yymsp[-4].minor.yy482 = yylhsminor.yy482;
break; break;
case 147: /* columnlist ::= columnlist COMMA column */ case 149: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy106); yylhsminor.yy165 = yymsp[-2].minor.yy165; } {taosArrayPush(yymsp[-2].minor.yy225, &yymsp[0].minor.yy16); yylhsminor.yy225 = yymsp[-2].minor.yy225; }
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 148: /* columnlist ::= column */ case 150: /* columnlist ::= column */
{yylhsminor.yy165 = taosArrayInit(4, sizeof(SField)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy106);} {yylhsminor.yy225 = taosArrayInit(4, sizeof(SField)); taosArrayPush(yylhsminor.yy225, &yymsp[0].minor.yy16);}
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 149: /* column ::= ids typename */ case 151: /* column ::= ids typename */
{ {
tSetColumnInfo(&yylhsminor.yy106, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy106); tSetColumnInfo(&yylhsminor.yy16, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy16);
} }
yymsp[-1].minor.yy106 = yylhsminor.yy106; yymsp[-1].minor.yy16 = yylhsminor.yy16;
break; break;
case 150: /* tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */ case 152: /* tagitemlist1 ::= tagitemlist1 COMMA tagitem1 */
{ taosArrayPush(yymsp[-2].minor.yy165, &yymsp[0].minor.yy0); yylhsminor.yy165 = yymsp[-2].minor.yy165;} { taosArrayPush(yymsp[-2].minor.yy225, &yymsp[0].minor.yy0); yylhsminor.yy225 = yymsp[-2].minor.yy225;}
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 151: /* tagitemlist1 ::= tagitem1 */ case 153: /* tagitemlist1 ::= tagitem1 */
{ yylhsminor.yy165 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy165, &yymsp[0].minor.yy0); } { yylhsminor.yy225 = taosArrayInit(4, sizeof(SToken)); taosArrayPush(yylhsminor.yy225, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 152: /* tagitem1 ::= MINUS INTEGER */ case 154: /* tagitem1 ::= MINUS INTEGER */
case 153: /* tagitem1 ::= MINUS FLOAT */ yytestcase(yyruleno==153); case 155: /* tagitem1 ::= MINUS FLOAT */ yytestcase(yyruleno==155);
case 154: /* tagitem1 ::= PLUS INTEGER */ yytestcase(yyruleno==154); case 156: /* tagitem1 ::= PLUS INTEGER */ yytestcase(yyruleno==156);
case 155: /* tagitem1 ::= PLUS FLOAT */ yytestcase(yyruleno==155); case 157: /* tagitem1 ::= PLUS FLOAT */ yytestcase(yyruleno==157);
{ yylhsminor.yy0.n = yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n; yylhsminor.yy0.type = yymsp[0].minor.yy0.type; } { yylhsminor.yy0.n = yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n; yylhsminor.yy0.type = yymsp[0].minor.yy0.type; }
yymsp[-1].minor.yy0 = yylhsminor.yy0; yymsp[-1].minor.yy0 = yylhsminor.yy0;
break; break;
case 156: /* tagitem1 ::= INTEGER */ case 158: /* tagitem1 ::= INTEGER */
case 157: /* tagitem1 ::= FLOAT */ yytestcase(yyruleno==157); case 159: /* tagitem1 ::= FLOAT */ yytestcase(yyruleno==159);
case 158: /* tagitem1 ::= STRING */ yytestcase(yyruleno==158); case 160: /* tagitem1 ::= STRING */ yytestcase(yyruleno==160);
case 159: /* tagitem1 ::= BOOL */ yytestcase(yyruleno==159); case 161: /* tagitem1 ::= BOOL */ yytestcase(yyruleno==161);
case 160: /* tagitem1 ::= NULL */ yytestcase(yyruleno==160); case 162: /* tagitem1 ::= NULL */ yytestcase(yyruleno==162);
case 161: /* tagitem1 ::= NOW */ yytestcase(yyruleno==161); case 163: /* tagitem1 ::= NOW */ yytestcase(yyruleno==163);
{ yylhsminor.yy0 = yymsp[0].minor.yy0; } { yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0; yymsp[0].minor.yy0 = yylhsminor.yy0;
break; break;
case 168: /* tagitem ::= NULL */ case 170: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); } { yymsp[0].minor.yy0.type = 0; taosVariantCreate(&yylhsminor.yy1, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type); }
yymsp[0].minor.yy425 = yylhsminor.yy425; yymsp[0].minor.yy1 = yylhsminor.yy1;
break; break;
case 169: /* tagitem ::= NOW */ case 171: /* tagitem ::= NOW */
{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; taosVariantCreate(&yylhsminor.yy425, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type);} { yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; taosVariantCreate(&yylhsminor.yy1, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.type);}
yymsp[0].minor.yy425 = yylhsminor.yy425; yymsp[0].minor.yy1 = yylhsminor.yy1;
break; break;
case 170: /* tagitem ::= MINUS INTEGER */ case 172: /* tagitem ::= MINUS INTEGER */
case 171: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==171); case 173: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==173);
case 172: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==172); case 174: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==174);
case 173: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==173); case 175: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==175);
{ {
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type; yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
taosVariantCreate(&yylhsminor.yy425, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); taosVariantCreate(&yylhsminor.yy1, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type);
} }
yymsp[-1].minor.yy425 = yylhsminor.yy425; yymsp[-1].minor.yy1 = yylhsminor.yy1;
break; break;
case 174: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ case 176: /* select ::= SELECT selcollist from where_opt interval_option sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ {
yylhsminor.yy278 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy165, yymsp[-11].minor.yy10, yymsp[-10].minor.yy202, yymsp[-4].minor.yy165, yymsp[-2].minor.yy165, &yymsp[-9].minor.yy532, &yymsp[-7].minor.yy97, &yymsp[-6].minor.yy6, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy165, &yymsp[0].minor.yy367, &yymsp[-1].minor.yy367, yymsp[-3].minor.yy202); yylhsminor.yy185 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy225, yymsp[-11].minor.yy160, yymsp[-10].minor.yy226, yymsp[-4].minor.yy225, yymsp[-2].minor.yy225, &yymsp[-9].minor.yy52, &yymsp[-7].minor.yy463, &yymsp[-6].minor.yy112, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy225, &yymsp[0].minor.yy495, &yymsp[-1].minor.yy495, yymsp[-3].minor.yy226);
} }
yymsp[-13].minor.yy278 = yylhsminor.yy278; yymsp[-13].minor.yy185 = yylhsminor.yy185;
break; break;
case 175: /* select ::= LP select RP */ case 177: /* select ::= LP select RP */
{yymsp[-2].minor.yy278 = yymsp[-1].minor.yy278;} {yymsp[-2].minor.yy185 = yymsp[-1].minor.yy185;}
break; break;
case 176: /* union ::= select */ case 178: /* union ::= select */
{ yylhsminor.yy503 = setSubclause(NULL, yymsp[0].minor.yy278); } { yylhsminor.yy93 = setSubclause(NULL, yymsp[0].minor.yy185); }
yymsp[0].minor.yy503 = yylhsminor.yy503; yymsp[0].minor.yy93 = yylhsminor.yy93;
break; break;
case 177: /* union ::= union UNION ALL select */ case 179: /* union ::= union UNION ALL select */
{ yylhsminor.yy503 = appendSelectClause(yymsp[-3].minor.yy503, SQL_TYPE_UNIONALL, yymsp[0].minor.yy278); } { yylhsminor.yy93 = appendSelectClause(yymsp[-3].minor.yy93, SQL_TYPE_UNIONALL, yymsp[0].minor.yy185); }
yymsp[-3].minor.yy503 = yylhsminor.yy503; yymsp[-3].minor.yy93 = yylhsminor.yy93;
break; break;
case 178: /* union ::= union UNION select */ case 180: /* union ::= union UNION select */
{ yylhsminor.yy503 = appendSelectClause(yymsp[-2].minor.yy503, SQL_TYPE_UNION, yymsp[0].minor.yy278); } { yylhsminor.yy93 = appendSelectClause(yymsp[-2].minor.yy93, SQL_TYPE_UNION, yymsp[0].minor.yy185); }
yymsp[-2].minor.yy503 = yylhsminor.yy503; yymsp[-2].minor.yy93 = yylhsminor.yy93;
break; break;
case 179: /* cmd ::= union */ case 181: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy503, NULL, TSDB_SQL_SELECT); } { setSqlInfo(pInfo, yymsp[0].minor.yy93, NULL, TSDB_SQL_SELECT); }
break; break;
case 180: /* select ::= SELECT selcollist */ case 182: /* select ::= SELECT selcollist */
{ {
yylhsminor.yy278 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy165, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); yylhsminor.yy185 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy225, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
} }
yymsp[-1].minor.yy278 = yylhsminor.yy278; yymsp[-1].minor.yy185 = yylhsminor.yy185;
break; break;
case 181: /* sclp ::= selcollist COMMA */ case 183: /* sclp ::= selcollist COMMA */
{yylhsminor.yy165 = yymsp[-1].minor.yy165;} {yylhsminor.yy225 = yymsp[-1].minor.yy225;}
yymsp[-1].minor.yy165 = yylhsminor.yy165; yymsp[-1].minor.yy225 = yylhsminor.yy225;
break; break;
case 182: /* sclp ::= */ case 184: /* sclp ::= */
case 214: /* orderby_opt ::= */ yytestcase(yyruleno==214); case 216: /* orderby_opt ::= */ yytestcase(yyruleno==216);
{yymsp[1].minor.yy165 = 0;} {yymsp[1].minor.yy225 = 0;}
break; break;
case 183: /* selcollist ::= sclp distinct expr as */ case 185: /* selcollist ::= sclp distinct expr as */
{ {
yylhsminor.yy165 = tSqlExprListAppend(yymsp[-3].minor.yy165, yymsp[-1].minor.yy202, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); yylhsminor.yy225 = tSqlExprListAppend(yymsp[-3].minor.yy225, yymsp[-1].minor.yy226, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
} }
yymsp[-3].minor.yy165 = yylhsminor.yy165; yymsp[-3].minor.yy225 = yylhsminor.yy225;
break; break;
case 184: /* selcollist ::= sclp STAR */ case 186: /* selcollist ::= sclp STAR */
{ {
tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL); tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
yylhsminor.yy165 = tSqlExprListAppend(yymsp[-1].minor.yy165, pNode, 0, 0); yylhsminor.yy225 = tSqlExprListAppend(yymsp[-1].minor.yy225, pNode, 0, 0);
} }
yymsp[-1].minor.yy165 = yylhsminor.yy165; yymsp[-1].minor.yy225 = yylhsminor.yy225;
break; break;
case 185: /* as ::= AS ids */ case 187: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; } { yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break; break;
case 186: /* as ::= ids */ case 188: /* as ::= ids */
{ yylhsminor.yy0 = yymsp[0].minor.yy0; } { yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0; yymsp[0].minor.yy0 = yylhsminor.yy0;
break; break;
case 187: /* as ::= */ case 189: /* as ::= */
{ yymsp[1].minor.yy0.n = 0; } { yymsp[1].minor.yy0.n = 0; }
break; break;
case 188: /* distinct ::= DISTINCT */ case 190: /* distinct ::= DISTINCT */
{ yylhsminor.yy0 = yymsp[0].minor.yy0; } { yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0; yymsp[0].minor.yy0 = yylhsminor.yy0;
break; break;
case 190: /* from ::= FROM tablelist */ case 192: /* from ::= FROM tablelist */
case 191: /* from ::= FROM sub */ yytestcase(yyruleno==191); case 193: /* from ::= FROM sub */ yytestcase(yyruleno==193);
{yymsp[-1].minor.yy10 = yymsp[0].minor.yy10;} {yymsp[-1].minor.yy160 = yymsp[0].minor.yy160;}
break; break;
case 192: /* sub ::= LP union RP */ case 194: /* sub ::= LP union RP */
{yymsp[-2].minor.yy10 = addSubquery(NULL, yymsp[-1].minor.yy503, NULL);} {yymsp[-2].minor.yy160 = addSubquery(NULL, yymsp[-1].minor.yy93, NULL);}
break; break;
case 193: /* sub ::= LP union RP ids */ case 195: /* sub ::= LP union RP ids */
{yymsp[-3].minor.yy10 = addSubquery(NULL, yymsp[-2].minor.yy503, &yymsp[0].minor.yy0);} {yymsp[-3].minor.yy160 = addSubquery(NULL, yymsp[-2].minor.yy93, &yymsp[0].minor.yy0);}
break; break;
case 194: /* sub ::= sub COMMA LP union RP ids */ case 196: /* sub ::= sub COMMA LP union RP ids */
{yylhsminor.yy10 = addSubquery(yymsp[-5].minor.yy10, yymsp[-2].minor.yy503, &yymsp[0].minor.yy0);} {yylhsminor.yy160 = addSubquery(yymsp[-5].minor.yy160, yymsp[-2].minor.yy93, &yymsp[0].minor.yy0);}
yymsp[-5].minor.yy10 = yylhsminor.yy10; yymsp[-5].minor.yy160 = yylhsminor.yy160;
break; break;
case 195: /* tablelist ::= ids cpxName */ case 197: /* tablelist ::= ids cpxName */
{ {
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy10 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL); yylhsminor.yy160 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
} }
yymsp[-1].minor.yy10 = yylhsminor.yy10; yymsp[-1].minor.yy160 = yylhsminor.yy160;
break; break;
case 196: /* tablelist ::= ids cpxName ids */ case 198: /* tablelist ::= ids cpxName ids */
{ {
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy10 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); yylhsminor.yy160 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
} }
yymsp[-2].minor.yy10 = yylhsminor.yy10; yymsp[-2].minor.yy160 = yylhsminor.yy160;
break; break;
case 197: /* tablelist ::= tablelist COMMA ids cpxName */ case 199: /* tablelist ::= tablelist COMMA ids cpxName */
{ {
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy10 = setTableNameList(yymsp[-3].minor.yy10, &yymsp[-1].minor.yy0, NULL); yylhsminor.yy160 = setTableNameList(yymsp[-3].minor.yy160, &yymsp[-1].minor.yy0, NULL);
} }
yymsp[-3].minor.yy10 = yylhsminor.yy10; yymsp[-3].minor.yy160 = yylhsminor.yy160;
break; break;
case 198: /* tablelist ::= tablelist COMMA ids cpxName ids */ case 200: /* tablelist ::= tablelist COMMA ids cpxName ids */
{ {
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n; yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy10 = setTableNameList(yymsp[-4].minor.yy10, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); yylhsminor.yy160 = setTableNameList(yymsp[-4].minor.yy160, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
} }
yymsp[-4].minor.yy10 = yylhsminor.yy10; yymsp[-4].minor.yy160 = yylhsminor.yy160;
break; break;
case 199: /* tmvar ::= VARIABLE */ case 201: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;} {yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0; yymsp[0].minor.yy0 = yylhsminor.yy0;
break; break;
case 200: /* interval_option ::= intervalKey LP tmvar RP */ case 202: /* interval_option ::= intervalKey LP tmvar RP */
{yylhsminor.yy532.interval = yymsp[-1].minor.yy0; yylhsminor.yy532.offset.n = 0; yylhsminor.yy532.token = yymsp[-3].minor.yy46;} {yylhsminor.yy52.interval = yymsp[-1].minor.yy0; yylhsminor.yy52.offset.n = 0; yylhsminor.yy52.token = yymsp[-3].minor.yy460;}
yymsp[-3].minor.yy532 = yylhsminor.yy532; yymsp[-3].minor.yy52 = yylhsminor.yy52;
break; break;
case 201: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */ case 203: /* interval_option ::= intervalKey LP tmvar COMMA tmvar RP */
{yylhsminor.yy532.interval = yymsp[-3].minor.yy0; yylhsminor.yy532.offset = yymsp[-1].minor.yy0; yylhsminor.yy532.token = yymsp[-5].minor.yy46;} {yylhsminor.yy52.interval = yymsp[-3].minor.yy0; yylhsminor.yy52.offset = yymsp[-1].minor.yy0; yylhsminor.yy52.token = yymsp[-5].minor.yy460;}
yymsp[-5].minor.yy532 = yylhsminor.yy532; yymsp[-5].minor.yy52 = yylhsminor.yy52;
break; break;
case 202: /* interval_option ::= */ case 204: /* interval_option ::= */
{memset(&yymsp[1].minor.yy532, 0, sizeof(yymsp[1].minor.yy532));} {memset(&yymsp[1].minor.yy52, 0, sizeof(yymsp[1].minor.yy52));}
break; break;
case 203: /* intervalKey ::= INTERVAL */ case 205: /* intervalKey ::= INTERVAL */
{yymsp[0].minor.yy46 = TK_INTERVAL;} {yymsp[0].minor.yy460 = TK_INTERVAL;}
break; break;
case 204: /* intervalKey ::= EVERY */ case 206: /* intervalKey ::= EVERY */
{yymsp[0].minor.yy46 = TK_EVERY; } {yymsp[0].minor.yy460 = TK_EVERY; }
break; break;
case 205: /* session_option ::= */ case 207: /* session_option ::= */
{yymsp[1].minor.yy97.col.n = 0; yymsp[1].minor.yy97.gap.n = 0;} {yymsp[1].minor.yy463.col.n = 0; yymsp[1].minor.yy463.gap.n = 0;}
break; break;
case 206: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ case 208: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
yymsp[-6].minor.yy97.col = yymsp[-4].minor.yy0; yymsp[-6].minor.yy463.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy97.gap = yymsp[-1].minor.yy0; yymsp[-6].minor.yy463.gap = yymsp[-1].minor.yy0;
} }
break; break;
case 207: /* windowstate_option ::= */ case 209: /* windowstate_option ::= */
{ yymsp[1].minor.yy6.col.n = 0; yymsp[1].minor.yy6.col.z = NULL;} { yymsp[1].minor.yy112.col.n = 0; yymsp[1].minor.yy112.col.z = NULL;}
break; break;
case 208: /* windowstate_option ::= STATE_WINDOW LP ids RP */ case 210: /* windowstate_option ::= STATE_WINDOW LP ids RP */
{ yymsp[-3].minor.yy6.col = yymsp[-1].minor.yy0; } { yymsp[-3].minor.yy112.col = yymsp[-1].minor.yy0; }
break; break;
case 209: /* fill_opt ::= */ case 211: /* fill_opt ::= */
{ yymsp[1].minor.yy165 = 0; } { yymsp[1].minor.yy225 = 0; }
break; break;
case 210: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */ case 212: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ {
SVariant A = {0}; SVariant A = {0};
toTSDBType(yymsp[-3].minor.yy0.type); toTSDBType(yymsp[-3].minor.yy0.type);
taosVariantCreate(&A, yymsp[-3].minor.yy0.z, yymsp[-3].minor.yy0.n, yymsp[-3].minor.yy0.type); taosVariantCreate(&A, yymsp[-3].minor.yy0.z, yymsp[-3].minor.yy0.n, yymsp[-3].minor.yy0.type);
tListItemInsert(yymsp[-1].minor.yy165, &A, -1, 0); tListItemInsert(yymsp[-1].minor.yy225, &A, -1, 0);
yymsp[-5].minor.yy165 = yymsp[-1].minor.yy165; yymsp[-5].minor.yy225 = yymsp[-1].minor.yy225;
} }
break; break;
case 211: /* fill_opt ::= FILL LP ID RP */ case 213: /* fill_opt ::= FILL LP ID RP */
{ {
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy165 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1); yymsp[-3].minor.yy225 = tListItemAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
} }
break; break;
case 212: /* sliding_opt ::= SLIDING LP tmvar RP */ case 214: /* sliding_opt ::= SLIDING LP tmvar RP */
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; } {yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
break; break;
case 213: /* sliding_opt ::= */ case 215: /* sliding_opt ::= */
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; } {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break; break;
case 215: /* orderby_opt ::= ORDER BY sortlist */ case 217: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy165 = yymsp[0].minor.yy165;} {yymsp[-2].minor.yy225 = yymsp[0].minor.yy225;}
break; break;
case 216: /* sortlist ::= sortlist COMMA item sortorder */ case 218: /* sortlist ::= sortlist COMMA item sortorder */
{ {
yylhsminor.yy165 = tListItemAppend(yymsp[-3].minor.yy165, &yymsp[-1].minor.yy425, yymsp[0].minor.yy47); yylhsminor.yy225 = tListItemAppend(yymsp[-3].minor.yy225, &yymsp[-1].minor.yy1, yymsp[0].minor.yy40);
} }
yymsp[-3].minor.yy165 = yylhsminor.yy165; yymsp[-3].minor.yy225 = yylhsminor.yy225;
break; break;
case 217: /* sortlist ::= item sortorder */ case 219: /* sortlist ::= item sortorder */
{ {
yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[-1].minor.yy425, yymsp[0].minor.yy47); yylhsminor.yy225 = tListItemAppend(NULL, &yymsp[-1].minor.yy1, yymsp[0].minor.yy40);
} }
yymsp[-1].minor.yy165 = yylhsminor.yy165; yymsp[-1].minor.yy225 = yylhsminor.yy225;
break; break;
case 218: /* item ::= ids cpxName */ case 220: /* item ::= ids cpxName */
{ {
toTSDBType(yymsp[-1].minor.yy0.type); toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
taosVariantCreate(&yylhsminor.yy425, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type); taosVariantCreate(&yylhsminor.yy1, yymsp[-1].minor.yy0.z, yymsp[-1].minor.yy0.n, yymsp[-1].minor.yy0.type);
} }
yymsp[-1].minor.yy425 = yylhsminor.yy425; yymsp[-1].minor.yy1 = yylhsminor.yy1;
break; break;
case 219: /* sortorder ::= ASC */ case 221: /* sortorder ::= ASC */
{ yymsp[0].minor.yy47 = TSDB_ORDER_ASC; } { yymsp[0].minor.yy40 = TSDB_ORDER_ASC; }
break; break;
case 220: /* sortorder ::= DESC */ case 222: /* sortorder ::= DESC */
{ yymsp[0].minor.yy47 = TSDB_ORDER_DESC;} { yymsp[0].minor.yy40 = TSDB_ORDER_DESC;}
break; break;
case 221: /* sortorder ::= */ case 223: /* sortorder ::= */
{ yymsp[1].minor.yy47 = TSDB_ORDER_ASC; } { yymsp[1].minor.yy40 = TSDB_ORDER_ASC; }
break; break;
case 222: /* groupby_opt ::= */ case 224: /* groupby_opt ::= */
{ yymsp[1].minor.yy165 = 0;} { yymsp[1].minor.yy225 = 0;}
break; break;
case 223: /* groupby_opt ::= GROUP BY grouplist */ case 225: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy165 = yymsp[0].minor.yy165;} { yymsp[-2].minor.yy225 = yymsp[0].minor.yy225;}
break; break;
case 224: /* grouplist ::= grouplist COMMA item */ case 226: /* grouplist ::= grouplist COMMA item */
{ {
yylhsminor.yy165 = tListItemAppend(yymsp[-2].minor.yy165, &yymsp[0].minor.yy425, -1); yylhsminor.yy225 = tListItemAppend(yymsp[-2].minor.yy225, &yymsp[0].minor.yy1, -1);
} }
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 225: /* grouplist ::= item */ case 227: /* grouplist ::= item */
{ {
yylhsminor.yy165 = tListItemAppend(NULL, &yymsp[0].minor.yy425, -1); yylhsminor.yy225 = tListItemAppend(NULL, &yymsp[0].minor.yy1, -1);
} }
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 226: /* having_opt ::= */ case 228: /* having_opt ::= */
case 236: /* where_opt ::= */ yytestcase(yyruleno==236); case 238: /* where_opt ::= */ yytestcase(yyruleno==238);
case 280: /* expritem ::= */ yytestcase(yyruleno==280); case 282: /* expritem ::= */ yytestcase(yyruleno==282);
{yymsp[1].minor.yy202 = 0;} {yymsp[1].minor.yy226 = 0;}
break; break;
case 227: /* having_opt ::= HAVING expr */ case 229: /* having_opt ::= HAVING expr */
case 237: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==237); case 239: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==239);
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;} {yymsp[-1].minor.yy226 = yymsp[0].minor.yy226;}
break; break;
case 228: /* limit_opt ::= */ case 230: /* limit_opt ::= */
case 232: /* slimit_opt ::= */ yytestcase(yyruleno==232); case 234: /* slimit_opt ::= */ yytestcase(yyruleno==234);
{yymsp[1].minor.yy367.limit = -1; yymsp[1].minor.yy367.offset = 0;} {yymsp[1].minor.yy495.limit = -1; yymsp[1].minor.yy495.offset = 0;}
break; break;
case 229: /* limit_opt ::= LIMIT signed */ case 231: /* limit_opt ::= LIMIT signed */
case 233: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==233); case 235: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==235);
{yymsp[-1].minor.yy367.limit = yymsp[0].minor.yy207; yymsp[-1].minor.yy367.offset = 0;} {yymsp[-1].minor.yy495.limit = yymsp[0].minor.yy61; yymsp[-1].minor.yy495.offset = 0;}
break; break;
case 230: /* limit_opt ::= LIMIT signed OFFSET signed */ case 232: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy367.limit = yymsp[-2].minor.yy207; yymsp[-3].minor.yy367.offset = yymsp[0].minor.yy207;} { yymsp[-3].minor.yy495.limit = yymsp[-2].minor.yy61; yymsp[-3].minor.yy495.offset = yymsp[0].minor.yy61;}
break; break;
case 231: /* limit_opt ::= LIMIT signed COMMA signed */ case 233: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy367.limit = yymsp[0].minor.yy207; yymsp[-3].minor.yy367.offset = yymsp[-2].minor.yy207;} { yymsp[-3].minor.yy495.limit = yymsp[0].minor.yy61; yymsp[-3].minor.yy495.offset = yymsp[-2].minor.yy61;}
break; break;
case 234: /* slimit_opt ::= SLIMIT signed SOFFSET signed */ case 236: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy367.limit = yymsp[-2].minor.yy207; yymsp[-3].minor.yy367.offset = yymsp[0].minor.yy207;} {yymsp[-3].minor.yy495.limit = yymsp[-2].minor.yy61; yymsp[-3].minor.yy495.offset = yymsp[0].minor.yy61;}
break; break;
case 235: /* slimit_opt ::= SLIMIT signed COMMA signed */ case 237: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy367.limit = yymsp[0].minor.yy207; yymsp[-3].minor.yy367.offset = yymsp[-2].minor.yy207;} {yymsp[-3].minor.yy495.limit = yymsp[0].minor.yy61; yymsp[-3].minor.yy495.offset = yymsp[-2].minor.yy61;}
break; break;
case 238: /* expr ::= LP expr RP */ case 240: /* expr ::= LP expr RP */
{yylhsminor.yy202 = yymsp[-1].minor.yy202; yylhsminor.yy202->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy202->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} {yylhsminor.yy226 = yymsp[-1].minor.yy226; yylhsminor.yy226->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy226->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 239: /* expr ::= ID */ case 241: /* expr ::= ID */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 240: /* expr ::= ID DOT ID */ case 242: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);} { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 241: /* expr ::= ID DOT STAR */ case 243: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);} { yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 242: /* expr ::= INTEGER */ case 244: /* expr ::= INTEGER */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 243: /* expr ::= MINUS INTEGER */ case 245: /* expr ::= MINUS INTEGER */
case 244: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==244); case 246: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==246);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy202 = yylhsminor.yy202; yymsp[-1].minor.yy226 = yylhsminor.yy226;
break; break;
case 245: /* expr ::= FLOAT */ case 247: /* expr ::= FLOAT */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 246: /* expr ::= MINUS FLOAT */ case 248: /* expr ::= MINUS FLOAT */
case 247: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==247); case 249: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==249);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy202 = yylhsminor.yy202; yymsp[-1].minor.yy226 = yylhsminor.yy226;
break; break;
case 248: /* expr ::= STRING */ case 250: /* expr ::= STRING */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 249: /* expr ::= NOW */ case 251: /* expr ::= NOW */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); } { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 250: /* expr ::= VARIABLE */ case 252: /* expr ::= VARIABLE */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 251: /* expr ::= PLUS VARIABLE */ case 253: /* expr ::= PLUS VARIABLE */
case 252: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==252); case 254: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==254);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);} { yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
yymsp[-1].minor.yy202 = yylhsminor.yy202; yymsp[-1].minor.yy226 = yylhsminor.yy226;
break; break;
case 253: /* expr ::= BOOL */ case 255: /* expr ::= BOOL */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 254: /* expr ::= NULL */ case 256: /* expr ::= NULL */
{ yylhsminor.yy202 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);} { yylhsminor.yy226 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 255: /* expr ::= ID LP exprlist RP */ case 257: /* expr ::= ID LP exprlist RP */
{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy202 = tSqlExprCreateFunction(yymsp[-1].minor.yy165, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } { tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy226 = tSqlExprCreateFunction(yymsp[-1].minor.yy225, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy202 = yylhsminor.yy202; yymsp[-3].minor.yy226 = yylhsminor.yy226;
break; break;
case 256: /* expr ::= ID LP STAR RP */ case 258: /* expr ::= ID LP STAR RP */
{ tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy202 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); } { tRecordFuncName(pInfo->funcs, &yymsp[-3].minor.yy0); yylhsminor.yy226 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy202 = yylhsminor.yy202; yymsp[-3].minor.yy226 = yylhsminor.yy226;
break; break;
case 257: /* expr ::= expr IS NULL */ case 259: /* expr ::= expr IS NULL */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, NULL, TK_ISNULL);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, NULL, TK_ISNULL);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 258: /* expr ::= expr IS NOT NULL */ case 260: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-3].minor.yy202, NULL, TK_NOTNULL);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-3].minor.yy226, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy202 = yylhsminor.yy202; yymsp[-3].minor.yy226 = yylhsminor.yy226;
break; break;
case 259: /* expr ::= expr LT expr */ case 261: /* expr ::= expr LT expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LT);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LT);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 260: /* expr ::= expr GT expr */ case 262: /* expr ::= expr GT expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_GT);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_GT);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 261: /* expr ::= expr LE expr */ case 263: /* expr ::= expr LE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LE);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LE);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 262: /* expr ::= expr GE expr */ case 264: /* expr ::= expr GE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_GE);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_GE);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 263: /* expr ::= expr NE expr */ case 265: /* expr ::= expr NE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_NE);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_NE);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 264: /* expr ::= expr EQ expr */ case 266: /* expr ::= expr EQ expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_EQ);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_EQ);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 265: /* expr ::= expr BETWEEN expr AND expr */ case 267: /* expr ::= expr BETWEEN expr AND expr */
{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy202); yylhsminor.yy202 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy202, yymsp[-2].minor.yy202, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy202, TK_LE), TK_AND);} { tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy226); yylhsminor.yy226 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy226, yymsp[-2].minor.yy226, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy226, TK_LE), TK_AND);}
yymsp[-4].minor.yy202 = yylhsminor.yy202; yymsp[-4].minor.yy226 = yylhsminor.yy226;
break; break;
case 266: /* expr ::= expr AND expr */ case 268: /* expr ::= expr AND expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_AND);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_AND);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 267: /* expr ::= expr OR expr */ case 269: /* expr ::= expr OR expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_OR); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_OR); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 268: /* expr ::= expr PLUS expr */ case 270: /* expr ::= expr PLUS expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_PLUS); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_PLUS); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 269: /* expr ::= expr MINUS expr */ case 271: /* expr ::= expr MINUS expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_MINUS); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_MINUS); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 270: /* expr ::= expr STAR expr */ case 272: /* expr ::= expr STAR expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_STAR); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_STAR); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 271: /* expr ::= expr SLASH expr */ case 273: /* expr ::= expr SLASH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_DIVIDE);} {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_DIVIDE);}
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 272: /* expr ::= expr REM expr */ case 274: /* expr ::= expr REM expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_REM); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_REM); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 273: /* expr ::= expr LIKE expr */ case 275: /* expr ::= expr LIKE expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_LIKE); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_LIKE); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 274: /* expr ::= expr MATCH expr */ case 276: /* expr ::= expr MATCH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_MATCH); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_MATCH); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 275: /* expr ::= expr NMATCH expr */ case 277: /* expr ::= expr NMATCH expr */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-2].minor.yy202, yymsp[0].minor.yy202, TK_NMATCH); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-2].minor.yy226, yymsp[0].minor.yy226, TK_NMATCH); }
yymsp[-2].minor.yy202 = yylhsminor.yy202; yymsp[-2].minor.yy226 = yylhsminor.yy226;
break; break;
case 276: /* expr ::= expr IN LP exprlist RP */ case 278: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy202 = tSqlExprCreate(yymsp[-4].minor.yy202, (tSqlExpr*)yymsp[-1].minor.yy165, TK_IN); } {yylhsminor.yy226 = tSqlExprCreate(yymsp[-4].minor.yy226, (tSqlExpr*)yymsp[-1].minor.yy225, TK_IN); }
yymsp[-4].minor.yy202 = yylhsminor.yy202; yymsp[-4].minor.yy226 = yylhsminor.yy226;
break; break;
case 277: /* exprlist ::= exprlist COMMA expritem */ case 279: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy165 = tSqlExprListAppend(yymsp[-2].minor.yy165,yymsp[0].minor.yy202,0, 0);} {yylhsminor.yy225 = tSqlExprListAppend(yymsp[-2].minor.yy225,yymsp[0].minor.yy226,0, 0);}
yymsp[-2].minor.yy165 = yylhsminor.yy165; yymsp[-2].minor.yy225 = yylhsminor.yy225;
break; break;
case 278: /* exprlist ::= expritem */ case 280: /* exprlist ::= expritem */
{yylhsminor.yy165 = tSqlExprListAppend(0,yymsp[0].minor.yy202,0, 0);} {yylhsminor.yy225 = tSqlExprListAppend(0,yymsp[0].minor.yy226,0, 0);}
yymsp[0].minor.yy165 = yylhsminor.yy165; yymsp[0].minor.yy225 = yylhsminor.yy225;
break; break;
case 279: /* expritem ::= expr */ case 281: /* expritem ::= expr */
{yylhsminor.yy202 = yymsp[0].minor.yy202;} {yylhsminor.yy226 = yymsp[0].minor.yy226;}
yymsp[0].minor.yy202 = yylhsminor.yy202; yymsp[0].minor.yy226 = yylhsminor.yy226;
break; break;
case 281: /* cmd ::= RESET QUERY CACHE */ case 283: /* cmd ::= RESET QUERY CACHE */
{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);} { setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
break; break;
case 282: /* cmd ::= SYNCDB ids REPLICA */ case 284: /* cmd ::= SYNCDB ids REPLICA */
{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);} { setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
break; break;
case 283: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */ case 285: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 284: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */ case 286: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
toTSDBType(yymsp[0].minor.yy0.type); toTSDBType(yymsp[0].minor.yy0.type);
...@@ -3196,21 +3237,21 @@ static void yy_reduce( ...@@ -3196,21 +3237,21 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 285: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */ case 287: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 286: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */ case 288: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_TAG, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_ADD_TAG, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 287: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */ case 289: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
...@@ -3221,7 +3262,7 @@ static void yy_reduce( ...@@ -3221,7 +3262,7 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 288: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */ case 290: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{ {
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
...@@ -3235,33 +3276,33 @@ static void yy_reduce( ...@@ -3235,33 +3276,33 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 289: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */ case 291: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{ {
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1); SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tListItemAppend(A, &yymsp[0].minor.yy425, -1); A = tListItemAppend(A, &yymsp[0].minor.yy1, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 290: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */ case 292: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, -1); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 291: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */ case 293: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 292: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */ case 294: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
...@@ -3272,21 +3313,21 @@ static void yy_reduce( ...@@ -3272,21 +3313,21 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 293: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */ case 295: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 294: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */ case 296: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_ADD_TAG, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_ADD_TAG, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 295: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */ case 297: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
...@@ -3297,7 +3338,7 @@ static void yy_reduce( ...@@ -3297,7 +3338,7 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 296: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */ case 298: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
{ {
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n; yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
...@@ -3311,32 +3352,32 @@ static void yy_reduce( ...@@ -3311,32 +3352,32 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 297: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */ case 299: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
{ {
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n; yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
toTSDBType(yymsp[-2].minor.yy0.type); toTSDBType(yymsp[-2].minor.yy0.type);
SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1); SArray* A = tListItemAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tListItemAppend(A, &yymsp[0].minor.yy425, -1); A = tListItemAppend(A, &yymsp[0].minor.yy1, -1);
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 298: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */ case 300: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
{ {
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n; yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy165, NULL, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, TSDB_SUPER_TABLE); SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy225, NULL, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE); setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
} }
break; break;
case 299: /* cmd ::= KILL CONNECTION INTEGER */ case 301: /* cmd ::= KILL CONNECTION INTEGER */
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);} {setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
break; break;
case 300: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */ case 302: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);} {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
break; break;
case 301: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */ case 303: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);} {yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);}
break; break;
default: default:
...@@ -3360,6 +3401,7 @@ static void yy_reduce( ...@@ -3360,6 +3401,7 @@ static void yy_reduce(
yymsp->stateno = (YYACTIONTYPE)yyact; yymsp->stateno = (YYACTIONTYPE)yyact;
yymsp->major = (YYCODETYPE)yygoto; yymsp->major = (YYCODETYPE)yygoto;
yyTraceShift(yypParser, yyact, "... then shift"); yyTraceShift(yypParser, yyact, "... then shift");
return yyact;
} }
/* /*
...@@ -3369,7 +3411,8 @@ static void yy_reduce( ...@@ -3369,7 +3411,8 @@ static void yy_reduce(
static void yy_parse_failed( static void yy_parse_failed(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
ParseARG_FETCH; ParseARG_FETCH
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
...@@ -3380,7 +3423,8 @@ static void yy_parse_failed( ...@@ -3380,7 +3423,8 @@ static void yy_parse_failed(
** parser fails */ ** parser fails */
/************ Begin %parse_failure code ***************************************/ /************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/ /************ End %parse_failure code *****************************************/
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
#endif /* YYNOERRORRECOVERY */ #endif /* YYNOERRORRECOVERY */
...@@ -3392,7 +3436,8 @@ static void yy_syntax_error( ...@@ -3392,7 +3436,8 @@ static void yy_syntax_error(
int yymajor, /* The major type of the error token */ int yymajor, /* The major type of the error token */
ParseTOKENTYPE yyminor /* The minor type of the error token */ ParseTOKENTYPE yyminor /* The minor type of the error token */
){ ){
ParseARG_FETCH; ParseARG_FETCH
ParseCTX_FETCH
#define TOKEN yyminor #define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/ /************ Begin %syntax_error code ****************************************/
...@@ -3418,7 +3463,8 @@ static void yy_syntax_error( ...@@ -3418,7 +3463,8 @@ static void yy_syntax_error(
assert(len <= outputBufLen); assert(len <= outputBufLen);
/************ End %syntax_error code ******************************************/ /************ End %syntax_error code ******************************************/
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
/* /*
...@@ -3427,7 +3473,8 @@ static void yy_syntax_error( ...@@ -3427,7 +3473,8 @@ static void yy_syntax_error(
static void yy_accept( static void yy_accept(
yyParser *yypParser /* The parser */ yyParser *yypParser /* The parser */
){ ){
ParseARG_FETCH; ParseARG_FETCH
ParseCTX_FETCH
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
...@@ -3442,7 +3489,8 @@ static void yy_accept( ...@@ -3442,7 +3489,8 @@ static void yy_accept(
/*********** Begin %parse_accept code *****************************************/ /*********** Begin %parse_accept code *****************************************/
/*********** End %parse_accept code *******************************************/ /*********** End %parse_accept code *******************************************/
ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
ParseCTX_STORE
} }
/* The main parser program. /* The main parser program.
...@@ -3471,45 +3519,47 @@ void Parse( ...@@ -3471,45 +3519,47 @@ void Parse(
ParseARG_PDECL /* Optional %extra_argument parameter */ ParseARG_PDECL /* Optional %extra_argument parameter */
){ ){
YYMINORTYPE yyminorunion; YYMINORTYPE yyminorunion;
unsigned int yyact; /* The parser action. */ YYACTIONTYPE yyact; /* The parser action. */
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
int yyendofinput; /* True if we are at the end of input */ int yyendofinput; /* True if we are at the end of input */
#endif #endif
#ifdef YYERRORSYMBOL #ifdef YYERRORSYMBOL
int yyerrorhit = 0; /* True if yymajor has invoked an error */ int yyerrorhit = 0; /* True if yymajor has invoked an error */
#endif #endif
yyParser *yypParser; /* The parser */ yyParser *yypParser = (yyParser*)yyp; /* The parser */
ParseCTX_FETCH
ParseARG_STORE
yypParser = (yyParser*)yyp;
assert( yypParser->yytos!=0 ); assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
yyendofinput = (yymajor==0); yyendofinput = (yymajor==0);
#endif #endif
ParseARG_STORE;
yyact = yypParser->yytos->stateno;
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
int stateno = yypParser->yytos->stateno; if( yyact < YY_MIN_REDUCE ){
if( stateno < YY_MIN_REDUCE ){
fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
yyTracePrompt,yyTokenName[yymajor],stateno); yyTracePrompt,yyTokenName[yymajor],yyact);
}else{ }else{
fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE); yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
} }
} }
#endif #endif
do{ do{
yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); assert( yyact==yypParser->yytos->stateno );
yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){ if( yyact >= YY_MIN_REDUCE ){
yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor); yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){ }else if( yyact <= YY_MAX_SHIFTREDUCE ){
yy_shift(yypParser,yyact,yymajor,yyminor); yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY #ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt--; yypParser->yyerrcnt--;
#endif #endif
yymajor = YYNOCODE; break;
}else if( yyact==YY_ACCEPT_ACTION ){ }else if( yyact==YY_ACCEPT_ACTION ){
yypParser->yytos--; yypParser->yytos--;
yy_accept(yypParser); yy_accept(yypParser);
...@@ -3560,10 +3610,9 @@ void Parse( ...@@ -3560,10 +3610,9 @@ void Parse(
yymajor = YYNOCODE; yymajor = YYNOCODE;
}else{ }else{
while( yypParser->yytos >= yypParser->yystack while( yypParser->yytos >= yypParser->yystack
&& yymx != YYERRORSYMBOL
&& (yyact = yy_find_reduce_action( && (yyact = yy_find_reduce_action(
yypParser->yytos->stateno, yypParser->yytos->stateno,
YYERRORSYMBOL)) >= YY_MIN_REDUCE YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
){ ){
yy_pop_parser_stack(yypParser); yy_pop_parser_stack(yypParser);
} }
...@@ -3580,6 +3629,8 @@ void Parse( ...@@ -3580,6 +3629,8 @@ void Parse(
} }
yypParser->yyerrcnt = 3; yypParser->yyerrcnt = 3;
yyerrorhit = 1; yyerrorhit = 1;
if( yymajor==YYNOCODE ) break;
yyact = yypParser->yytos->stateno;
#elif defined(YYNOERRORRECOVERY) #elif defined(YYNOERRORRECOVERY)
/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
** do any kind of error recovery. Instead, simply invoke the syntax ** do any kind of error recovery. Instead, simply invoke the syntax
...@@ -3590,8 +3641,7 @@ void Parse( ...@@ -3590,8 +3641,7 @@ void Parse(
*/ */
yy_syntax_error(yypParser,yymajor, yyminor); yy_syntax_error(yypParser,yymajor, yyminor);
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
yymajor = YYNOCODE; break;
#else /* YYERRORSYMBOL is not defined */ #else /* YYERRORSYMBOL is not defined */
/* This is what we do if the grammar does not define ERROR: /* This is what we do if the grammar does not define ERROR:
** **
...@@ -3613,10 +3663,10 @@ void Parse( ...@@ -3613,10 +3663,10 @@ void Parse(
yypParser->yyerrcnt = -1; yypParser->yyerrcnt = -1;
#endif #endif
} }
yymajor = YYNOCODE; break;
#endif #endif
} }
}while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); }while( yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG #ifndef NDEBUG
if( yyTraceFILE ){ if( yyTraceFILE ){
yyStackEntry *i; yyStackEntry *i;
...@@ -3631,3 +3681,18 @@ void Parse( ...@@ -3631,3 +3681,18 @@ void Parse(
#endif #endif
return; return;
} }
/*
** Return the fallback token corresponding to canonical token iToken, or
** 0 if iToken has no fallback.
*/
int ParseFallback(int iToken){
#ifdef YYFALLBACK
if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
return yyFallback[iToken];
}
#else
(void)iToken;
#endif
return 0;
}
...@@ -230,6 +230,7 @@ static SKeyword keywordTable[] = { ...@@ -230,6 +230,7 @@ static SKeyword keywordTable[] = {
{"PORT", TK_PORT}, {"PORT", TK_PORT},
{"INNER", NEW_TK_INNER}, {"INNER", NEW_TK_INNER},
{"ON", NEW_TK_ON}, {"ON", NEW_TK_ON},
{"MODE", TK_MODE},
}; };
static const char isIdChar[] = { static const char isIdChar[] = {
......
...@@ -25,6 +25,7 @@ extern "C" { ...@@ -25,6 +25,7 @@ extern "C" {
typedef struct SLogicNode { typedef struct SLogicNode {
ENodeType type; ENodeType type;
int32_t id;
SNodeList* pTargets; SNodeList* pTargets;
SNode* pConditions; SNode* pConditions;
SNodeList* pChildren; SNodeList* pChildren;
...@@ -37,6 +38,12 @@ typedef struct SScanLogicNode { ...@@ -37,6 +38,12 @@ typedef struct SScanLogicNode {
struct STableMeta* pMeta; struct STableMeta* pMeta;
} SScanLogicNode; } SScanLogicNode;
typedef struct SJoinLogicNode {
SLogicNode node;
EJoinType joinType;
SNode* pOnConditions;
} SJoinLogicNode;
typedef struct SFilterLogicNode { typedef struct SFilterLogicNode {
SLogicNode node; SLogicNode node;
} SFilterLogicNode; } SFilterLogicNode;
...@@ -47,6 +54,10 @@ typedef struct SAggLogicNode { ...@@ -47,6 +54,10 @@ typedef struct SAggLogicNode {
SNodeList* pAggFuncs; SNodeList* pAggFuncs;
} SAggLogicNode; } SAggLogicNode;
typedef struct SProjectLogicNode {
SLogicNode node;
} SProjectLogicNode;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -16,83 +16,62 @@ ...@@ -16,83 +16,62 @@
#include "plannerImpl.h" #include "plannerImpl.h"
#include "functionMgt.h" #include "functionMgt.h"
static SLogicNode* createQueryLogicNode(SNode* pStmt); #define CHECK_ALLOC(p, res) \
do { \
typedef struct SCollectColumnsCxt { if (NULL == p) { \
SNodeList* pCols; pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY; \
SHashObj* pColIdHash; return res; \
} SCollectColumnsCxt; } \
} while (0)
static EDealRes doCollectColumns(SNode* pNode, void* pContext) {
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
SCollectColumnsCxt* pCxt = (SCollectColumnsCxt*)pContext;
int16_t colId = ((SColumnNode*)pNode)->colId;
if (colId > 0) {
if (NULL == taosHashGet(pCxt->pColIdHash, &colId, sizeof(colId))) {
taosHashPut(pCxt->pColIdHash, &colId, sizeof(colId), NULL, 0);
nodesListAppend(pCxt->pCols, pNode);
}
}
}
return DEAL_RES_CONTINUE;
}
static SNodeList* collectColumns(SSelectStmt* pSelect) { #define CHECK_CODE(exec, res) \
SCollectColumnsCxt cxt = { .pCols = nodesMakeList(), .pColIdHash = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK) }; do { \
if (NULL == cxt.pCols || NULL == cxt.pColIdHash) { int32_t code = exec; \
return NULL; if (TSDB_CODE_SUCCESS != code) { \
} pCxt->errCode = code; \
nodesWalkNode(pSelect->pFromTable, doCollectColumns, &cxt); return res; \
nodesWalkNode(pSelect->pWhere, doCollectColumns, &cxt); } \
nodesWalkList(pSelect->pPartitionByList, doCollectColumns, &cxt); } while (0)
nodesWalkNode(pSelect->pWindow, doCollectColumns, &cxt);
nodesWalkList(pSelect->pGroupByList, doCollectColumns, &cxt);
nodesWalkNode(pSelect->pHaving, doCollectColumns, &cxt);
nodesWalkList(pSelect->pProjectionList, doCollectColumns, &cxt);
nodesWalkList(pSelect->pOrderByList, doCollectColumns, &cxt);
taosHashCleanup(cxt.pColIdHash);
return cxt.pCols;
}
typedef struct SCollectAggFuncsCxt { typedef struct SPlanContext {
SNodeList* pAggFuncs; int32_t errCode;
} SCollectAggFuncsCxt; int32_t planNodeId;
SNodeList* pResource;
} SPlanContext;
static EDealRes doCollectAggFuncs(SNode* pNode, void* pContext) { static SLogicNode* createQueryLogicNode(SPlanContext* pCxt, SNode* pStmt);
if (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsAggFunc(((SFunctionNode*)pNode)->funcId)) { static SLogicNode* createLogicNodeByTable(SPlanContext* pCxt, SSelectStmt* pSelect, SNode* pTable);
SCollectAggFuncsCxt* pCxt = (SCollectAggFuncsCxt*)pContext;
nodesListAppend(pCxt->pAggFuncs, pNode);
return DEAL_RES_IGNORE_CHILD;
}
return DEAL_RES_CONTINUE;
}
static SNodeList* collectAggFuncs(SSelectStmt* pSelect) {
SCollectAggFuncsCxt cxt = { .pAggFuncs = nodesMakeList() };
if (NULL == cxt.pAggFuncs) {
return NULL;
}
nodesWalkNode(pSelect->pHaving, doCollectAggFuncs, &cxt);
nodesWalkList(pSelect->pProjectionList, doCollectAggFuncs, &cxt);
if (!pSelect->isDistinct) {
nodesWalkList(pSelect->pOrderByList, doCollectAggFuncs, &cxt);
}
return cxt.pAggFuncs;
}
typedef struct SRewriteExprCxt { typedef struct SRewriteExprCxt {
int32_t errCode;
int32_t planNodeId;
SNodeList* pTargets; SNodeList* pTargets;
} SRewriteExprCxt; } SRewriteExprCxt;
static EDealRes doRewriteExpr(SNode** pNode, void* pContext) { static EDealRes doRewriteExpr(SNode** pNode, void* pContext) {
switch (nodeType(*pNode)) {
case QUERY_NODE_OPERATOR:
case QUERY_NODE_LOGIC_CONDITION:
case QUERY_NODE_FUNCTION: {
break;
}
default:
break;
}
SRewriteExprCxt* pCxt = (SRewriteExprCxt*)pContext; SRewriteExprCxt* pCxt = (SRewriteExprCxt*)pContext;
SNode* pTarget; SNode* pTarget;
int32_t index = 0; int32_t index = 0;
FOREACH(pTarget, pCxt->pTargets) { FOREACH(pTarget, pCxt->pTargets) {
if (nodesEqualNode(pTarget, *pNode)) { if (nodesEqualNode(pTarget, *pNode)) {
SColumnRefNode* pCol = (SColumnRefNode*)nodesMakeNode(QUERY_NODE_COLUMN_REF);
if (NULL == pCol) {
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
return DEAL_RES_ERROR;
}
pCol->tupleId = pCxt->planNodeId;
pCol->slotId = index;
nodesDestroyNode(*pNode); nodesDestroyNode(*pNode);
*pNode = nodesMakeNode(QUERY_NODE_COLUMN_REF); *pNode = (SNode*)pCol;
((SColumnRef*)*pNode)->slotId = index;
return DEAL_RES_IGNORE_CHILD; return DEAL_RES_IGNORE_CHILD;
} }
++index; ++index;
...@@ -100,105 +79,223 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) { ...@@ -100,105 +79,223 @@ static EDealRes doRewriteExpr(SNode** pNode, void* pContext) {
return DEAL_RES_CONTINUE; return DEAL_RES_CONTINUE;
} }
static int32_t rewriteExpr(SNodeList* pTargets, SSelectStmt* pSelect) { static int32_t rewriteExpr(int32_t planNodeId, SNodeList* pTargets, SSelectStmt* pSelect, ESqlClause clause) {
SRewriteExprCxt cxt = { .pTargets = pTargets }; SRewriteExprCxt cxt = { .errCode = TSDB_CODE_SUCCESS, .planNodeId = planNodeId, .pTargets = pTargets };
nodesRewriteNode(&(pSelect->pFromTable), doRewriteExpr, &cxt); nodesRewriteSelectStmt(pSelect, clause, doRewriteExpr, &cxt);
nodesRewriteNode(&(pSelect->pWhere), doRewriteExpr, &cxt); return cxt.errCode;
nodesRewriteList(pSelect->pPartitionByList, doRewriteExpr, &cxt);
nodesRewriteNode(&(pSelect->pWindow), doRewriteExpr, &cxt);
nodesRewriteList(pSelect->pGroupByList, doRewriteExpr, &cxt);
nodesRewriteNode(&(pSelect->pHaving), doRewriteExpr, &cxt);
nodesRewriteList(pSelect->pProjectionList, doRewriteExpr, &cxt);
nodesRewriteList(pSelect->pOrderByList, doRewriteExpr, &cxt);
return TSDB_CODE_SUCCESS;
} }
static SLogicNode* pushLogicNode(SLogicNode* pRoot, SLogicNode* pNode) { static SLogicNode* pushLogicNode(SPlanContext* pCxt, SLogicNode* pRoot, SLogicNode* pNode) {
if (TSDB_CODE_SUCCESS != pCxt->errCode) {
goto error;
}
if (NULL == pRoot) { if (NULL == pRoot) {
return pNode; return pNode;
} }
if (NULL == pNode) { if (NULL == pNode) {
return pRoot; return pRoot;
} }
pRoot->pParent = pNode;
if (NULL == pNode->pChildren) { if (NULL == pNode->pChildren) {
pNode->pChildren = nodesMakeList(); pNode->pChildren = nodesMakeList();
if (NULL == pNode->pChildren) {
goto error;
}
} }
nodesListAppend(pNode->pChildren, (SNode*)pRoot); if (TSDB_CODE_SUCCESS != nodesListAppend(pNode->pChildren, (SNode*)pRoot)) {
goto error;
}
pRoot->pParent = pNode;
return pNode; return pNode;
error:
nodesDestroyNode((SNode*)pNode);
return pRoot;
} }
static SNodeList* createScanTargets(SNodeList* pCols) { static SNodeList* createScanTargets(int32_t planNodeId, int32_t numOfScanCols) {
SNodeList* pTargets = nodesMakeList();
if (NULL == pTargets) {
return NULL;
}
for (int32_t i = 0; i < numOfScanCols; ++i) {
SColumnRefNode* pCol = (SColumnRefNode*)nodesMakeNode(QUERY_NODE_COLUMN_REF);
if (NULL == pCol || TSDB_CODE_SUCCESS != nodesListAppend(pTargets, (SNode*)pCol)) {
nodesDestroyList(pTargets);
return NULL;
}
pCol->tupleId = planNodeId;
pCol->slotId = i;
}
return pTargets;
} }
static SLogicNode* createScanLogicNode(SSelectStmt* pSelect, SRealTableNode* pRealTable) { static SLogicNode* createScanLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect, SRealTableNode* pRealTable) {
SScanLogicNode* pScan = (SScanLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN); SScanLogicNode* pScan = (SScanLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_SCAN);
SNodeList* pCols = collectColumns(pSelect); CHECK_ALLOC(pScan, NULL);
pScan->pScanCols = nodesCloneList(pCols); pScan->node.id = pCxt->planNodeId++;
//
rewriteExpr(pScan->pScanCols, pSelect);
pScan->node.pTargets = createScanTargets(pCols);
pScan->pMeta = pRealTable->pMeta; pScan->pMeta = pRealTable->pMeta;
// set columns to scan
SNodeList* pCols = NULL;
CHECK_CODE(nodesCollectColumns(pSelect, SQL_CLAUSE_FROM, pScan->pMeta->uid, true, &pCols), (SLogicNode*)pScan);
pScan->pScanCols = nodesCloneList(pCols);
CHECK_ALLOC(pScan->pScanCols, (SLogicNode*)pScan);
// pScanCols of SScanLogicNode is equivalent to pTargets of other logic nodes
CHECK_CODE(rewriteExpr(pScan->node.id, pScan->pScanCols, pSelect, SQL_CLAUSE_FROM), (SLogicNode*)pScan);
// set output
pScan->node.pTargets = createScanTargets(pScan->node.id, LIST_LENGTH(pScan->pScanCols));
CHECK_ALLOC(pScan->node.pTargets, (SLogicNode*)pScan);
return (SLogicNode*)pScan; return (SLogicNode*)pScan;
} }
static SLogicNode* createSubqueryLogicNode(SSelectStmt* pSelect, STempTableNode* pTable) { static SLogicNode* createSubqueryLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect, STempTableNode* pTable) {
return createQueryLogicNode(pTable->pSubquery); return createQueryLogicNode(pCxt, pTable->pSubquery);
}
static SLogicNode* createJoinLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect, SJoinTableNode* pJoinTable) {
SJoinLogicNode* pJoin = (SJoinLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_JOIN);
CHECK_ALLOC(pJoin, NULL);
pJoin->node.id = pCxt->planNodeId++;
pJoin->joinType = pJoinTable->joinType;
// set left and right node
pJoin->node.pChildren = nodesMakeList();
CHECK_ALLOC(pJoin->node.pChildren, (SLogicNode*)pJoin);
SLogicNode* pLeft = createLogicNodeByTable(pCxt, pSelect, pJoinTable->pLeft);
CHECK_ALLOC(pLeft, (SLogicNode*)pJoin);
CHECK_CODE(nodesListAppend(pJoin->node.pChildren, (SNode*)pLeft), (SLogicNode*)pJoin);
SLogicNode* pRight = createLogicNodeByTable(pCxt, pSelect, pJoinTable->pRight);
CHECK_ALLOC(pRight, (SLogicNode*)pJoin);
CHECK_CODE(nodesListAppend(pJoin->node.pChildren, (SNode*)pRight), (SLogicNode*)pJoin);
// set on conditions
pJoin->pOnConditions = nodesCloneNode(pJoinTable->pOnCond);
CHECK_ALLOC(pJoin->pOnConditions, (SLogicNode*)pJoin);
// set the output and rewrite the expression in subsequent clauses with the output
SNodeList* pCols = NULL;
CHECK_CODE(nodesCollectColumns(pSelect, SQL_CLAUSE_FROM, 0, false, &pCols), (SLogicNode*)pJoin);
pJoin->node.pTargets = nodesCloneList(pCols);
CHECK_ALLOC(pJoin->node.pTargets, (SLogicNode*)pJoin);
CHECK_CODE(rewriteExpr(pJoin->node.id, pJoin->node.pTargets, pSelect, SQL_CLAUSE_FROM), (SLogicNode*)pJoin);
return (SLogicNode*)pJoin;
} }
static SLogicNode* createLogicNodeByTable(SSelectStmt* pSelect, SNode* pTable) { static SLogicNode* createLogicNodeByTable(SPlanContext* pCxt, SSelectStmt* pSelect, SNode* pTable) {
switch (nodeType(pTable)) { switch (nodeType(pTable)) {
case QUERY_NODE_REAL_TABLE: case QUERY_NODE_REAL_TABLE:
return createScanLogicNode(pSelect, (SRealTableNode*)pTable); return createScanLogicNode(pCxt, pSelect, (SRealTableNode*)pTable);
case QUERY_NODE_TEMP_TABLE: case QUERY_NODE_TEMP_TABLE:
return createSubqueryLogicNode(pSelect, (STempTableNode*)pTable); return createSubqueryLogicNode(pCxt, pSelect, (STempTableNode*)pTable);
case QUERY_NODE_JOIN_TABLE: case QUERY_NODE_JOIN_TABLE:
return createJoinLogicNode(pCxt, pSelect, (SJoinTableNode*)pTable);
default: default:
break; break;
} }
return NULL; return NULL;
} }
static SLogicNode* createFilterLogicNode(SNode* pWhere) { static SLogicNode* createWhereFilterLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect) {
if (NULL == pWhere) { if (NULL == pSelect->pWhere) {
return NULL; return NULL;
} }
SFilterLogicNode* pFilter = (SFilterLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_FILTER); SFilterLogicNode* pFilter = (SFilterLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_FILTER);
pFilter->node.pConditions = nodesCloneNode(pWhere); CHECK_ALLOC(pFilter, NULL);
pFilter->node.id = pCxt->planNodeId++;
// set filter conditions
pFilter->node.pConditions = nodesCloneNode(pSelect->pWhere);
CHECK_ALLOC(pFilter->node.pConditions, (SLogicNode*)pFilter);
// set the output and rewrite the expression in subsequent clauses with the output
SNodeList* pCols = NULL;
CHECK_CODE(nodesCollectColumns(pSelect, SQL_CLAUSE_WHERE, 0, false, &pCols), (SLogicNode*)pFilter);
pFilter->node.pTargets = nodesCloneList(pCols);
CHECK_ALLOC(pFilter->node.pTargets, (SLogicNode*)pFilter);
CHECK_CODE(rewriteExpr(pFilter->node.id, pFilter->node.pTargets, pSelect, SQL_CLAUSE_WHERE), (SLogicNode*)pFilter);
return (SLogicNode*)pFilter; return (SLogicNode*)pFilter;
} }
static SLogicNode* createAggLogicNode(SSelectStmt* pSelect, SNodeList* pGroupByList, SNode* pHaving) { static SLogicNode* createAggLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect) {
SNodeList* pAggFuncs = collectAggFuncs(pSelect); SNodeList* pAggFuncs = NULL;
if (NULL == pAggFuncs && NULL == pGroupByList) { CHECK_CODE(nodesCollectFuncs(pSelect, fmIsAggFunc, &pAggFuncs), NULL);
if (NULL == pAggFuncs && NULL == pSelect->pGroupByList) {
return NULL; return NULL;
} }
SAggLogicNode* pAgg = (SAggLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_AGG); SAggLogicNode* pAgg = (SAggLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_AGG);
pAgg->pGroupKeys = nodesCloneList(pGroupByList); CHECK_ALLOC(pAgg, NULL);
pAgg->node.id = pCxt->planNodeId++;
// set grouyp keys, agg funcs and having conditions
pAgg->pGroupKeys = nodesCloneList(pSelect->pGroupByList);
CHECK_ALLOC(pAgg->pGroupKeys, (SLogicNode*)pAgg);
pAgg->pAggFuncs = nodesCloneList(pAggFuncs); pAgg->pAggFuncs = nodesCloneList(pAggFuncs);
pAgg->node.pConditions = nodesCloneNode(pHaving); CHECK_ALLOC(pAgg->pAggFuncs, (SLogicNode*)pAgg);
pAgg->node.pConditions = nodesCloneNode(pSelect->pHaving);
CHECK_ALLOC(pAgg->node.pConditions, (SLogicNode*)pAgg);
// set the output and rewrite the expression in subsequent clauses with the output
SNodeList* pCols = NULL;
CHECK_CODE(nodesCollectColumns(pSelect, SQL_CLAUSE_HAVING, 0, false, &pCols), (SLogicNode*)pAgg);
pAgg->node.pTargets = nodesCloneList(pCols);
CHECK_ALLOC(pAgg->node.pTargets, (SLogicNode*)pAgg);
CHECK_CODE(rewriteExpr(pAgg->node.id, pAgg->node.pTargets, pSelect, SQL_CLAUSE_HAVING), (SLogicNode*)pAgg);
return (SLogicNode*)pAgg; return (SLogicNode*)pAgg;
} }
static SLogicNode* createSelectLogicNode(SSelectStmt* pSelect) { static SLogicNode* createProjectLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect) {
SLogicNode* pRoot = createLogicNodeByTable(pSelect, pSelect->pFromTable); SProjectLogicNode* pProject = (SProjectLogicNode*)nodesMakeNode(QUERY_NODE_LOGIC_PLAN_PROJECT);
pRoot = pushLogicNode(pRoot, createFilterLogicNode(pSelect->pWhere)); CHECK_ALLOC(pProject, NULL);
pRoot = pushLogicNode(pRoot, createAggLogicNode(pSelect, pSelect->pGroupByList, pSelect->pHaving)); pProject->node.id = pCxt->planNodeId++;
// pRoot = pushLogicNode(pRoot, createProjectLogicNode(pSelect, pSelect->pProjectionList));
pProject->node.pTargets = nodesCloneList(pSelect->pProjectionList);
CHECK_ALLOC(pProject->node.pTargets, (SLogicNode*)pProject);
return (SLogicNode*)pProject;
}
static SLogicNode* createSelectLogicNode(SPlanContext* pCxt, SSelectStmt* pSelect) {
SLogicNode* pRoot = createLogicNodeByTable(pCxt, pSelect, pSelect->pFromTable);
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
pRoot = pushLogicNode(pCxt, pRoot, createWhereFilterLogicNode(pCxt, pSelect));
}
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
pRoot = pushLogicNode(pCxt, pRoot, createAggLogicNode(pCxt, pSelect));
}
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
pRoot = pushLogicNode(pCxt, pRoot, createProjectLogicNode(pCxt, pSelect));
}
return pRoot; return pRoot;
} }
static SLogicNode* createQueryLogicNode(SNode* pStmt) { static SLogicNode* createQueryLogicNode(SPlanContext* pCxt, SNode* pStmt) {
switch (nodeType(pStmt)) { switch (nodeType(pStmt)) {
case QUERY_NODE_SELECT_STMT: case QUERY_NODE_SELECT_STMT:
return createSelectLogicNode((SSelectStmt*)pStmt); return createSelectLogicNode(pCxt, (SSelectStmt*)pStmt);
default: default:
break; break;
} }
} }
int32_t createLogicPlan(SNode* pNode, SLogicNode** pLogicNode) { int32_t createLogicPlan(SNode* pNode, SLogicNode** pLogicNode) {
*pLogicNode = createQueryLogicNode(pNode); SPlanContext cxt = { .errCode = TSDB_CODE_SUCCESS, .planNodeId = 0 };
SLogicNode* pRoot = createQueryLogicNode(&cxt, pNode);
if (TSDB_CODE_SUCCESS != cxt.errCode) {
nodesDestroyNode((SNode*)pRoot);
return cxt.errCode;
}
*pLogicNode = pRoot;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -137,7 +137,7 @@ int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransp ...@@ -137,7 +137,7 @@ int32_t asyncSendMsgToServer(void *pTransporter, SEpSet* epSet, int64_t* pTransp
.pCont = pMsg, .pCont = pMsg,
.contLen = pInfo->msgInfo.len, .contLen = pInfo->msgInfo.len,
.ahandle = (void*) pInfo, .ahandle = (void*) pInfo,
.handle = NULL, .handle = pInfo->msgInfo.handle,
.code = 0 .code = 0
}; };
......
...@@ -95,6 +95,7 @@ typedef struct SSchTask { ...@@ -95,6 +95,7 @@ typedef struct SSchTask {
int32_t childReady; // child task ready number int32_t childReady; // child task ready number
SArray *children; // the datasource tasks,from which to fetch the result, element is SQueryTask* SArray *children; // the datasource tasks,from which to fetch the result, element is SQueryTask*
SArray *parents; // the data destination tasks, get data from current task, element is SQueryTask* SArray *parents; // the data destination tasks, get data from current task, element is SQueryTask*
void* handle; // task send handle
} SSchTask; } SSchTask;
typedef struct SSchJobAttr { typedef struct SSchJobAttr {
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
#include "query.h" #include "query.h"
#include "catalog.h" #include "catalog.h"
typedef struct SSchTrans {
void *transInst;
void *transHandle;
}SSchTrans;
static SSchedulerMgmt schMgmt = {0}; static SSchedulerMgmt schMgmt = {0};
uint64_t schGenTaskId(void) { uint64_t schGenTaskId(void) {
...@@ -932,6 +936,7 @@ int32_t schHandleCallback(void* param, const SDataBuf* pMsg, int32_t msgType, in ...@@ -932,6 +936,7 @@ int32_t schHandleCallback(void* param, const SDataBuf* pMsg, int32_t msgType, in
pTask = *task; pTask = *task;
SCH_TASK_DLOG("rsp msg received, type:%s, code:%s", TMSG_INFO(msgType), tstrerror(rspCode)); SCH_TASK_DLOG("rsp msg received, type:%s, code:%s", TMSG_INFO(msgType), tstrerror(rspCode));
pTask->handle = pMsg->handle;
SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode)); SCH_ERR_JRET(schHandleResponseMsg(pJob, pTask, msgType, pMsg->pData, pMsg->len, rspCode));
_return: _return:
...@@ -1000,6 +1005,9 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) { ...@@ -1000,6 +1005,9 @@ int32_t schGetCallbackFp(int32_t msgType, __async_send_cb_fn_t *fp) {
int32_t schAsyncSendMsg(void *transport, SEpSet* epSet, uint64_t qId, uint64_t tId, int32_t msgType, void *msg, uint32_t msgSize) { int32_t schAsyncSendMsg(void *transport, SEpSet* epSet, uint64_t qId, uint64_t tId, int32_t msgType, void *msg, uint32_t msgSize) {
int32_t code = 0; int32_t code = 0;
SSchTrans *trans = (SSchTrans *)transport;
SMsgSendInfo* pMsgSendInfo = calloc(1, sizeof(SMsgSendInfo)); SMsgSendInfo* pMsgSendInfo = calloc(1, sizeof(SMsgSendInfo));
if (NULL == pMsgSendInfo) { if (NULL == pMsgSendInfo) {
qError("QID:%"PRIx64 ",TID:%"PRIx64 " calloc %d failed", qId, tId, (int32_t)sizeof(SMsgSendInfo)); qError("QID:%"PRIx64 ",TID:%"PRIx64 " calloc %d failed", qId, tId, (int32_t)sizeof(SMsgSendInfo));
...@@ -1018,14 +1026,16 @@ int32_t schAsyncSendMsg(void *transport, SEpSet* epSet, uint64_t qId, uint64_t t ...@@ -1018,14 +1026,16 @@ int32_t schAsyncSendMsg(void *transport, SEpSet* epSet, uint64_t qId, uint64_t t
param->queryId = qId; param->queryId = qId;
param->taskId = tId; param->taskId = tId;
pMsgSendInfo->param = param; pMsgSendInfo->param = param;
pMsgSendInfo->msgInfo.pData = msg; pMsgSendInfo->msgInfo.pData = msg;
pMsgSendInfo->msgInfo.len = msgSize; pMsgSendInfo->msgInfo.len = msgSize;
pMsgSendInfo->msgInfo.handle = trans->transHandle;
pMsgSendInfo->msgType = msgType; pMsgSendInfo->msgType = msgType;
pMsgSendInfo->fp = fp; pMsgSendInfo->fp = fp;
int64_t transporterId = 0; int64_t transporterId = 0;
code = asyncSendMsgToServer(transport, epSet, &transporterId, pMsgSendInfo); code = asyncSendMsgToServer(trans->transInst, epSet, &transporterId, pMsgSendInfo);
if (code) { if (code) {
SCH_ERR_JRET(code); SCH_ERR_JRET(code);
} }
...@@ -1149,7 +1159,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr, ...@@ -1149,7 +1159,8 @@ int32_t schBuildAndSendMsg(SSchJob *pJob, SSchTask *pTask, SQueryNodeAddr *addr,
atomic_store_32(&pTask->lastMsgType, msgType); atomic_store_32(&pTask->lastMsgType, msgType);
SCH_ERR_JRET(schAsyncSendMsg(pJob->transport, &epSet, pJob->queryId, pTask->taskId, msgType, msg, msgSize)); SSchTrans trans = {.transInst = pJob->transport, .transHandle = pTask->handle};
SCH_ERR_JRET(schAsyncSendMsg(&trans, &epSet, pJob->queryId, pTask->taskId, msgType, msg, msgSize));
if (isCandidateAddr) { if (isCandidateAddr) {
SCH_ERR_RET(schRecordTaskExecNode(pJob, pTask, addr)); SCH_ERR_RET(schRecordTaskExecNode(pJob, pTask, addr));
......
...@@ -133,15 +133,18 @@ static void clientHandleResp(SCliConn* conn) { ...@@ -133,15 +133,18 @@ static void clientHandleResp(SCliConn* conn) {
rpcMsg.msgType = pHead->msgType; rpcMsg.msgType = pHead->msgType;
rpcMsg.ahandle = pCtx->ahandle; rpcMsg.ahandle = pCtx->ahandle;
if (rpcMsg.msgType == TDMT_VND_QUERY_RSP || rpcMsg.msgType == TDMT_VND_FETCH_RSP) { if (rpcMsg.msgType == TDMT_VND_QUERY_RSP || rpcMsg.msgType == TDMT_VND_FETCH_RSP ||
rpcMsg.msgType == TDMT_VND_RES_READY) {
rpcMsg.handle = conn; rpcMsg.handle = conn;
conn->persist = 1; conn->persist = 1;
tDebug("client conn %p persist by app", conn);
} }
tDebug("client conn %p %s received from %s:%d, local info: %s:%d", conn, TMSG_INFO(pHead->msgType), tDebug("client conn %p %s received from %s:%d, local info: %s:%d", conn, TMSG_INFO(pHead->msgType),
inet_ntoa(conn->addr.sin_addr), ntohs(conn->addr.sin_port), inet_ntoa(conn->locaddr.sin_addr), inet_ntoa(conn->addr.sin_addr), ntohs(conn->addr.sin_port), inet_ntoa(conn->locaddr.sin_addr),
ntohs(conn->locaddr.sin_port)); ntohs(conn->locaddr.sin_port));
conn->secured = pHead->secured;
if (conn->push != NULL && conn->ctnRdCnt != 0) { if (conn->push != NULL && conn->ctnRdCnt != 0) {
(*conn->push->callback)(conn->push->arg, &rpcMsg); (*conn->push->callback)(conn->push->arg, &rpcMsg);
conn->push = NULL; conn->push = NULL;
...@@ -156,7 +159,6 @@ static void clientHandleResp(SCliConn* conn) { ...@@ -156,7 +159,6 @@ static void clientHandleResp(SCliConn* conn) {
} }
} }
conn->ctnRdCnt += 1; conn->ctnRdCnt += 1;
conn->secured = pHead->secured;
// buf's mem alread translated to rpcMsg.pCont // buf's mem alread translated to rpcMsg.pCont
transClearBuffer(&conn->readBuf); transClearBuffer(&conn->readBuf);
...@@ -166,16 +168,14 @@ static void clientHandleResp(SCliConn* conn) { ...@@ -166,16 +168,14 @@ static void clientHandleResp(SCliConn* conn) {
SCliThrdObj* pThrd = conn->hostThrd; SCliThrdObj* pThrd = conn->hostThrd;
// user owns conn->persist = 1 // user owns conn->persist = 1
if (conn->push == NULL || conn->persist == 0) { if (conn->push == NULL && conn->persist == 0) {
addConnToPool(pThrd->pool, pCtx->ip, pCtx->port, conn); addConnToPool(pThrd->pool, pCtx->ip, pCtx->port, conn);
destroyCmsg(conn->data);
conn->data = NULL;
} }
destroyCmsg(conn->data);
conn->data = NULL;
// start thread's timer of conn pool if not active // start thread's timer of conn pool if not active
if (!uv_is_active((uv_handle_t*)pThrd->timer) && pRpc->idleTime > 0) { if (!uv_is_active((uv_handle_t*)pThrd->timer) && pRpc->idleTime > 0) {
uv_timer_start((uv_timer_t*)pThrd->timer, clientTimeoutCb, CONN_PERSIST_TIME(pRpc->idleTime) / 2, 0); // uv_timer_start((uv_timer_t*)pThrd->timer, clientTimeoutCb, CONN_PERSIST_TIME(pRpc->idleTime) / 2, 0);
} }
} }
static void clientHandleExcept(SCliConn* pConn) { static void clientHandleExcept(SCliConn* pConn) {
...@@ -330,6 +330,9 @@ static void clientAllocBufferCb(uv_handle_t* handle, size_t suggested_size, uv_b ...@@ -330,6 +330,9 @@ static void clientAllocBufferCb(uv_handle_t* handle, size_t suggested_size, uv_b
} }
static void clientReadCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { static void clientReadCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
// impl later // impl later
if (handle->data == NULL) {
return;
}
SCliConn* conn = handle->data; SCliConn* conn = handle->data;
SConnBuffer* pBuf = &conn->readBuf; SConnBuffer* pBuf = &conn->readBuf;
if (nread > 0) { if (nread > 0) {
......
...@@ -256,6 +256,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retriev ...@@ -256,6 +256,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_FUNC_RETRIEVE, "Invalid func retriev
// mnode-trans // mnode-trans
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_NOT_EXIST, "Transaction not exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_INVALID_STAGE, "Invalid stage to kill")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_CANT_PARALLEL, "Invalid stage to kill")
// mnode-topic // mnode-topic
TAOS_DEFINE_ERROR(TSDB_CODE_MND_UNSUPPORTED_TOPIC, "Topic with STable not supported yet") TAOS_DEFINE_ERROR(TSDB_CODE_MND_UNSUPPORTED_TOPIC, "Topic with STable not supported yet")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册